daemon/readdir: avoid a small leak
[libguestfs.git] / java / Makefile.am
1 # libguestfs Java bindings
2 # Copyright (C) 2009 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 CPTH = com/redhat/et/libguestfs
19
20 java_sources = \
21         $(CPTH)/LibGuestFSException.java \
22         $(CPTH)/IntBool.java \
23         $(CPTH)/PV.java \
24         $(CPTH)/VG.java \
25         $(CPTH)/LV.java \
26         $(CPTH)/Stat.java \
27         $(CPTH)/StatVFS.java \
28         $(CPTH)/Dirent.java \
29         $(CPTH)/GuestFS.java
30
31 java_tests = \
32         Bindtests.java \
33         t/GuestFS005Load.java \
34         t/GuestFS010Launch.java \
35         t/GuestFS050LVCreate.java
36
37 EXTRA_DIST = \
38         $(java_sources) \
39         $(java_tests) \
40         run-bindtests \
41         run-java-tests
42
43 CLEANFILES = doc-stamp
44
45 if HAVE_JAVA
46
47 # Java source.
48
49 libguestfs_jardir = $(JAR_INSTALL_DIR)
50 libguestfs_jar_DATA = libguestfs-${VERSION}.jar
51 libguestfs_jar_class_files = $(java_sources:.java=.class)
52 $(libguestfs_jar_class_files): %.class: %.java
53         $(JAVAC) $(JAVAC_FLAGS) -classpath $(CPTH) $(java_sources)
54
55 libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
56         $(JAR) cf $@ $^
57
58 # JNI source.
59
60 lib_LTLIBRARIES = libguestfs_jni.la
61 libguestfs_jni_la_SOURCES = \
62         com_redhat_et_libguestfs_GuestFS.h \
63         com_redhat_et_libguestfs_GuestFS.c
64
65 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
66 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
67 libguestfs_jni_la_CFLAGS = -Wall -I$(top_builddir)/src $(JNI_CFLAGS)
68
69 BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
70
71 com_redhat_et_libguestfs_GuestFS.h: $(CPTH)/GuestFS.class
72         $(JAVAH) -classpath .:$(CPTH) com.redhat.et.libguestfs.GuestFS
73
74 # Documentation.
75
76 noinst_SCRIPTS = doc-stamp
77
78 doc-stamp: $(java_sources)
79         $(JAVADOC) $(JAVADOC_FLAGS) -d api \
80           -sourcepath $(srcdir) \
81           -windowtitle "libguestfs java $(VERSION) API reference" \
82           -doctitle "libguestfs java $(VERSION) API reference" \
83           com.redhat.et.libguestfs
84         touch $@
85
86 install-data-hook:
87         mkdir -p $(DESTDIR)$(datadir)/javadoc/$(PACKAGE_NAME)-java-$(PACKAGE_VERSION)
88         cp -a api/* $(DESTDIR)$(datadir)/javadoc/$(PACKAGE_NAME)-java-$(PACKAGE_VERSION)
89
90 # Tests (not comprehensive).
91
92 TESTS = run-bindtests run-java-tests
93 TESTS_ENVIRONMENT = \
94         JAVA=$(JAVA) \
95         CLASSPATH=.:t:libguestfs-$(VERSION).jar \
96         LIBGUESTFS_PATH=$(top_builddir)/appliance
97
98 noinst_DATA = Bindtests.class $(java_tests:.java=.class)
99
100 t/%.class: t/%.java
101         $(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar $<
102
103 Bindtests.class: Bindtests.java
104         $(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar $<
105
106 endif
107
108 # Tell version 3.79 and up of GNU make to not build goals in this
109 # directory in parallel.
110 .NOTPARALLEL: