update testcase grammar
[sbp.git] / Makefile
1
2 java = java -Xmx900m
3
4 default: edu.berkeley.sbp.jar
5
6 tibdoc: edu.berkeley.sbp.jar
7         $(java) -cp $< edu.berkeley.sbp.tib.TibDoc \
8                 tests/tibdoc.g \
9                 tests/bitstream.tib
10
11 java15: edu.berkeley.sbp.jar
12         $(java) -cp $< edu.berkeley.sbp.misc.Java15 \
13                 tests/java15.g \
14                 tests/java15.test
15
16 demo: edu.berkeley.sbp.jar
17         $(java) -cp $< edu.berkeley.sbp.misc.Demo \
18                 tests/demo.g \
19                 '(11+2*3)-44'
20
21 demo2: edu.berkeley.sbp.jar
22         $(java) -cp $< edu.berkeley.sbp.misc.Demo2
23
24 regress:
25         make boot
26         rm edu.berkeley.sbp.jar
27         make test
28
29 profile: edu.berkeley.sbp.jar
30         $(java) -cp $< edu.berkeley.sbp.misc.RegressionTests \
31                 -profile -agentlib:yjpagent \
32                 tests/meta.g \
33                 tests/testcase.g \
34                 tests/regression.tc
35
36 test: edu.berkeley.sbp.jar
37         $(java) -cp $< edu.berkeley.sbp.misc.RegressionTests \
38                 tests/meta.g \
39                 tests/testcase.g \
40                 tests/regression.tc
41
42 archscript: edu.berkeley.sbp.jar
43         cd tests; \
44         $(java) -cp ArchSimA3.jar:../$< ArchScript \
45                 test.archscript
46
47 codebag: edu.berkeley.sbp.jar
48         cd tests; \
49         $(java) -cp ArchSimA3.jar:../$< CodeBagParser \
50                 test.fleet
51
52 javatest: edu.berkeley.sbp.jar
53         $(java) -cp $< edu.berkeley.sbp.misc.RegressionTests \
54                 tests/meta.g \
55                 tests/testcase.g \
56                 tests/java.tc
57
58 loop: edu.berkeley.sbp.jar
59         $(java) -cp $< edu.berkeley.sbp.misc.RegressionTests \
60                 -graph \
61                 tests/meta.g \
62                 tests/testcase.g \
63                 tests/loop.tc
64
65 pain: edu.berkeley.sbp.jar
66         $(java) -cp $< edu.berkeley.sbp.misc.RegressionTests \
67                 -graph \
68                 tests/meta.g \
69                 tests/testcase.g \
70                 tests/pain.tc
71
72 ifthen: edu.berkeley.sbp.jar
73         $(java) -cp $< edu.berkeley.sbp.misc.RegressionTests \
74                 tests/meta.g \
75                 tests/testcase.g \
76                 tests/ifthen.tc
77
78 boot: edu.berkeley.sbp.jar
79         cd src; \
80         $(java) -cp ../$< \
81                 edu.berkeley.sbp.meta.MetaGrammar \
82                 ../tests/meta.g \
83                 edu.berkeley.sbp.meta.MetaGrammar
84
85 edu.berkeley.sbp.jar: $(shell find src -name \*.java)
86         mkdir -p bin
87         javac  -cp javax.servlet.jar -d bin -sourcepath src $^
88         echo 'Main-Class: edu.berkeley.sbp.misc.CommandLine' > bin/manifest
89         cd bin; jar cmf manifest ../$@ .
90 #-Xlint:unchecked
91 javadoc:
92         rm -rf doc/api
93         mkdir -p doc/api
94         javadoc \
95                 -linksource \
96                 -windowtitle "SBP: the Scannerless Boolean Parser" \
97                 -sourcepath src \
98                 -header "<b>SBP </b><br>v1.0" \
99                 -public \
100                 -notree \
101                 -noindex \
102                 -nonavbar \
103                 -stylesheetfile doc/javadoc.css \
104                 -noqualifier all \
105                 -d doc/api \
106                 edu.berkeley.sbp
107         javadoc \
108                 -linksource \
109                 -windowtitle "SBP: the Scannerless Boolean Parser" \
110                 -sourcepath src \
111                 -header "<b>SBP </b><br>v1.0" \
112                 -public \
113                 -notree \
114                 -noindex \
115                 -nonavbar \
116                 -noqualifier all \
117                 -d doc/api \
118                 edu.berkeley.sbp.meta \
119                 edu.berkeley.sbp.bind \
120                 edu.berkeley.sbp.chr \
121                 edu.berkeley.sbp.misc \
122                 edu.berkeley.sbp.tib \
123                 edu.berkeley.sbp.util
124
125 clean:
126         rm -rf doc/api edu.berkeley.sbp.jar bin edu.berkeley.sbp.tar.gz
127         rm -rf Makefile.bak *.hi *.o *.class *.jar Header_*.hs Class_*.hs *_JVM.hs InterfaceMyClass
128
129 upload:
130         make clean
131         make javadoc
132         darcs dist
133         echo '<html><head><meta HTTP-EQUIV="Refresh" CONTENT="0;URL=doc/sbp.html"></head></html>' > index.html
134         rsync -are ssh --progress --verbose --delete ./ argus.cs.berkeley.edu:public_html/sbp/
135
136
137
138 ###################################################################
139 ## Experimental Haskell bindings
140 ##
141 ##   make runHaskellDemo JAVA_HOME=<java-home>
142 ##
143
144 include Makefile.haskell
145
146 .jvm-bridge:
147         mkdir -p $(prefix)/src
148
149         cd $(prefix)/src; \
150                 curl $(jvm-bridge-url) | tar -xvzf -
151
152         cd $(prefix)/src/haskell-jvm-bridge-*; \
153                 patch -p0 < $(shell pwd)/misc/broken-cygwin-detection-patch && \
154                 $(patchmac) \
155                 $(patchghc) \
156                 (cd Native; autoreconf; true) && \
157                 (cd Haskell; autoreconf; true)
158
159         cd $(prefix)/src/haskell-jvm-bridge-*/Native; \
160                 ./configure --prefix=$(prefix) $(with_jvmdir) && \
161                 make && \
162                 make install
163
164         cd $(prefix)/src/haskell-jvm-bridge-*/Haskell; \
165                 ./configure --prefix=$(prefix) $(with_jvmdir) && \
166                 make && \
167                 make install
168
169         touch $@
170
171 runHaskellDemo: .jvm-bridge
172         mkdir -p bin
173         make bin/HaskellDemo
174         bin/HaskellDemo
175
176 bin/Header_%.o: edu.berkeley.sbp.jar .jvm-bridge
177         cd bin; $(bin)/MakeHeaderModule -module Header_$* -jar ../edu.berkeley.sbp.jar
178         cd bin; $(ghc) -c Header_$*.hs $(link)
179
180 bin/Class_%.o:
181         make bin/Header_$*.o
182         cd bin; $(bin)/MakeClassModule -import Header_Java -import Header_$* -cp ../edu.berkeley.sbp.jar `echo $* | sed s/_/./g`
183         cd bin; $(ghc) -c Class_$*.hs $(link)
184
185 bin/JVM_%.o:
186         make bin/Class_$*.o
187         make bin/Header_$*.o
188         cd bin; echo -e $($*_list) | $(bin)/MakeJVMModule JVM_$*
189         cd bin; $(ghc) -c JVM_$*.hs $(link)
190
191 edu_berkeley_sbp_misc_HaskellHelper_list = "edu.berkeley.sbp.misc.HaskellHelper\njava.lang.String\nedu.berkeley.sbp.Tree\njava.lang.Object"
192
193 bin/HaskellDemo: src/SBP.hs \
194                  src/HaskellDemo.hs \
195                  bin/Class_java_lang_Object.o \
196                  bin/Class_java_lang_String.o \
197                  bin/Class_edu_berkeley_sbp_Tree.o \
198                  bin/JVM_edu_berkeley_sbp_misc_HaskellHelper.o
199         cd bin; $(ghc) -c ../src/SBP.hs $(link) -o SBP.o
200         cd bin; $(ghc) -i../src/ -c ../src/HaskellDemo.hs $(link) -o HaskellDemo.o
201         cd bin; for A in *.hs; do $(ghc) -c $$A $(link); done
202         cd bin; $(ghc) $(linkopts) $(link) -o HaskellDemo *.o
203
204
205 ghcroot = /usr/local/brian/ghc
206 ghc     = $(ghcroot)/compiler/ghc-inplace -fallow-undecidable-instances -fallow-overlapping-instances
207 ghclibs = $(ghcroot)/rts/HSrts.jar:$(ghcroot)/libraries/base/HSbase.jar:$(ghcroot)/libraries/stm/HSstm.jar
208
209 bin/Main.class: src/Main.lhs src/SBP.lhs
210         cd src; $(ghc) -fglasgow-exts -cpp -odir ../bin -c -java SBP.lhs
211         cd src; $(ghc) -fglasgow-exts -cpp -odir ../bin -java Main.lhs
212
213 #profile=-agentlib:yjpagent
214 go: bin/Main.class edu.berkeley.sbp.jar
215         java $(profile) -cp bin:$(ghclibs):edu.berkeley.sbp.jar Main