68f1d78dddc8e7ac8f7b7ce0ff547a3a1d6ebe05
[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 EXTRA_DIST = $(java_sources)
31
32 CLEANFILES = *~ doc-stamp
33
34 if HAVE_JAVA
35
36 # Java source.
37
38 libguestfs_jardir = $(JAR_INSTALL_DIR)
39 libguestfs_jar_DATA = libguestfs-${VERSION}.jar
40 libguestfs_jar_class_files = $(java_sources:.java=.class)
41 $(libguestfs_jar_class_files): %.class: %.java
42         $(JAVAC) $(JAVAC_FLAGS) -classpath "$(CPTH)" $(java_sources)
43
44 libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
45         $(JAR) cf $@ $^
46
47 # JNI source.
48
49 lib_LTLIBRARIES = libguestfs_jni.la
50 libguestfs_jni_la_SOURCES = \
51         com_redhat_et_libguestfs_GuestFS.h \
52         com_redhat_et_libguestfs_GuestFS.c
53
54 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
55 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
56 libguestfs_jni_la_CFLAGS = -Wall -I$(top_builddir)/src $(JNI_CFLAGS)
57
58 BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
59
60 com_redhat_et_libguestfs_GuestFS.h: $(CPTH)/GuestFS.class
61         $(JAVAH) -classpath ".:$(CPTH)" com.redhat.et.libguestfs.GuestFS
62
63 # Documentation.
64
65 noinst_SCRIPTS = doc-stamp
66
67 doc-stamp: $(java_sources)
68         $(JAVADOC) $(JAVADOC_FLAGS) -d api \
69           -sourcepath $(srcdir) \
70           -windowtitle "libguestfs java $(VERSION) API reference" \
71           -doctitle "libguestfs java $(VERSION) API reference" \
72           com.redhat.et.libguestfs
73         touch $@
74
75 endif