[bootstrap] Use SWIG 4.2.0
[xapian.git] / xapian-bindings / java / Makefile.am
blob291eb7480441deaa596ed8944702e409f49fc085
1 ## Process this file with automake to produce Makefile.in
3 include ../generic/generic.mk
5 # Disable parallel build for this make invocation; javac seems to write
6 # .class files in place, and it also reads existing .class files - the
7 # combination means that in a parallel build it can read partial .class
8 # and then fail with various odd errors.
9 .NOTPARALLEL:
11 ## Test programs to be run
12 TESTS = SmokeTest.class
13 AM_TESTS_ENVIRONMENT = \
14         LIBTOOL="$(LIBTOOL)" ;\
15         JAVA="$(JAVA) $(JAVA_CHECK_JNI_OPTION)" ;\
16         PATHSEP="$(JAVA_PATHSEP)" ;\
17         _libs="$(_libs)" ;\
18         export LIBTOOL ;\
19         export JAVA ;\
20         export PATHSEP ;\
21         export _libs ;
22 LOG_COMPILER = $(srcdir)/run-java-test
24 CLEANFILES = SmokeTest.class MyMatchDecider.class MyExpandDecider.class\
25         MyFieldProcessor.class\
26         built/xapian.jar\
27         $(XAPIAN_SWIG_JAVA_CLASS) $(XAPIAN_SWIG_JAVA_EXTRA_CLASSES)
29 SmokeTest: SmokeTest.class
31 # To get debug symbols, use: make JAVACFLAGS=-g
32 .java.class:
33         $(JAVAC) $(JAVACFLAGS) -classpath .$(JAVA_PATHSEP)$(srcdir) -d . $<
35 XAPIAN_SWIG_JAVA_SRCS=\
36         org/xapian/Auto.java\
37         org/xapian/BB2Weight.java\
38         org/xapian/BM25PlusWeight.java\
39         org/xapian/BM25Weight.java\
40         org/xapian/BoolWeight.java\
41         org/xapian/Chert.java\
42         org/xapian/Compactor.java\
43         org/xapian/CoordWeight.java\
44         org/xapian/Database.java\
45         org/xapian/DateRangeProcessor.java\
46         org/xapian/DateValueRangeProcessor.java\
47         org/xapian/DecreasingValueWeightPostingSource.java\
48         org/xapian/DLHWeight.java\
49         org/xapian/DPHWeight.java\
50         org/xapian/Document.java\
51         org/xapian/Enquire.java\
52         org/xapian/ESet.java\
53         org/xapian/ESetIterator.java\
54         org/xapian/ExpandDecider.java\
55         org/xapian/ExpandDeciderAnd.java\
56         org/xapian/ExpandDeciderFilterPrefix.java\
57         org/xapian/FieldProcessor.java\
58         org/xapian/FixedWeightPostingSource.java\
59         org/xapian/GreatCircleMetric.java\
60         org/xapian/IfB2Weight.java\
61         org/xapian/IneB2Weight.java\
62         org/xapian/InL2Weight.java\
63         org/xapian/InMemory.java\
64         org/xapian/KeyMaker.java\
65         org/xapian/LMWeight.java \
66         org/xapian/LatLongCoord.java\
67         org/xapian/LatLongCoords.java\
68         org/xapian/LatLongCoordsIterator.java\
69         org/xapian/LatLongDistanceKeyMaker.java\
70         org/xapian/LatLongDistancePostingSource.java\
71         org/xapian/LatLongMetric.java\
72         org/xapian/MatchDecider.java\
73         org/xapian/MatchSpy.java\
74         org/xapian/MSet.java\
75         org/xapian/MSetIterator.java\
76         org/xapian/MultiValueKeyMaker.java\
77         org/xapian/NumberRangeProcessor.java\
78         org/xapian/NumberValueRangeProcessor.java\
79         org/xapian/PL2PlusWeight.java\
80         org/xapian/PL2Weight.java\
81         org/xapian/PositionIterator.java\
82         org/xapian/PostingIterator.java\
83         org/xapian/PostingSource.java\
84         org/xapian/Query.java\
85         org/xapian/QueryParser.java\
86         org/xapian/RangeProcessor.java\
87         org/xapian/Registry.java\
88         org/xapian/Remote.java\
89         org/xapian/RSet.java\
90         org/xapian/SimpleStopper.java\
91         org/xapian/Stem.java\
92         org/xapian/StemImplementation.java\
93         org/xapian/Stopper.java\
94         org/xapian/StringValueRangeProcessor.java\
95         org/xapian/SWIGTYPE_p_std__string.java\
96         org/xapian/TermGenerator.java\
97         org/xapian/TermIterator.java\
98         org/xapian/TfIdfWeight.java\
99         org/xapian/TradWeight.java\
100         org/xapian/ValueCountMatchSpy.java\
101         org/xapian/ValueIterator.java\
102         org/xapian/ValueMapPostingSource.java\
103         org/xapian/ValuePostingSource.java\
104         org/xapian/ValueRangeProcessor.java\
105         org/xapian/ValueSetMatchDecider.java\
106         org/xapian/ValueWeightPostingSource.java\
107         org/xapian/Version.java\
108         org/xapian/Weight.java\
109         org/xapian/WritableDatabase.java\
110         org/xapian/Xapian.java\
111         org/xapian/XapianConstants.java\
112         org/xapian/XapianJNI.java
114 XAPIAN_SWIG_JAVA_CLASS = $(XAPIAN_SWIG_JAVA_SRCS:.java=.class)
116 # Java generates nested classes with filenames containing a $ (smart move) so
117 # we pick them up with a wildcard and omit them from dependencies to avoid
118 # escaping hell.  The lack of a dependency shouldn't really be an issue since
119 # these classes are always generated along with the containing class which
120 # is listed in the dependencies.
121 XAPIAN_SWIG_JAVA_EXTRA_CLASSES=\
122         org/xapian/Compactor*compaction_level.class\
123         org/xapian/Enquire*docid_order.class\
124         org/xapian/Query*1.class\
125         org/xapian/Query*op.class\
126         org/xapian/QueryParser*feature_flag.class\
127         org/xapian/QueryParser*stem_strategy.class\
128         org/xapian/TermGenerator*flags.class\
129         org/xapian/TermGenerator*stem_strategy.class\
130         org/xapian/TermGenerator*stop_strategy.class\
131         org/xapian/Weight*type_smoothing.class
133 noinst_DATA = built/xapian.jar
135 built/xapian.jar: $(XAPIAN_SWIG_JAVA_CLASS)
136         $(MKDIR_P) built
137         $(JAR) -cf built/xapian.jar org/xapian/*.class
138 ##$(XAPIAN_SWIG_JAVA_CLASS) $(XAPIAN_SWIG_JAVA_EXTRA_CLASSES)
140 jnidir = $(abs_builddir)/built
142 jni_LTLIBRARIES = libxapian_jni.la
144 # Remove the .la file - libxapian_jni.la is never linked against (it's a
145 # module) and JVMs don't use libltdl.  Note that the library gets installed by
146 # install-data, so that's where we need to hook.
147 install-data-hook:
148         rm -f $(DESTDIR)$(jnidir)/libxapian_jni.la
150 # Because we don't install the .la file, "make uninstall" doesn't work and
151 # we need to remove the file ourselves.
152 uninstall-local:
153 if NEED_JNILIB_EXT
154         rm -f $(DESTDIR)$(jnidir)/libxapian_jni.jnilib
155 else
156         eval `grep '^dlname=' $(jni_LTLIBRARIES)` ; \
157           rm -f $(DESTDIR)$(jnidir)/"$$dlname"
158 endif
160 if NEED_JNILIB_EXT
161 SHREXT=-shrext .jnilib
162 else
163 SHREXT=
164 endif
165 AM_CXXFLAGS = $(SWIG_CXXFLAGS) $(XAPIAN_CXXFLAGS)
166 AM_CPPFLAGS = $(JAVA_CPPFLAGS)
167 libxapian_jni_la_LDFLAGS = -avoid-version -module $(SHREXT) $(NO_UNDEFINED)
168 libxapian_jni_la_LIBADD = $(XAPIAN_LIBS)
169 libxapian_jni_la_SOURCES = xapian_wrap.cc
171 SWIG_GENERATED = xapian_wrap.cc xapian_wrap.h $(XAPIAN_SWIG_JAVA_SRCS)
173 BUILT_SOURCES = $(SWIG_GENERATED)
175 EXTRA_DIST = java.i run-java-test SmokeTest.java docs/index.rst $(SWIG_GENERATED)
177 if MAINTAINER_MODE
178 stamp = xapian_wrap.stamp
179 RUN_SWIG = stamp='$(stamp)' $(PERL) '$(top_srcdir)'/swig-depcomp $(SWIG)
181 xapian_wrap.cc xapian_wrap.h $(XAPIAN_SWIG_JAVA_SRCS): $(stamp)
182         $(make_many_locked)
183 $(stamp):
184         $(multitarget_begin)
185         : # Make sure that we don't package stale generated sources in the
186         : # case where SWIG changes its mind as to which files it generates.
187         -rm -f org/xapian/*
188         $(MKDIR_P) org/xapian
189         $(RUN_SWIG) $(SWIG_WERROR) -I'$(srcdir)' $(SWIG_FLAGS) -c++ \
190             -java -module Xapian -package org.xapian -outdir org/xapian \
191             -o xapian_wrap.cc '$(srcdir)/'java.i
192         : # Check that exactly the sources we expected were generated.
193         $(PERL) -e 'print "$$_\n" for sort @ARGV' org/xapian/*.java > org/xapian/list
194         $(PERL) -e 'print "$$_\n" for sort @ARGV' $(XAPIAN_SWIG_JAVA_SRCS)|diff -c - org/xapian/list
195         $(multitarget_end)
197 -include xapian_wrap.d
199 CLEANFILES += $(stamp)
200 endif
201 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
203 maintainer-clean-local:
204         rm -rf built org
206 exampledatadir = $(docdir)/java/examples
207 dist_exampledata_DATA =\
208         docs/examples/SimpleSearch.java\
209         docs/examples/SimpleIndex.java
211 docdatadir = $(docdir)/java
212 dist_docdata_DATA = docs/index.html
214 if DOCUMENTATION_RULES
215 BUILT_SOURCES += docs/index.html
217 .rst.html:
218         -case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; $(MKDIR_P) "$$d" ;; esac
219         $(RST2HTML) --exit-status=warning $< $@
220 endif