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