From 8bc5ea2267aec88cc21937d962c3e077414e2c65 Mon Sep 17 00:00:00 2001 From: Leo C Date: Sun, 14 Aug 2016 21:21:56 +0200 Subject: Add version string Minor optimizations (p_fill_space) --- Makefile | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7694f5b..bdfc336 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,21 @@ PROG := ddt180 SRC := $(PROG).z80 +EXTRA_DIST := autorevision.cache version.inc + OBJ := $(SRC:.z80=.rel) -AS_OPT := MFS +DIST_NAME = $(PROG)_$(VERS).zip +PREFIX = $(PROG)_$(VERS) -ASM := zxcc slrz80.com -LINK := zxcc link80.com +ASM := zxcc slrz80.com +LINK := zxcc link80.com +CP := cp +RM := rm -f +GIT := git +ZIP := zip + +AS_OPT := MFS .phony: all all: $(PROG).com @@ -23,7 +32,38 @@ $(PROG).com: $(PROG).prl $(PROG).prl: $(OBJ) $(LINK) -'$(PROG)[op,$$SZ]' +$(PROG).rel: 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 $@ + @printf "defvers macro\r\n\ + db '$(VERS)'\r\n\ + endm\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: -- cgit v1.2.3