]> j8takagi.net git repositories - yacasl2.git/commitdiff
make gittagとmake gitpushの修正
authorj8takagi <j8takagi@nifty.com>
Tue, 7 Jul 2026 07:52:19 +0000 (16:52 +0900)
committerj8takagi <j8takagi@nifty.com>
Tue, 7 Jul 2026 08:08:47 +0000 (17:08 +0900)
Makefile
git.mk

index 4d23a63797a11c7fd8a5b12c132b9aee7c31f85c..d6edaf76307804b110f1fe8b9b7e1cfdcbf4bc83 100644 (file)
--- 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 808528c58d14f43d7225ca4728b661ff80f649da..8305c3d84232dd6063dbdcf8aa037fea8745e87e 100644 (file)
--- 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