source: libcaca/trunk/java/Makefile.am @ 4198

Last change on this file since 4198 was 4198, checked in by Sam Hocevar, 10 years ago

Build Java examples and add wrapper scripts to run them.

File size: 2.7 KB
Line 
1# $Id$
2
3jnidir = $(libdir)/jni
4
5if USE_JAVA
6jni_LTLIBRARIES = libcaca-java.la
7noinst_DATA = examples/Driver.class examples/TrueColor.class
8endif
9
10java_src = $(wildcard $(srcdir)/org/zoy/caca/*.java)
11
12java_jar = libjava.jar
13
14java_jni_headers =         \
15  org_zoy_caca_Attribute.h \
16  org_zoy_caca_Caca.h      \
17  org_zoy_caca_Canvas.h    \
18  org_zoy_caca_Display.h   \
19  org_zoy_caca_Dither.h    \
20  org_zoy_caca_Event.h     \
21  org_zoy_caca_Font.h
22
23java_jni_src =             \
24  org_zoy_caca_Attribute.c \
25  org_zoy_caca_Caca.c      \
26  org_zoy_caca_Canvas.c    \
27  org_zoy_caca_Display.c   \
28  org_zoy_caca_Dither.c    \
29  org_zoy_caca_Event.c     \
30  org_zoy_caca_Font.c
31
32java_jni_classes =             \
33  org/zoy/caca/Attribute.class \
34  org/zoy/caca/Caca.class      \
35  org/zoy/caca/Canvas.class    \
36  org/zoy/caca/Display.class   \
37  org/zoy/caca/Dither.class    \
38  org/zoy/caca/Event.class     \
39  org/zoy/caca/Font.class
40
41JAVAH_FLAGS = -d . -classpath .
42
43$(java_jni_classes): $(java_src)
44        $(JAVAC) -d . $(java_src)
45        $(JAR) -cf $(java_jar) org
46
47# Javah does not update the file if it detects that there is nothing to do,
48# hence the `touch` so that javah is not run at every `make`.
49
50org_zoy_caca_Attribute.h: org/zoy/caca/Attribute.class
51        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Attribute
52        @touch org_zoy_caca_Attribute.h
53
54org_zoy_caca_Caca.h: org/zoy/caca/Caca.class
55        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Caca
56        @touch org_zoy_caca_Caca.h
57
58org_zoy_caca_Canvas.h: org/zoy/caca/Canvas.class
59        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Canvas
60        @touch org_zoy_caca_Canvas.h
61
62org_zoy_caca_Display.h: org/zoy/caca/Display.class
63        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Display
64        @touch org_zoy_caca_Display.h
65
66org_zoy_caca_Dither.h: org/zoy/caca/Dither.class
67        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Dither
68        @touch org_zoy_caca_Dither.h
69
70org_zoy_caca_Event.h: org/zoy/caca/Event.class
71        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Event
72        @touch org_zoy_caca_Event.h
73
74org_zoy_caca_Font.h: org/zoy/caca/Font.class
75        $(JAVAH) $(JAVAH_FLAGS) org.zoy.caca.Font
76        @touch org_zoy_caca_Font.h
77
78CLEANFILES = $(noinst_DATA) $(java_jar) \
79             org/zoy/caca/*.class org_zoy_caca_[A-Z]*.h
80EXTRA_DIST = README
81
82if USE_JAVA
83BUILT_SOURCES = $(java_jni_headers) $(java_jni_classes)
84endif
85
86libcaca_java_la_CPPFLAGS = $(JAVA_CFLAGS)
87libcaca_java_la_SOURCES = \
88  caca_java_common.h   \
89  caca_java_common.c   \
90  $(java_jni_src)
91#nodist_libcaca_java_la_SOURCES = \
92#  $(java_jni_headers)
93libcaca_java_la_LDFLAGS = -shared $(JAVA_LIBS)
94libcaca_java_la_LIBADD = ../caca/libcaca.la
95libcaca_java_ladir = $(datadir)/java
96libcaca_java_la_DATA = $(java_jar)
97
98examples/Driver.class: examples/Driver.java
99        $(JAVAC) $^
100
101examples/TrueColor.class: examples/TrueColor.java
102        $(JAVAC) $^
103
Note: See TracBrowser for help on using the repository browser.