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

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

Move conditional java targets to the top of Makefile.am.

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