aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--Makefile3
-rw-r--r--game/Makefile5
-rw-r--r--game/src/Makefile41
3 files changed, 30 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index c897c2a..e97a66c 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ game: bin libs
test: game
make -C tests test
+openmsx: game
+ make -C game openmsx
+
docs:
make -C docs
diff --git a/game/Makefile b/game/Makefile
index 6c3d855..3fe43f3 100644
--- a/game/Makefile
+++ b/game/Makefile
@@ -4,7 +4,7 @@ default:
all: generated bin build
make -C data
cd src && ../../tools/mkdeps.py -b ../build -I ../generated:../../include ./ Makefile.deps
- make -C src
+ make -C src all
generated:
mkdir -p ./generated
@@ -15,6 +15,9 @@ bin:
build:
mkdir -p ./build
+openmsx: all
+ make -C src openmsx
+
.PHONY: all clean default
clean:
rm -rf ./generated ./bin ./build
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