X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Makefile;h=2cc1f044523ebb76d94136591e85e62f60ec6f3f;hb=20c59ff39f0c752e0885fa0406ab9b93c5f147b9;hp=ad22d42f5e74133dbfd0f3535ea4a815df9b55ad;hpb=19875f416e24340460868fbc4e09ed2c8faaa127;p=YACASL2.git diff --git a/Makefile b/Makefile index ad22d42..2cc1f04 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,40 @@ .PHONY: all build gtags \ check \ - doc alldoc doc-inner \ + doc alldoc doc_inner \ install uninstall \ version gittag \ clean src-clean gtags-clean \ - test-clean doc-clean doc-inner-clean + test-clean doc-clean doc_inner-clean CMD := casl2 comet2 dumpword CAT := cat CP := cp -ECHO := echo -GITTAG := git tag +ECHO := /bin/echo +GIT := git +GREP := grep GTAGS := gtags INSTALL := install SED := sed WHICH := which +EXPR := expr +XARGS := xargs prefix ?= ~ bindir ?= $(prefix)/bin -VERSION = $(shell $(CAT) VERSION) -VERSIONFILES = include/package.h test/system/casl2/opt_v/0.txt test/system/comet2/opt_v/0.txt test/system/dumpword/opt_v/0.txt +VERSION := $(shell $(CAT) VERSION) +VER := $(shell $(ECHO) $(VERSION) | $(SED) -e 's/^v\([0-9.]*\)p\([0-9]*\)/\1/') +PATCH := $(shell $(ECHO) $(VERSION) | $(SED) -e 's/^v[0-9.]*p\([0-9]*\)/\1/') + +VERSIONFILES = include/package.h \ + test/system/casl2/opt_v/0.txt \ + test/system/comet2/opt_v/0.txt \ + test/system/dumpword/opt_v/0.txt all: build doc gtags -build: version +build: $(MAKE) -C src all $(CP) $(addprefix src/,$(CMD)) ./ @@ -42,7 +51,7 @@ INSTALL: doc/install.txt alldoc: $(MAKE) -C doc all -doc-inner: +doc_inner: $(MAKE) -C doc_inner all check: @@ -61,12 +70,14 @@ version: $(VERSIONFILES) $(VERSIONFILES): VERSION @$(SED) -e "s/@@VERSION@@/$(VERSION)/g" $@.version >$@ -gittag: VERSION - $(GITTAG) $(VERSION) +gittag: + patch=$(PATCH); while ($(GIT) tag | $(GREP) v$(VER)p$${patch}); do patch=`$(EXPR) $${patch} + 1`; done; $(ECHO) v$(VER)p$${patch} >VERSION + if ($(GIT) status -s | $(GREP) VERSION); then $(GIT) add VERSION; $(GIT) commit --amend --no-edit; fi + $(CAT) VERSION | $(XARGS) $(GIT) tag -distclean: cmd-clean gtags-clean version-clean clean +distclean: cmd-clean src-distclean gtags-clean version-clean clean -clean: src-clean doc-clean doc-inner-clean +clean: src-clean doc-clean doc_inner-clean cmd-clean: $(RM) $(CMD) @@ -74,13 +85,16 @@ cmd-clean: src-clean: $(MAKE) -sC src clean +src-distclean: + $(MAKE) -sC src distclean + gtags-clean: $(RM) GPATH GRTAGS GSYMS GTAGS doc-clean: $(MAKE) -sC doc clean -doc-inner-clean: +doc_inner-clean: $(MAKE) -sC doc_inner clean version-clean: