-
-
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, ex: src/engine/enemy/*)
-
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
The makefile supports 3 different profiles:
- release --> release / optimized build (default)
- 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:
SGDK_PATH\bin\make -f SGDK_PATH\makefile.gen
Don't forget that SGDK_PATH refer to the full path where you installed SGDK (don't forget to also specify the drive letter - ex D:\SGDK).
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:
SGDK_PATH\bin\make -f SGDK_PATH\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 :)