Add the test0* functions, used to test language bindings.
[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)/GuestFS.java
29
30 java_tests = \
31         t/GuestFS005Load.java \
32         t/GuestFS010Launch.java \
33         t/GuestFS050LVCreate.java
34
35 EXTRA_DIST = \
36         $(java_sources) \
37         $(java_tests) \
38         run-java-test
39
40 CLEANFILES = doc-stamp
41
42 if HAVE_JAVA
43
44 # Java source.
45
46 libguestfs_jardir = $(JAR_INSTALL_DIR)
47 libguestfs_jar_DATA = libguestfs-${VERSION}.jar
48 libguestfs_jar_class_files = $(java_sources:.java=.class)
49 $(libguestfs_jar_class_files): %.class: %.java
50         $(JAVAC) $(JAVAC_FLAGS) -classpath $(CPTH) $(java_sources)
51
52 libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
53         $(JAR) cf $@ $^
54
55 # JNI source.
56
57 lib_LTLIBRARIES = libguestfs_jni.la
58 libguestfs_jni_la_SOURCES = \
59         com_redhat_et_libguestfs_GuestFS.h \
60         com_redhat_et_libguestfs_GuestFS.c
61
62 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
63 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
64 libguestfs_jni_la_CFLAGS = -Wall -I$(top_builddir)/src $(JNI_CFLAGS)
65
66 BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
67
68 com_redhat_et_libguestfs_GuestFS.h: $(CPTH)/GuestFS.class
69         $(JAVAH) -classpath .:$(CPTH) com.redhat.et.libguestfs.GuestFS
70
71 # Documentation.
72
73 noinst_SCRIPTS = doc-stamp
74
75 doc-stamp: $(java_sources)
76         $(JAVADOC) $(JAVADOC_FLAGS) -d api \
77           -sourcepath $(srcdir) \
78           -windowtitle "libguestfs java $(VERSION) API reference" \
79           -doctitle "libguestfs java $(VERSION) API reference" \
80           com.redhat.et.libguestfs
81         touch $@
82
83 install-data-hook:
84         mkdir -p $(DESTDIR)$(datadir)/javadoc/$(PACKAGE_NAME)-java-$(PACKAGE_VERSION)
85         cp -a api/* $(DESTDIR)$(datadir)/javadoc/$(PACKAGE_NAME)-java-$(PACKAGE_VERSION)
86
87 # Tests (not comprehensive).
88
89 TESTS = $(java_tests:.java=.class)
90 TESTS_ENVIRONMENT = \
91         JAVA=$(JAVA) \
92         CLASSPATH=t:libguestfs-$(VERSION).jar \
93         LIBGUESTFS_PATH=$(top_builddir)/appliance \
94         ./run-java-test
95
96 t/%.class: t/%.java
97         $(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar $<
98
99 endif
100
101 # Tell version 3.79 and up of GNU make to not build goals in this
102 # directory in parallel.
103 .NOTPARALLEL: