cccc1901bfbb79e438f48f51df2d962c1215c2c4
[org.ibex.core.git] / Makefile.common
1 ###############################################################################
2 # Ibex common Makefile
3 #
4 #    includes boilerplate stuff and inter-project dependency resolution
5 #
6
7 realdefault: default
8
9 ### interproject deps #############################################################
10
11 cmd := find src -name \*.java -exec grep '^import org.ibex.' {} \;
12 cmd +=  | sed 's_import org\.ibex\.\([a-z]*\).*_ repo/\1.ibex.org/\n_'
13 cmd +=  | sort | uniq | (while read A; do test -e $$A || echo $$A; done)
14 $(eval upstream := $(shell $(cmd)))
15
16 repos: $(upstream)
17 repo/: ; mkdir repo
18 repo/%.ibex.org/: repo/
19         test -e $@ && (cd repo/$*.ibex.org; darcs pull -a --verbose http://$*.ibex.org/); true
20         test -e $@ || (cd repo; darcs get --partial --verbose http://$*.ibex.org/); true
21         cd src/org/ibex; ln -sf ../../../repo/$*.ibex.org/src/org/ibex/$*
22
23
24 ### cleanup targets ##################################################################
25
26 clean:      ; rm -rf build
27 dist-clean: ; rm -rf build .compile
28
29
30 ### java->class compilation ##########################################################
31
32 javac := javac
33 java_sources := $(shell find src/org/ibex/*/ -name \*.java)
34
35 src/org/ibex/util/Preprocessor.java: repo/util.ibex.org/
36 build/class/org/ibex/util/Preprocessor.class: src/org/ibex/util/Preprocessor.java
37         mkdir -p build/class/
38         $(javac) -d build/class/ $<
39
40 compile: .compile
41 .compile: $(java_sources) build/class/org/ibex/util/Preprocessor.class
42         make -s repos
43         java -cp build/class org.ibex.util.Preprocessor $(java_sources)
44         $(javac) $(java_sources:src/%.java=build/java/%.java)
45         touch $@
46
47
48 ### proposing and checkins ##########################################################
49
50 propose-patch:
51         @darcs send --edit-description -o .darcspatch -T patches@xwt.org http://core.ibex.org/
52         @(echo "To: patches@xwt.org";\
53          SUB=`grep -A10000 New.patches .darcspatch | grep '^\\[' | cut -b 2- | tr \\\n , | sed s_,_,\ _g | sed "s_, *\\$$__"`;\
54          echo "Subject: $$SUB";\
55          echo;\
56          cat .darcspatch) | /usr/sbin/sendmail -bm -f $(USER)@xwt.org patches@xwt.org;
57         @rm .darcspatch 
58
59 commit: propose-patch
60         darcs push xwt@xwt.org:/var/www/org/ibex/core/
61
62
63 ### documentation ##########################################################
64
65 doc/%.pdf: build/class/org/ibex/util/XML.class build/class/org/ibex/doc/Doc.class
66         cd doc/$*; java -cp ../../build/class org.ibex.doc.Doc < $*.xml > $*.tex
67         cd doc/$*; pdflatex $*.tex
68         mv doc/$*/$*.pdf doc/$*.pdf
69         test `uname` == Darwin && open doc/$*.pdf