OSDN Git Service

add VERSION
[happyabc/happyabc.git] / scripts / Makefile
1 # ------------------------------
2 # macro
3 # ------------------------------
4 ROOT ?= $(PWD)
5 SRC  :=$(ROOT)/src
6 DEST :=$(ROOT)/dest
7 SUMMARY := $(ROOT)/summary.log
8 BUILD := $(ROOT)/build.log
9 UNIT := $(ROOT)/unittest.log
10 INTEGRATE := $(ROOT)/integrate.log
11 SWF := $(ROOT)/test
12 INSTALL := $(ROOT)/install.log
13
14 define check_prog
15         @/bin/echo -n "checking $1 ... "
16         @if which $1 > /dev/null; then \
17           /bin/echo "ok"; \
18          else \
19           /bin/echo "not found"; \
20           exit 1; \
21          fi
22 endef
23
24 define check_file
25         (/bin/echo -n "$1 ... "; \
26         if test -e $1; then \
27           /bin/echo "ok"; \
28         else \
29           /bin/echo "not found"; \
30         fi)
31 endef
32
33 # ------------------------------
34 .PHONY: check build build__ unit unit__ integrate integrate__ install install__ swf swf__ web all code clean
35
36 all : code build unit integrate install swf web twitter
37
38 check:
39         $(call check_prog,git)
40         $(call check_prog,ocaml)
41         $(call check_prog,ocamlfind)
42         $(call check_prog,omake)
43         $(call check_prog,avmplus)
44         $(call check_prog,swfmill)
45
46 code:
47         rm -rf $(SRC)
48         git clone --depth 1 git://github.com/mzp/scheme-abc.git $(SRC)
49
50 build: check
51         $(MAKE) -f $(ROOT)/Makefile --directory=$(SRC) build__ ROOT=$(ROOT)
52
53 build__:
54         git clean -f -x
55         omake config PREFIX=$(DEST)
56         omake all | tee $(BUILD)
57
58 unit__:
59         omake check-detail
60         mv unittest.log $(UNIT)
61
62 unit:
63         $(MAKE) -f $(ROOT)/Makefile --directory=$(SRC) unit__ ROOT=$(ROOT)
64
65
66 integrate:
67         $(MAKE) -f $(ROOT)/Makefile --directory=$(SRC) integrate__ ROOT=$(ROOT)
68 integrate__:
69         omake integrate-detail
70         mv integrate.log $(INTEGRATE)
71
72 install:
73         cd $(SRC) && omake install
74         $(MAKE) -f $(ROOT)/Makefile --directory=$(DEST) install__ ROOT=$(ROOT)
75
76 install__:
77         $(call check_file,bin/habc) | tee $(INSTALL)
78         $(call check_file,bin/habc-scm) | tee -a $(INSTALL)
79         $(call check_file,bin/habc-xml) | tee -a $(INSTALL)
80         $(call check_file,lib/habc/std.ho) | tee -a $(INSTALL)
81         $(call check_file,lib/habc/stub.stub.ho) | tee -a $(INSTALL)
82         $(call check_file,lib/habc/flash.stub.ho) | tee -a $(INSTALL)
83         $(call check_file,share/habc/template.xml) | tee -a $(INSTALL)
84         $(call check_file,share/habc/example) | tee -a $(INSTALL)
85
86 swf:
87         $(MAKE) -f $(ROOT)/Makefile --directory=$(DEST)/share/habc/example swf__ ROOT=$(ROOT)
88
89 swf__:
90         $(DEST)/bin/habc binaryClock.scm -o $(SWF)
91         mv $(SWF).swf /var/www/vhosts/happyabc/htdocs/snapshot
92
93 web:
94         ruby makeweb.rb > /var/www/vhosts/happyabc/htdocs/snapshot/index.html
95
96 twitter:
97         grep -i 'fail\|error' *.log && twtr up -m '@mzp hey! Something wrong! see http://happyabc.org/snapshot.html'
98
99 clean:
100         rm -rf $(SRC)
101         rm -rf $(DEST)
102         rm -f *.log *.swf