メモリ内容を表示する時と、SVC 1で文字を出力する時、JIS X 201片仮名を出力するよう仕様変更
[YACASL2.git] / Makefile
index bb304d1..6e145d7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,39 +1,81 @@
-.PHONY: all build gtags check doc doc_inner clean clean_cmd clean_gtags clean_src 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 clean clean-src clean-gtags clean-test clean-doc clean-doc-inner
+
 GTAGS ?= gtags
 RMF ?= rm -f
-all: build gtags doc
+WHICH ?= which
+ECHO ?= echo
+INSTALL ?= install
+SED ?= sed
+
+prefix ?= ~
+bindir ?= $(prefix)/bin
+casl2libdir ?= $(prefix)/yacasl2/casl2lib
+
+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
 
-build:
-       $(MAKE) -C src
+all: build info html gtags
+
+build: version
+       $(MAKE) -C src all
 
 gtags:
-       @(which $(GTAGS) && $(GTAGS)) >/dev/null
+       @$(WHICH) $(GTAGS) >/dev/null && $(GTAGS) || $(ECHO) "$(GTAGS): not found"
+
+docall: doc
+       $(MAKE) -C doc all
+
+info:
+       $(MAKE) -C doc info
+
+html:
+       $(MAKE) -C doc html
+
+doc-inner:
+       $(MAKE) -C doc_inner all
 
 check:
-       @$(MAKE) -sC test/system
+       $(MAKE) -sC test/system
 
-doc:
-       @$(MAKE) -sC $@
+install: casl2 comet2 dumpword install-info install-casl2lib
+       $(INSTALL) -d $(bindir)
+       $(INSTALL) casl2 comet2 dumpword $(bindir)/
 
-doc_inner:
-       @$(MAKE) -sC $@
+uninstall: uninstall-info uninstall-casl2lib
+       $(RMF) $(bindir)/casl2 $(bindir)/comet2 $(bindir)/dumpword
 
-clean: clean_cmd clean_gtags clean_src clean_test clean_doc clean_doc_inner
+install-info:
+       $(MAKE) -C doc install-info
 
-clean_cmd:
-       @$(RMF) casl2 comet2 dumpword
+uninstall-info:
+       @$(MAKE) -C doc uninstall-info
 
-clean_gtags:
-       @$(RMF) GPATH GRTAGS GSYMS GTAGS
+install-casl2lib:
+       $(MAKE) -C as/casl2lib install-casl2lib
 
-clean_src:
+uninstall-casl2lib:
+       @$(MAKE) -C as/casl2lib uninstall-casl2lib
+
+version: $(VERSIONFILES)
+
+$(VERSIONFILES):
+       for f in $(VERSIONFILES); do $(SED) -e "s/@@VERSION@@/`cat VERSION`/g" $$f.version >$$f; done
+
+clean: clean-src clean-gtags clean-doc clean-doc-inner clean-version
+
+clean-src:
        @$(MAKE) -sC src clean
 
-clean_test:
-       @$(MAKE) -sC test clean
+clean-gtags:
+       @$(RMF) GPATH GRTAGS GSYMS GTAGS
 
-clean_doc:
+clean-doc:
        @$(MAKE) -sC doc clean
 
-clean_doc_inner:
+clean-doc-inner:
        @$(MAKE) -sC doc_inner clean
+
+clean-test:
+       @$(MAKE) -sC test clean
+
+clean-version:
+       @$(RMF) $(VERSIONFILES)