summaryrefslogtreecommitdiff
path: root/game/src/Makefile
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2020-12-30 19:07:31 +0000
committerJuan J. Martinez <jjm@usebox.net>2020-12-30 19:23:41 +0000
commit2682bc5d1d864341aaeb42a449db73c3ecd16d70 (patch)
tree9116764364b4ee0ce7f6037305077807b57776de /game/src/Makefile
downloadubox-msx-lib-2682bc5d1d864341aaeb42a449db73c3ecd16d70.tar.gz
ubox-msx-lib-2682bc5d1d864341aaeb42a449db73c3ecd16d70.zip
Initial import1.0
Diffstat (limited to 'game/src/Makefile')
-rw-r--r--game/src/Makefile48
1 files changed, 48 insertions, 0 deletions
diff --git a/game/src/Makefile b/game/src/Makefile
new file mode 100644
index 0000000..7fa9f2f
--- /dev/null
+++ b/game/src/Makefile
@@ -0,0 +1,48 @@
+TARGET=game
+
+CODE=0x4000
+# leaves 199 bytes for AKM player buffer
+DATA=0xc0de
+
+# HEX, will fill with 0
+ROM_MAX=8000
+
+OUTPUT=../build
+OBJS = $(patsubst %.c,$(OUTPUT)/%.rel,$(wildcard *.c)) $(OUTPUT)/akm.rel
+LIBS = -lubox -lspman -lmplayer
+
+CC=sdcc
+AS=sdasz80
+AR=sdcclib
+CFLAGS=-mz80 --Werror -I../../include -I../generated --fsigned-char --std-sdcc99 --opt-code-speed
+LDFLAGS=-L../../lib -L. --no-std-crt0 --fomit-frame-pointer
+
+all: $(OUTPUT)/$(TARGET).rom
+ @../../tools/chksize 8000 4000 $(OUTPUT)/$(TARGET).map
+ cp ../bin/$(TARGET).rom ../../bin
+
+openmsx: all
+ openmsx -carta $(OUTPUT)/$(TARGET).rom -machine msx1
+
+$(OUTPUT)/%.rel: %.c
+ $(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@
+
+$(OUTPUT)/%.rel: %.z80
+ $(AS) -g -o $@ $<
+
+$(OUTPUT)/akm.rel: akm.z80 song.asm effects.asm
+ ../../bin/rasm akm.z80 -o $(OUTPUT)/akm -s -sl -sq
+ Disark --sourceProfile sdcc --symbolFile $(OUTPUT)/akm.sym --src16bitsValuesInHex --src8bitsValuesInHex --undocumentedOpcodesToBytes $(OUTPUT)/akm.bin $(OUTPUT)/akm_sdcc.asm
+ $(AS) -g -o $@ $(OUTPUT)/akm_sdcc.asm
+
+$(OUTPUT)/$(TARGET).rom: $(OBJS) $(OUTPUT)/crt0.rel ../../lib/*.lib
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) --code-loc $(CODE) --data-loc $(DATA) $(OUTPUT)/crt0.rel $(OBJS) -o $(OUTPUT)/$(TARGET).ihx
+ ../../bin/hex2bin -e bin -p 00 -l $(ROM_MAX) $(OUTPUT)/$(TARGET).ihx
+ mv $(OUTPUT)/$(TARGET).bin ../bin/$(TARGET).rom
+
+clean:
+ rm -f $(OUTPUT)/*
+
+.PHONY: all clean
+
+include Makefile.deps