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