Makefileの整理
[YACASL2.git] / Makefile
index c5e491e..4969245 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,39 @@
-ifndef prefix
-    prefix = $(HOME)
-endif
-CLEANDIR = src test/integration test/unit as/casl2lib
-.PHPNY: all build clean check doc casl2lib install uninstall
-all: build casl2lib
+.PHONY: all build gtags check doc doc_inner clean clean_src clean_gtags clean_test clean_doc clean_doc_inner
+
+GTAGS ?= gtags
+RMF ?= rm -f
+WHICH ?= which
+
+all: build doc doc_inner
+
 build:
-       make -C src
-casl2lib:
-       @make -C as/casl2lib
+       $(MAKE) -C src
+
+gtags:
+       ($(WHICH) $(GTAGS) && $(GTAGS)) >/dev/null
+
 check:
-       @make -sC test/integration
+       $(MAKE) -C test/system
+
 doc:
-       @make -sC doc
-clean:
-       @for target in $(CLEANDIR); do $(MAKE) -sC $$target clean; done; \
-     rm -f casl2 comet2 dumpword
-install: all
-       @if test -d $(prefix); then \
-       install -s ./casl2 $(prefix)/casl2; \
-       install -s ./comet2 $(prefix)/comet2; \
-       install -s ./dumpword $(prefix)/dumpword; \
-     fi
-uninstall:
-       @if test -d $(prefix); then \
-       rm -f $(prefix)/casl2 $(prefix)/comet2 $(prefix)/dumpword; \
-     fi
+       $(MAKE) -C $@
+
+doc_inner:
+       $(MAKE) -C $@
+
+clean: clean_src clean_gtags clean_test clean_doc clean_doc_inner
+
+clean_src:
+       @$(MAKE) -sC src clean
+
+clean_gtags:
+       @$(RMF) GPATH GRTAGS GSYMS GTAGS
+
+clean_test:
+       @$(MAKE) -sC test clean
+
+clean_doc:
+       @$(MAKE) -sC doc clean
+
+clean_doc_inner:
+       @$(MAKE) -sC doc_inner clean