summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo C2016-08-02 12:15:42 +0200
committerLeo C2016-08-02 12:15:42 +0200
commit668cf0f72e038d58d32479d9abd0c7a3c38646d3 (patch)
treeb118a82e81a774dbba6af685e141f8b852749e7e
parented6c425a2879de0115c2fab2c9b9e74088c336e8 (diff)
downloadddt180-668cf0f72e038d58d32479d9abd0c7a3c38646d3.zip
Add Makefile, .gitignore
-rw-r--r--.gitignore4
-rw-r--r--Makefile46
2 files changed, 50 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a652e60
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.lst
+*.rel
+*.prl
+*.com
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0b58086
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,46 @@
+# Build ddtz.com from ddtz.z80
+
+PROG := ddtz
+
+SRC := $(PROG).z80
+
+OBJ := $(SRC:.z80=.rel)
+
+AS_OPT := MF
+
+ASM := zxcc slrz80.com
+LINK := zxcc link80.com
+
+.phony: all
+all: $(PROG).com
+
+
+
+$(PROG).com: $(PROG).prl
+ @# Remove the PRL header record (256 bytes)
+ dd status=none bs=256 skip=1 if=$< of=$@
+
+$(PROG).prl: $(OBJ)
+ $(LINK) -'$(PROG)[op,$$SZ]'
+
+
+
+.phony: clean
+clean:
+ rm -f $(PROG).com *.rel *.lst *.prl
+
+.SUFFIXES:
+.SUFFIXES: .z80 .rel .prl
+
+
+define cpm-asm =
+COMMAND="$(ASM) -$(basename $<)/$(AS_OPT)"; \
+OUTPUT=$$(mktemp); echo $${COMMAND}; \
+$${COMMAND} > $${OUTPUT}; \
+grep -q '^ 0 Error(s) Detected' $${OUTPUT}; ERROR=$$? ; \
+if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; rm -f $@; fi ; \
+exit $${ERROR}
+endef
+
+%.rel %lst: %.z80
+ @$(cpm-asm)