]> cloudbase.mooo.com Git - ddt180.git/blobdiff - Makefile
New utility prl2offz: Make .com from .prl and convert prl reloc bitmap to compressed...
[ddt180.git] / Makefile
index 44b6c27637c6f9c8804c90ba3703b4befad1a883..0d11916b6a756f670ceb3e69c725be0cf9208857 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,38 +1,47 @@
 # Build ddt180.com from ddt180.z80
 
+CPM    := 0
+
 PROG   := ddt180
+OBJ    := $(PROG).rel
 
-SRC    := $(PROG).z80
+ifneq ($(CPM),0)
+  SUFFIX := z80
+else
+  SUFFIX := 180
+endif
 
 EXTRA_DIST := autorevision.cache version.inc
 
-OBJ    := $(SRC:.z80=.rel)
 
 DIST_NAME = $(PROG)_$(VERS).zip
 PREFIX = $(PROG)_$(VERS)
 
-ASM    := zxcc slrz80.com
+ASM    := zxcc slr$(SUFFIX).com
 LINK   := zxcc link80.com
 CP     := cp
 RM     := rm -f
 GIT    := git
 ZIP    := zip
 
-AS_OPT := MFS
+AS_OPT := MFSX
 
 .phony: all
 all: $(PROG).com
 
+.intermediate: $(PROG).180
 
+$(PROG).180: $(PROG).z80
+       cp $< $@
 
-$(PROG).com: $(PROG).prl
+$(PROG).com: $(PROG).prl Makefile
        @# Remove the PRL header record (256 bytes)
        dd status=none bs=256 skip=1  if=$< of=$@
 
 $(PROG).prl: $(OBJ)
-       $(LINK) -'$(PROG)[op,$$SZ]'
+       $(LINK) -'$(PROG)[op]'
 
-$(PROG).rel: version.inc
+$(PROG).rel: config.inc version.inc
 
 $(foreach X,$(subst =,:=,$(subst ",,$(filter VCS_%,\
        $(shell autorevision -t sh -o $(CURDIR)/autorevision.cache)))),$(eval $X))
@@ -57,6 +66,11 @@ version.inc: autorevision.cache
                db      '$(VERS)'\r\n\
                endm\r\n\032" > $@
 
+config.inc: Makefile
+       @printf "\
+       CPM     equ     $(CPM)\r\n\
+       \032" > $@
+
 .phony: dist
 dist: $(PROG).com version.inc
        $(GIT) archive --format=zip --prefix=$(PREFIX)/ -9 -o $(DIST_NAME) HEAD^{tree}
@@ -67,10 +81,10 @@ dist: $(PROG).com version.inc
 
 .phony: clean
 clean:
-       rm -f $(PROG).com *.rel *.lst *.prl
+       rm -f $(PROG).com $(PROG).180 *.rel *.lst *.prl
 
 .SUFFIXES:
-.SUFFIXES: .z80 .rel .prl
+.SUFFIXES: .z80 .180 .rel .prl
 
 
 define cpm-asm =
@@ -78,9 +92,10 @@ 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 ; \
+if [ "$${ERROR}" != "0" ]; then cat $${OUTPUT}; rm -f $@; \
+else awk -f filter-unref.awk ddt180.lst; fi ; \
 exit $${ERROR}
 endef
 
-%.rel %lst: %.z80
+%.rel %lst: %.$(SUFFIX)
        @$(cpm-asm)