aboutsummaryrefslogtreecommitdiff
path: root/game/src
diff options
context:
space:
mode:
authorJuan J. Martínez <jjm@usebox.net>2021-12-16 07:15:42 +0000
committerJuan J. Martínez <jjm@usebox.net>2021-12-16 07:15:42 +0000
commita49e59775e4810538f0f0bbe4431e36cb11effb3 (patch)
tree5ec7f6d42dc9adbc8d81c07e366b903d81179151 /game/src
parent11a569e72365370fc908de56b8a05da754980bf3 (diff)
parent7228a87f950ae665a55030e12cd8adc8992b5d07 (diff)
downloadubox-msx-lib-a49e59775e4810538f0f0bbe4431e36cb11effb3.tar.gz
ubox-msx-lib-a49e59775e4810538f0f0bbe4431e36cb11effb3.zip
Merge branch 'pedro' into 'master'
Starting Openmsx through GNU make works now See merge request reidrac/ubox-msx-lib!18
Diffstat (limited to 'game/src')
-rw-r--r--game/src/Makefile41
1 files changed, 23 insertions, 18 deletions
diff --git a/game/src/Makefile b/game/src/Makefile
index 52f01ea..bd8f3ff 100644
--- a/game/src/Makefile
+++ b/game/src/Makefile
@@ -6,43 +6,48 @@ CODE := 0x4000
# leaves 222 bytes for AKM player buffer
DATA := 0xc0de
-OUTPUT := ../build
-OBJS := $(patsubst %.c,$(OUTPUT)/%.rel,$(wildcard *.c)) $(OUTPUT)/akm.rel
+OUTDIR := ../../bin
+TMPDIR := ../build
+OBJS := $(patsubst %.c,$(TMPDIR)/%.rel,$(wildcard *.c)) $(TMPDIR)/akm.rel
UBOX_LIBS := $(wildcard ../../lib/*.lib)
LIBS := -lubox -lspman -lmplayer -lap
CC := sdcc
AS := sdasz80
AR := sdcclib
+CHKSIZE := ../../tools/chksize
CFLAGS := -mz80 --Werror -I../../include -I../generated --fsigned-char --std-sdcc99 --opt-code-speed $(EXTRA_CFLAGS)
LDFLAGS := -L../../lib -L. --no-std-crt0 --fomit-frame-pointer
-all: $(OUTPUT)/$(TARGET).rom
- @../../tools/chksize $(ROM_MAX) 4000 $(OUTPUT)/$(TARGET).map
- @cp ../bin/$(TARGET).rom ../../bin
+default:
+ $(error Please use the Makefile from root directory)
+
+all: $(TMPDIR)/$(TARGET).rom
+ @$(CHKSIZE) $(ROM_MAX) 4000 $(TMPDIR)/$(TARGET).map
+ @cp $(TMPDIR)/$(TARGET).rom $(OUTDIR)
openmsx: all
- openmsx -carta $(OUTPUT)/$(TARGET).rom -machine msx1
+ openmsx -carta $(OUTDIR)/$(TARGET).rom -machine msx1
-$(OUTPUT)/%.rel: %.c
+$(TMPDIR)/%.rel: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@
-$(OUTPUT)/%.rel: %.z80
+$(TMPDIR)/%.rel: %.z80
$(AS) -g -o $@ $<
-$(OUTPUT)/akm.rel: akm.z80 song.asm effects.asm
- 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
+$(TMPDIR)/akm.rel: akm.z80 song.asm effects.asm
+ rasm akm.z80 -o $(TMPDIR)/akm -s -sl -sq
+ Disark --sourceProfile sdcc --symbolFile $(TMPDIR)/akm.sym --src16bitsValuesInHex --src8bitsValuesInHex --undocumentedOpcodesToBytes $(TMPDIR)/akm.bin $(TMPDIR)/akm_sdcc.asm
+ $(AS) -g -o $@ $(TMPDIR)/akm_sdcc.asm
-$(OUTPUT)/$(TARGET).rom: $(OBJS) $(OUTPUT)/crt0.rel $(UBOX_LIBS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) --code-loc $(CODE) --data-loc $(DATA) $(OUTPUT)/crt0.rel $(OBJS) -o $(OUTPUT)/$(TARGET).ihx
- hex2bin -e bin -p 00 -l $(ROM_MAX) $(OUTPUT)/$(TARGET).ihx
- @cp $(OUTPUT)/$(TARGET).bin ../bin/$(TARGET).rom
+$(TMPDIR)/$(TARGET).rom: $(OBJS) $(TMPDIR)/crt0.rel $(UBOX_LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) --code-loc $(CODE) --data-loc $(DATA) $(TMPDIR)/crt0.rel $(OBJS) -o $(TMPDIR)/$(TARGET).ihx
+ hex2bin -e bin -p 00 -l $(ROM_MAX) $(TMPDIR)/$(TARGET).ihx
+ @cp $(TMPDIR)/$(TARGET).bin $(TMPDIR)/$(TARGET).rom
clean:
- rm -f $(OUTPUT)/*
- rm -f ../bin/$(TARGET).rom ../../bin/$(TARGET).rom
+ rm -f $(TMPDIR)/*
+ rm -f $(OUTDIR)/$(TARGET).rom
.PHONY: all clean