From 269dc2f6c836027e0be757cfcea7922292620390 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Thu, 24 Jan 2013 12:27:49 +0900 Subject: [PATCH] =?utf8?q?Makefile=E3=81=AE=E4=BF=AE=E6=AD=A3=E3=80=82clea?= =?utf8?q?n=E3=82=BF=E3=83=BC=E3=82=B2=E3=83=83=E3=83=88=E3=81=AF=E3=81=99?= =?utf8?q?=E3=81=B9=E3=81=A6=E6=9C=AB=E5=B0=BE=E3=81=ABclean=E3=81=8C?= =?utf8?q?=E3=81=A4=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Makefile | 28 ++++++++++++++++++---------- doc/Makefile | 6 +++--- doc_inner/Makefile | 4 ++-- src/Makefile | 10 +++++----- test/Makefile | 8 +++++--- test/system/Makefile | 6 +++--- 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index b074511..c1b6483 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,12 @@ -.PHONY: all build gtags check doc info html doc-inner install uninstall install-info uninstall-info install-casl2lib uninstall-casl2lib version gittag clean clean-src clean-gtags clean-test clean-doc clean-doc-inner +.PHONY: all build gtags \ + check \ + doc info html doc-inner \ + install uninstall \ + install-info uninstall-info \ + install-casl2lib uninstall-casl2lib \ + version gittag \ + clean src-clean gtags-clean \ + test-clean doc-clean doc-inner-clean CMD := casl2 comet2 dumpword @@ -33,7 +41,7 @@ doc: INSTALL: doc/install.txt $(CP) $< $@ -docall: +alldoc: $(MAKE) -C doc all info: @@ -76,25 +84,25 @@ $(VERSIONFILES): VERSION gittag: VERSION $(GITTAG) $(VERSION) -clean: clean-cmd clean-src clean-gtags clean-doc clean-doc-inner clean-version +clean: cmd-clean src-clean gtags-clean doc-clean doc-inner-clean version-clean -clean-cmd: +cmd-clean: @$(RM) $(CMD) -clean-src: +src-clean: @$(MAKE) -sC src clean -clean-gtags: +gtags-clean: @$(RM) GPATH GRTAGS GSYMS GTAGS -clean-doc: +doc-clean: @$(MAKE) -sC doc clean -clean-doc-inner: +doc-inner-clean: @$(MAKE) -sC doc_inner clean -clean-version: +version-clean: @$(RM) $(VERSIONFILES) -clean-test: +test-clean: @$(MAKE) -sC test clean diff --git a/doc/Makefile b/doc/Makefile index 10c8bff..c28362e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,7 +16,7 @@ TEX2DVI_FLAGS = -q --texinfo=@afourpaper prefix ?= ~ infodir ?= $(prefix)/share/info -.PHONY: base all info html htmls pdf install-info uninstall-info clean clean-textmp +.PHONY: base all info html htmls pdf install-info uninstall-info clean textmp-clean .INTERMEDIATE: *.dvi @@ -61,8 +61,8 @@ uninstall-info: $(INSTALL-INFO) --delete $(infodir)/yacasl2.info $(infodir)/dir $(RM) $(infodir)/yacasl2.info -clean: clean-textmp +clean: textmp-clean @$(RMR) *_html *.info *.html *.pdf *.dvi *.txt -clean-textmp: +textmp-clean: @$(RM) *.aux *.cp *.cps *.fn *.ky *.log *.pg *.pgs *.tmp *.toc *.tp *.vr diff --git a/doc_inner/Makefile b/doc_inner/Makefile index 78cda3f..871aea5 100644 --- a/doc_inner/Makefile +++ b/doc_inner/Makefile @@ -18,13 +18,13 @@ all: $(DOXYGEN_DIR) $(GNU_GLOBAL_DIR) # ../Doxyfileで設定された以下のディレクトリーの下のhtmlディレクトリー # OUTPUT_DIRECTORY = doc_inner $(DOXYGEN_DIR): ../Doxyfile - @($(WHICH) $(DOXYGEN) && ($(CD) .. && $(DOXYGEN) && $(CD) - && $(MV) html $@) >/dev/null || $(ECHO) "$(DOXYGEN): not found") + $(if $(strip $(shell $(WHICH) $(DOXYGEN))),$(CD) .. && $(DOXYGEN) && $(MV) $(CURDIR)/html $(CURDIR)/$@,$(ECHO) '$(DOXYGEN): not found') # htagsのHTMLドキュメント作成先は、 # 引数DIRで指定されたディレクトリーの下のHTMLディレクトリー $(GNU_GLOBAL_DIR): $(MAKE) -C .. gtags - $(WHICH) $(HTAGS) && ($(CD) .. && $(HTAGS) -anosx doc_inner && $(CD) - && $(MV) HTML $@) >/dev/null || $(ECHO) "$(HTAGS): not found" + $(if $(strip $(shell $(WHICH) $(HTAGS))),$(CD) .. && $(HTAGS) -anosx $(CURDIR) && $(MV) $(CURDIR)/HTML $(CURDIR)/$@,@$(ECHO) '$(HTAGS): not found') clean: doxygen-clean gnu_global-clean diff --git a/src/Makefile b/src/Makefile index 7b7f1f5..2e49186 100644 --- a/src/Makefile +++ b/src/Makefile @@ -26,7 +26,7 @@ all: build tag # .dファイルからヘッダファイルの依存関係を取得する # ターゲットに clean が含まれている場合は除く -ifneq ($(findstring $(MAKECMDGOALS),clean),clean) +ifeq (,$(filter %clean,$(MAKECMDGOALS))) -include $(addsuffix .d,$(CMDOBJ) $(COMMONOBJ) $(CASL2OBJ) $(ASOBJ) $(EXECOBJ)) endif @@ -50,13 +50,13 @@ TAGS: $(INCLUDEDIR)/*.h *.c $(if $(strip $(shell $(WHICH) $(ETAGS))),$(ETAGS) $^,@$(ECHO) '$(ETAGS): not found') # makeで生成したファイルの削除 -clean: clean-cmd clean-work clean-tag +clean: cmd-clean work-clean tag-clean -clean-cmd: +cmd-clean: @$(RM) casl2 comet2 dumpword -clean-work: +work-clean: @$(RM) *.o *.d -clean-tag: +tag-clean: @$(RM) TAGS tags diff --git a/test/Makefile b/test/Makefile index 76b6c0e..c7abd48 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,9 +1,11 @@ -clean: clean_systemtest clean_unittest +.PHONY: clean systemtest-clean unittest-clean -clean_systemtest: +clean: systemtest-clean unittest-clean + +systemtest-clean: @$(MAKE) -sC system/casl2 clean @$(MAKE) -sC system/comet2 clean @$(MAKE) -sC system/dumpword clean -clean_unittest: +unittest-clean: @$(MAKE) -sC unit clean diff --git a/test/system/Makefile b/test/system/Makefile index beda22c..03a630e 100644 --- a/test/system/Makefile +++ b/test/system/Makefile @@ -1,5 +1,5 @@ # 複数の子ディレクトリーでmakeを実行 -CMDS = casl2 comet2 dumpword +CMD = casl2 comet2 dumpword define make_dirs $(foreach d,$1,$(MAKE) -sC $d $2) endef @@ -7,7 +7,7 @@ endef .PHONY: check clean check: - @$(call make_dirs,$(CMDS),$@; ) + @$(call make_dirs,$(CMD),$@; ) clean: - @$(call make_dirs,$(CMDS),$@; ) + @$(call make_dirs,$(CMD),$@; ) -- 2.18.0