make "examples" make target build the java examples
[jp-mirror:jp-mirror.git] / Makefile
1 default: thrift
2
3 all: thrift docs examples lib test
4
5 docs: lifecycle.png javadoc
6
7 thrift:  thrift-rb thrift-cpp thrift-java
8
9 lib: lib-java
10
11 ##### THRIFT-RB #####
12
13 thrift-rb: gen-rb/job_pool.rb
14
15 gen-rb/job_pool.rb: jp.thrift
16         thrift --gen rb $<
17
18 ##### THRIFT-CPP #####
19
20 thrift-cpp: gen-cpp/libjp.a
21
22 gen-cpp/JobPool.cpp: jp.thrift
23         thrift --gen cpp $<
24
25 gen-cpp/libjp.a: gen-cpp/JobPool.cpp
26         cd gen-cpp; \
27                 $(CXX) $(CFLAGS) -c JobPool.cpp jp_constants.cpp jp_types.cpp -I/usr/include/thrift; \
28                 ar cq libjp.a *.o
29
30 ###### THRIFT-JAVA #####
31
32 thrift-java: gen-java/jp.jar
33
34 gen-java/uk/co/fredemmott/jp/JobPool.java: jp.thrift
35         thrift --gen java $<
36
37 THRIFT_JAR=/usr/share/java/libthrift.jar
38 SLF4J_JAR=/usr/share/java/slf4j-api.jar
39 gen-java/jp.jar: gen-java/uk/co/fredemmott/jp/JobPool.java
40         cd gen-java; \
41                 find -name "*.java" | xargs javac -cp $(THRIFT_JAR):$(SLF4J_JAR); \
42                 find -name "*.class" | xargs jar cvf jp.jar;
43
44 ##### LIB-JAVA #####
45
46 lib-java:
47         ant jar
48
49 ##### TESTS #####
50 test: test-server test-lib
51
52 test-server:
53         cd tests/classes; ./run_tests.rb
54
55 test-lib: test-lib-rb test-lib-java
56
57 test-lib-rb:
58         cd tests/lib/rb; ./run_tests.rb
59
60 test-lib-java:
61         ant junit 2>&1 | ruby -e "exit_code = 0; while gets; exit_code = 1 if /FAILED/; print; end; exit exit_code"
62
63 ##### MISC #####
64
65 lifecycle.png: lifecycle.dot
66         dot -Tpng $< > $@
67
68 javadoc:
69         ant javadoc
70
71 examples: thrift lib
72         $(MAKE) -C examples
73         ant compile_examples create_scripts
74
75 clean:
76         $(MAKE) -C examples clean
77         rm -rf gen-* lifecycle.png
78         ant clean