]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/commitdiff
Generate version string and print it on boot.
authorLeo C <erbl259-lmu@yahoo.de>
Sun, 11 Oct 2015 08:51:46 +0000 (10:51 +0200)
committerLeo C <erbl259-lmu@yahoo.de>
Sun, 11 Oct 2015 08:51:46 +0000 (10:51 +0200)
.gitignore
cbios/.gitignore
cbios/Makefile
cbios/boot.180

index 5b6b28c5bd182225c0bfc6d7cdc8ab57e10e96e3..198acb12cb842ac82805002f590747129fefeb6f 100644 (file)
@@ -1,5 +1 @@
-/cpm3bin
-/cpm3src
-/forensic
-/for2
-
+/no_vcs
index babe1d87fb82d17d409ef354c944225544537c1b..659ccd6160f17229b29e164ff9c7d9433c51accd 100644 (file)
@@ -6,4 +6,7 @@
 *.rel
 *.hex
 *.spr
-cpm3.sys
+cpm3_*.sys
+*.zip
+autorevision.cache
+version.inc
index 7324f37ec4198623c9561fce196d152ff10d606a..f8018d0825839c2a600178bc954d38d37062b9d2 100644 (file)
@@ -7,8 +7,30 @@ SRC += scb.180
 
 INC := config.inc z180reg.inc z180.lib
 
+
 OBJ := $(SRC:.180=.rel)
 
+
+$(foreach X,$(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).$(subst ",,$(VCS_TICK))
+endif
+ifneq ($(VCS_BRANCH),"master")
+  VERS := $(VERS)-$(subst ",,$(VCS_BRANCH))
+endif
+ifeq ($(VCS_WC_MODIFIED),"1")
+  VERS := $(VERS)-dirty
+endif
+
+
+SYSFILE = cpm3_$(VERS).sys
+MAPFILE = bnkbios3_$(VERS).map
+ZIPFILE = cpm3_$(VERS).zip
+
 #CP/M emulator
 CPMEMU = zxcc
 
@@ -37,11 +59,23 @@ LN_DATA = F000
 .phony: all
 all: sys
 
-map: bnkbios3.map
-sys: cpm3.sys
+.phony: sys bios map
+sys: $(SYSFILE)
 bios: bnkbios3.spr
+map: $(MAPFILE)
+
+.phony: bin-dist
+bin-dist: $(ZIPFILE)
 
 $(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 +136,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 gencpm.dat
+$(SYSFILE): bnkbios3.spr gencpm.dat
        zxcc gencpm -AUTO
+       @mv cpm3.sys $@
        @echo
 
 
@@ -122,12 +157,17 @@ bnkbios3.spr : $(OBJ)
        @$(cpm-asm)
 
 
+$(ZIPFILE): $(SYSFILE) $(MAPFILE)
+       @rm -f $@
+       zip -9 $@ $(SYSFILE) $(MAPFILE)
+
+
 .phony: clean realclean
 clean:
-       rm -f $(OBJ) $(OBJ:.rel=.lst) $(OBJ:.rel=.sym)
+       rm -f *.rel *.lst *.sym version.inc
 
 realclean: clean
-       rm -f *.prn *~
+       rm -f *.map *.prn *~
 
 
 #==================================================================
index 7e8c0637935c4c94b83fb052dd818e6771341742..5b55c2933d8e183fae235ec09e9d3c9a5a9e2a01 100644 (file)
@@ -13,6 +13,7 @@
        extrn   @civec,@covec,@aivec,@aovec,@lovec\r
        extrn   @cbnk,?move,?xmove\r
 \r
+       include version.inc\r
        include config.inc\r
        include z180reg.inc\r
 \r
@@ -77,9 +78,9 @@ hwini_skip:
        ld      (@cbnk),a               ; right now in bank 0\r
 \r
        call    pr.inln                 ; print signon message\r
-       db      13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0\r
-\r
-       call    pr.inln\r
+       db      13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS v'\r
+       defvers\r
+       db      13,10\r
        db      'Estimated CPU clock [Hz]: ',0\r
 \r
        ld      hl,(f_cpu)\r