-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 := bioskrnl.180 boot.180 stampf.180 chario.180 drvtbl.180
+SRC += move.180 time.180 mm.180 misc.180 utils.180 fifo.180
+SRC += msgbuf.180 conbuf.180 ascii.180 asci-cmn.180
+SRC += sdio.180 cfio.180
SRC += scb.180
+ALLSRC := $(SRC) ldrbios.180
+
+INC := config.inc z180reg.inc z180.lib ioctl.inc
-INC := config.inc z180reg.inc z180.lib
OBJ := $(SRC:.180=.rel)
+ALLOBJ := $(ALLSRC:.180=.rel)
+ALLLST := $(ALLSRC:.180=.lst)
+
+
+$(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)
+
+SHELL = /bin/sh
+CP = cp
+RM = rm -f
+GIT = git
+ZIP = zip
#CP/M emulator
CPMEMU = zxcc
#LNKCMD =
LN_VERB = /V
LN_PROG = 0
-LN_DATA = C000
+LN_DATA = F000
.suffixes:
.phony: all
all: sys
-map: bnkbios3.map
-sys: cpm3.sys
+.phony: sys bios map ldr
+sys: $(SYSFILE)
bios: bnkbios3.spr
+map: $(MAPFILE)
+ldr: cpmldr.com
+
+cpmldr.com: cpmldr.rel ldrbios.rel
+ ld80 -P 100 -o $@ $^
+
+$(ALLOBJ): $(INC)
+boot.rel: version.inc
+
+version.inc: autorevision.cache
+ @echo update $@
+ @printf "defvers macro\r\n\
+ db '$(VERS)'\r\n\
+ endm\r\n\032" > $@
-$(OBJ): $(INC)
comma:= ,
empty:=
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
@$(cpm-asm)
+.phony: bin-dist
+bin-dist: $(SYSFILE) $(MAPFILE) cpmldr.com
+ $(ZIP) -9 $(DIST_NAME_BIN) $(SYSFILE) $(MAPFILE) cpmldr.com
+
+.phony: dist
+dist: $(SYSFILE) $(MAPFILE) cpmldr.com
+ $(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) cpmldr.com
+ @$(RM) -r $(PREFIX)
+
+
.phony: clean realclean
clean:
- rm -f $(OBJ) $(OBJ:.rel=.lst) $(OBJ:.rel=.sym)
+ $(RM) $(ALLOBJ) $(ALLLST) *.sym
realclean: clean
- rm -f *.prn *~
+ $(RM) *.map *.prn *~
#==================================================================