X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/04d6fc24a26ac00992b73417c3367414c34df70d..3ba537752998f2d8554cecee5d586fd1a70256b6:/cbios/Makefile diff --git a/cbios/Makefile b/cbios/Makefile index e24e41f..f6bad22 100644 --- a/cbios/Makefile +++ b/cbios/Makefile @@ -2,13 +2,42 @@ SRC := bioskrnl.180 boot.180 chario.180 drvtbl.180 SRC += move.180 time.180 mm.180 misc.180 utils.180 -SRC += msgbuf.180 conbuf.180 ascip.180 sdio.180 +SRC += msgbuf.180 conbuf.180 ascip.180 sdio.180 cfio.180 SRC += scb.180 INC := config.inc z180reg.inc z180.lib + OBJ := $(SRC:.180=.rel) + +$(foreach X,$(subst =,:=,$(subst ",,$(filter VCS_%,\ + $(shell autorevision -t sh -o $(CURDIR)/autorevision.cache)))),$(eval $X)) + +VERS := $(shell echo "$(VCS_TAG)" | sed -e 's/hexrel-/0./g' -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 + + +SYSFILE = cpm3_$(VERS).sys +MAPFILE = bnkbios3_$(VERS).map +DIST_NAME = z180-stamp-cpm3_$(VERS).zip +DIST_NAME_BIN = z180-stamp-cpm3-bin_$(VERS).zip +PREFIX = z180-stamp-cpm3_$(VERS) + +CP = cp +RM = rm -f +GIT = git +ZIP = zip + #CP/M emulator CPMEMU = zxcc @@ -37,11 +66,21 @@ LN_DATA = F000 .phony: all all: sys -map: bnkbios3.map -sys: cpm3.sys +.phony: sys bios map +sys: $(SYSFILE) bios: bnkbios3.spr +map: $(MAPFILE) + $(OBJ): $(INC) +boot.rel: version.inc + +version.inc: autorevision.cache + @echo update $@ + @echo "defvers macro\r\n\ + db '$(VERS)'\r\n\ + endm\r" > $@ + comma:= , empty:= @@ -102,15 +141,16 @@ PSEG = $(call SEGMENT-ADDR, 1) DSEG = $(call SEGMENT-ADDR, 2) #(call SEGMENT-ADDR,SEGNUM) -SEGMENT-ADDR = $(shell dd if=cpm3.sys bs=128 count=1 skip=1 2>/dev/null |\ +SEGMENT-ADDR = $(shell dd if=$(SYSFILE) bs=128 count=1 skip=1 2>/dev/null |\ awk -vn=$(strip $1) '/BNKBIOS3/ {if (++seg == n) print $$3}') -bnkbios3.map: cpm3.sys - ld80 -o /dev/null -ms bnkbios3.map -P $(PSEG) -D $(DSEG) $(OBJ) +$(MAPFILE): $(SYSFILE) + ld80 -o /dev/null -ms $@ -P $(PSEG) -D $(DSEG) $(OBJ) -cpm3.sys: bnkbios3.spr +$(SYSFILE): bnkbios3.spr gencpm.dat zxcc gencpm -AUTO + @mv cpm3.sys $@ @echo @@ -122,12 +162,25 @@ bnkbios3.spr : $(OBJ) @$(cpm-asm) +.phony: bin-dist +bin-dist: $(SYSFILE) $(MAPFILE) + $(ZIP) -9 $(DIST_NAME_BIN) $(SYSFILE) $(MAPFILE) + +.phony: dist +dist: $(SYSFILE) $(MAPFILE) + $(GIT) archive --format=zip --prefix=$(PREFIX)/ -9 -o $(DIST_NAME) HEAD^{tree} + @mkdir -p $(PREFIX) + @$(CP) autorevision.cache version.inc $(PREFIX) + $(ZIP) -r -9 $(DIST_NAME) $(PREFIX) $(SYSFILE) $(MAPFILE) + @$(RM) -r $(PREFIX) + + .phony: clean realclean clean: - rm -f $(OBJ) $(OBJ:.rel=.lst) $(OBJ:.rel=.sym) + $(RM) *.rel *.lst *.sym version.inc realclean: clean - rm -f *.prn *~ + $(RM) *.map *.prn *~ #==================================================================