aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martínez <jjm@usebox.net>2021-10-02 20:08:15 +0000
committerJuan J. Martínez <jjm@usebox.net>2021-10-02 20:08:15 +0000
commit32ecf3da770e2f4a1dcdafd00bcf2a3d0d5751d2 (patch)
tree9cb94ffc3bc68f0d998e8881592b160aa4fcdf67
parent5763dc7aa0b0fc44d9776f582b692d086f8b5b6d (diff)
parent271902c4c9b85137cf223e62ba7196cccfcb7479 (diff)
downloadubox-msx-lib-32ecf3da770e2f4a1dcdafd00bcf2a3d0d5751d2.tar.gz
ubox-msx-lib-32ecf3da770e2f4a1dcdafd00bcf2a3d0d5751d2.zip
Merge branch 'config-env' into 'master'
Introduced config.env See merge request reidrac/ubox-msx-lib!15
-rw-r--r--config.env4
-rw-r--r--game/src/Makefile7
-rw-r--r--tests/Makefile3
-rwxr-xr-xtests/test_rom.py4
4 files changed, 12 insertions, 6 deletions
diff --git a/config.env b/config.env
new file mode 100644
index 0000000..21ce6c9
--- /dev/null
+++ b/config.env
@@ -0,0 +1,4 @@
+# This env file controls some parameters of the build/test system
+
+# Size of the resulting ROM
+ROM_MAX=0x8000
diff --git a/game/src/Makefile b/game/src/Makefile
index 6ac7a0a..e42313d 100644
--- a/game/src/Makefile
+++ b/game/src/Makefile
@@ -1,12 +1,11 @@
TARGET := game
+include ../../config.env
+
CODE := 0x4000
# leaves 222 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
UBOX_LIBS := $(wildcard ../../lib/*.lib)
@@ -19,7 +18,7 @@ CFLAGS := -mz80 --Werror -I../../include -I../generated --fsigned-char --std-sdc
LDFLAGS := -L../../lib -L. --no-std-crt0 --fomit-frame-pointer
all: $(OUTPUT)/$(TARGET).rom
- @../../tools/chksize 8000 4000 $(OUTPUT)/$(TARGET).map
+ @../../tools/chksize $(ROM_MAX) 4000 $(OUTPUT)/$(TARGET).map
@cp ../bin/$(TARGET).rom ../../bin
openmsx: all
diff --git a/tests/Makefile b/tests/Makefile
index 6c1a9a4..32933e0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,6 +1,9 @@
default:
$(error Please use the Makefile from root directory)
+include ../config.env
+.EXPORT_ALL_VARIABLES: test
+
TESTS := $(wildcard test_*.py)
test:
diff --git a/tests/test_rom.py b/tests/test_rom.py
index a2148e1..d980dad 100755
--- a/tests/test_rom.py
+++ b/tests/test_rom.py
@@ -2,13 +2,13 @@
import unittest
import struct
-from os import path
+from os import path, environ
class TestRom(unittest.TestCase):
"""Test that the generated game ROM is correct."""
- ROM_SIZE = 0x8000
+ ROM_SIZE = int(environ.get("ROM_MAX", 0), 16)
@classmethod
def setUpClass(cls):