From fea33590da5b30101f07051470b2a9a17bc40286 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Tue, 7 Jul 2026 16:52:19 +0900 Subject: [PATCH] =?utf8?q?make=20gittag=E3=81=A8make=20gitpush=E3=81=AE?= =?utf8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Makefile | 22 +++------------------- git.mk | 15 +++++++-------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 4d23a63..d6edaf7 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,4 @@ -.PHONY: all srcall gtags \ - check valgrind \ - doc alldoc doc_inner \ - install uninstall \ - version gittag copyright \ - gitpush gitpushorigin gitpushgithub \ - version_up___stamp gittag___stamp \ - clean src-clean gtags-clean \ - test-clean doc-clean doc_inner-clean +.PHONY: all gtags check valgrind doc doc_inner copyright install uninstall patchup___stamp gittag gitpush clean src-clean gtags-clean test-clean doc-clean doc_inner-clean CAT := cat CP := cp -v @@ -33,10 +25,7 @@ VERSIONGITREF = $(shell $(GIT) show-ref -s --tags $(VERSION)) MAINGITREF = $(shell $(GIT) show-ref -s refs/heads/main) -VERSIONFILES := include/version.h \ - test/system/casl2_opt/opt_v/0.txt \ - test/system/comet2_opt/opt_v/0.txt \ - test/system/dumpword/opt_v/0.txt +VERSIONFILES := include/version.h test/system/casl2_opt/opt_v/0.txt test/system/comet2_opt/opt_v/0.txt test/system/dumpword/opt_v/0.txt CMDFILES := casl2 comet2 dumpword casl2rev comet2monitor @@ -54,7 +43,7 @@ INSTALL: doc/install.txt doc/install.txt: $(MAKE) -C doc base -alldoc: +doc: $(MAKE) -C doc all doc_inner: @@ -82,11 +71,6 @@ install-info: uninstall: uninstall-info $(RM) $(prefix $(bindir)/,$(CMDFILES)) -version: version___stamp - -version___stamp: $(VERSIONFILES) - @$(PRINTF) "YACASL2 Version: %s\n" $(VERSION) >$@ - $(VERSIONFILES): VERSION @$(SED) -e "s/@@VERSION@@/$(VERSION)/g" $@.version >$@ diff --git a/git.mk b/git.mk index 808528c..8305c3d 100644 --- a/git.mk +++ b/git.mk @@ -15,16 +15,15 @@ gitpush___stamp: gittag___stamp $(GIT) push github main --tags $(GIT) rev-parse HEAD > $@ -gittag___stamp: - $(GIT) tag --points-at main | $(GREP) -qx "$(VERSION)" || $(GIT) tag $(VERSION) main +gittag___stamp: patchup___stamp + $(GIT) tag --points-at HEAD | $(GREP) -qx "$(VERSION)" || $(GIT) tag $(VERSION) main $(PRINTF) "%s\n" "$(VERSION)" > $@ -version_up___stamp: VERSION - if [ -n "$$($(GIT) status -s)" ]; then $(PRINTF) "Error: commit, first.\n"; exit 1; fi - while $(GIT) rev-parse -q --verify $$($(CAT) VERSION) >/dev/null 2>&1; do $(PRINTF) "v%.1fp%02d\n" $(VERSIONNO) $$($(EXPR) $(PATCHNO) + 1) >$<; done - $(GIT) add VERSION - $(GIT) commit -m "version up" - $(CAT) $< >$@ +patchup___stamp: + git diff-index --quiet HEAD -- || ($(PRINTF) "Error: commit, first.\n"; exit 1) + $(GIT) tag --points-at HEAD | $(GREP) -qx "$(VERSION)" && exit 0 || while $(GIT) rev-parse -q --verify $(VERSION) >/dev/null 2>&1; do $(PRINTF) "v%.1fp%02d\n" $(VERSIONNO) $$($(EXPR) $(PATCHNO) + 1) >VERSION; done; + git diff-index --quiet HEAD -- || $(GIT) commit -a -m "version up to $(VERSION)" + $(PRINTF) "%s\n" "$(VERSION)" >$@ gitclean: $(RM) *___stamp -- 2.47.3