-
-
Notifications
You must be signed in to change notification settings - Fork 189
SGDK Usage
SGDK uses a generic makefile to compile project. In order to be properly recognized by the makefile you need to organize your project folder structure as following:
project root
-
src = source files (sub-folder supported up to 2 depth levels - src/engine/enemy/enemy_fly.c)
-
inc = include files
-
res = resource files
-
out = output files (will be created automatically)
where
- source files can be .c (C source file), .s (68k assembly source file) or .s80 (Z80 assembly source file)
- include files can be .h (C include file) or .inc (assembly include file)
- primary resource files should be .res (resource definition file compiled by rescomp tool, see bin/rescomp.txt file)
- others resources files can be located anywhere while you are referring them correctly in your .res file.
- .bmp = image file (indexed colors only)
- .png = image file (indexed colors only)
- .vgm = VGM music dump file (Megadrive only)
- .xgm = XGM music file
- .wav = WAV sound file (used for SFX)
- .bin = binary data file
- .c = C source file
- .s = 68k assembly source file
You can read the bin/rescomp.txt file to have more information about supported resource files. Note that SGDK supports
The makefile supports 3 different profiles:
- release (default) --> release / optimized build
- _debug _ --> debug build containing symbols and displaying errors in Gens KMod log (see Tuto Introduction page)
- _asm _ --> used to generate assembly listing
So to compile your project you need to use the following command directly from your project folder:
%GDK_WIN%\bin\make -f %GDK_WIN%\makefile.gen
Note that if you omit the profile it will use the release one by default, if you want to use the debug build you will need to use:
%GDK_WIN%\bin\make -f %GDK_WIN%\makefile.gen debug
Normally if everything went right you should obtain a rom.bin file in the out folder. You can directly load this rom.bin file into an emulator (or put on your flash cart if you have one) to test it.
You can now continue to the tutorials section to start the serious things :)