X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/4903b8b8b349f34ab8b9a8667ccfe59d1862f428..dfd599a0a08f4aaabb0553c944eea38e82ef9da1:/Makefile?ds=inline diff --git a/Makefile b/Makefile index 7694f5b..0d11916 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,90 @@ # Build ddt180.com from ddt180.z80 +CPM := 0 + PROG := ddt180 +OBJ := $(PROG).rel + +ifneq ($(CPM),0) + SUFFIX := z80 +else + SUFFIX := 180 +endif + +EXTRA_DIST := autorevision.cache version.inc -SRC := $(PROG).z80 -OBJ := $(SRC:.z80=.rel) +DIST_NAME = $(PROG)_$(VERS).zip +PREFIX = $(PROG)_$(VERS) -AS_OPT := MFS +ASM := zxcc slr$(SUFFIX).com +LINK := zxcc link80.com +CP := cp +RM := rm -f +GIT := git +ZIP := zip -ASM := zxcc slrz80.com -LINK := zxcc link80.com +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: config.inc version.inc + +$(foreach X,$(subst =,:=,$(subst ",,$(filter VCS_%,\ + $(shell autorevision -t sh -o $(CURDIR)/autorevision.cache)))),$(eval $X)) + +VERS := $(shell echo "$(VCS_TAG)" | sed -e 's/^v//g') + +ifneq ($(VCS_TICK),0) + VERS := $(VERS)-$(VCS_TICK) +endif +ifneq ($(VCS_BRANCH),master) + VERS := $(VERS)-$(VCS_BRANCH) +endif +ifeq ($(VCS_WC_MODIFIED),1) + VERS := $(VERS)-dirty +endif + + + +version.inc: autorevision.cache + @echo update $@ to $(VERS) + @printf "defvers macro\r\n\ + 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} + @mkdir -p $(PREFIX) + @$(CP) -p $(EXTRA_DIST) $(PREFIX) + $(ZIP) -r -9 $(DIST_NAME) $(PREFIX) $(PROG).com + @$(RM) -r $(PREFIX) .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 = @@ -38,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)