6ca6f290e261204aac1756c1c030b273c7a9a5b6
[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
34 EXTRA_DIST = \
35         $(java_sources) \
36         $(java_tests) \
37         run-java-test
38
39 CLEANFILES = *~ doc-stamp
40
41 if HAVE_JAVA
42
43 # Java source.
44
45 libguestfs_jardir = $(JAR_INSTALL_DIR)
46 libguestfs_jar_DATA = libguestfs-${VERSION}.jar
47 libguestfs_jar_class_files = $(java_sources:.java=.class)
48 $(libguestfs_jar_class_files): %.class: %.java
49         $(JAVAC) $(JAVAC_FLAGS) -classpath $(CPTH) $(java_sources)
50
51 libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
52         $(JAR) cf $@ $^
53
54 # JNI source.
55
56 lib_LTLIBRARIES = libguestfs_jni.la
57 libguestfs_jni_la_SOURCES = \
58         com_redhat_et_libguestfs_GuestFS.h \
59         com_redhat_et_libguestfs_GuestFS.c
60
61 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
62 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
63 libguestfs_jni_la_CFLAGS = -Wall -I$(top_builddir)/src $(JNI_CFLAGS)
64
65 BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
66
67 com_redhat_et_libguestfs_GuestFS.h: $(CPTH)/GuestFS.class
68         $(JAVAH) -classpath .:$(CPTH) com.redhat.et.libguestfs.GuestFS
69
70 # Documentation.
71
72 noinst_SCRIPTS = doc-stamp
73
74 doc-stamp: $(java_sources)
75         $(JAVADOC) $(JAVADOC_FLAGS) -d api \
76           -sourcepath $(srcdir) \
77           -windowtitle "libguestfs java $(VERSION) API reference" \
78           -doctitle "libguestfs java $(VERSION) API reference" \
79           com.redhat.et.libguestfs
80         touch $@
81
82 # Tests (not comprehensive).
83
84 TESTS = $(java_tests:.java=.class)
85 TESTS_ENVIRONMENT = \
86         JAVA=$(JAVA) \
87         CLASSPATH=t:libguestfs-$(VERSION).jar \
88         LIBGUESTFS_PATH=$(abs_top_builddir) \
89         ./run-java-test
90
91 t/%.class: t/%.java
92         $(JAVAC) $(JAVAC_FLAGS) -classpath libguestfs-$(VERSION).jar $<
93
94 endif