X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=Makefile;h=7222401dabeee071d57cdac7b7c05b3b8e39ea03;hp=01f60a941f34a7f88167b99d4d5d0de2699128df;hb=7fbde1700bbe9d8f779033ad3b842d3dceb3e1c6;hpb=198e25154f34db7d31ff87bcaf402a827cc5ddec diff --git a/Makefile b/Makefile index 01f60a9..7222401 100644 --- a/Makefile +++ b/Makefile @@ -1,64 +1,108 @@ -.PHONY: build check doc doxygen clean gtags htags clean_htags -MKDIR = mkdir -p -MV = mv -DOXYGEN = doxygen -GTAGS = gtags -HTAGS = htags -HTAGSFLAG = -anosx - -all: build gtags +.PHONY: all build gtags \ + check \ + doc alldoc doc_inner \ + install uninstall \ + version gittag \ + clean src-clean gtags-clean \ + test-clean doc-clean doc_inner-clean + +CMD := casl2 comet2 dumpword casl2rev + +CAT := cat +CP := cp +ECHO := /bin/echo +EXPR := expr +GIT := git +GREP := grep +GTAGS := gtags +INSTALL := install +SED := sed +WC := wc +WHICH := which +XARGS := xargs + +prefix ?= ~ +bindir ?= $(prefix)/bin +libdir ?= $(prefix)/share + +VERSION := $(shell $(CAT) VERSION) + +VERSIONGITREF := $(shell $(GIT) show-ref -s --tags $(VERSION)) + +MASTERGITREF := $(shell $(GIT) show-ref -s refs/heads/master) + +VERSIONFILES = include/package.h \ + test/system/casl2_opt/opt_v/0.txt \ + test/system/comet2_opt/opt_v/0.txt \ + test/system/dumpword/opt_v/0.txt + +all: build INSTALL gtags build: - $(MAKE) -C src + $(MAKE) -C src all + $(CP) $(addprefix src/,$(CMD)) ./ + +gtags: + $(if $(strip $(shell $(WHICH) $(GTAGS))),$(GTAGS),@$(ECHO) '$(GTAGS): not found') + +INSTALL: doc/install.txt + $(CP) $< $@ + +doc/install.txt: + $(MAKE) -C doc base + +alldoc: + $(MAKE) -C doc all + +doc_inner: + $(MAKE) -C doc_inner all check: - @$(MAKE) -sC test/system + $(MAKE) -sC test/system -doc: - @$(MAKE) -sC doc +install: casl2 comet2 dumpword install-info + $(INSTALL) -d $(bindir) + $(INSTALL) $(CMD) $(bindir)/ -doxygen: doc_inner - @$(DOXYGEN) +install-info: + $(MAKE) -C doc install-info -gtags: clean_gtags - @$(GTAGS) +uninstall: uninstall-info + $(RM) $(prefix $(bindir)/,$(CMD)) -htags: doc_inner - @$(MAKE) clean_htags - @$(MAKE) gtags - @$(HTAGS) $(HTAGSFLAG) $< - @$(MV) $$@ + +gittag: + if test `$(GIT) status -s | $(WC) -l` -gt 0; then $(ECHO) "Error: commit, first."; exit 1; fi; if test "$(VERSIONGITREF)" != "$(MASTERGITREF)"; then $(GIT) tag $(VERSION); fi -clean: clean_cmd clean_src clean_gtags clean_systemtest clean_unittest clean_doc clean_doc_inner +distclean: cmd-clean src-distclean gtags-clean version-clean clean -clean_cmd: - @rm -f casl2 comet2 dumpword +clean: src-clean doc-clean doc_inner-clean -clean_src: - @$(MAKE) -sC src clean +cmd-clean: + $(RM) $(CMD) -clean_gtags: - @rm -f GPATH GRTAGS GSYMS GTAGS +src-clean: + $(MAKE) -sC src clean -clean_systemtest: - @$(MAKE) -sC test/system/casl2 clean - @$(MAKE) -sC test/system/comet2 clean - @$(MAKE) -sC test/system/dumpword clean +src-distclean: + $(MAKE) -sC src distclean -clean_unittest: - @$(MAKE) -sC test/unit clean +gtags-clean: + $(RM) GPATH GRTAGS GSYMS GTAGS -clean_doc: - @$(MAKE) -sC doc clean +doc-clean: + $(MAKE) -sC doc clean -clean_doc_inner: - @rm -rf doc_inner +doc_inner-clean: + $(MAKE) -sC doc_inner clean -clean_htags: - @rm -rf doc_inner/htags +version-clean: + $(RM) $(VERSIONFILES) -clean_doxygen: - @rm -rf doc_inner/doxygen +test-clean: + $(MAKE) -sC test clean