[java] Improve build on FreeBSD and DragonFlyBSD
[xapian.git] / xapian-bindings / php / Makefile.am
blob76be206ecb7a185b0258c1041ae74afb0141a2ea
1 ## Process this file with automake to produce Makefile.in
3 include ../generic/generic.mk
5 abs_builddir = @abs_builddir@
7 ## Test programs to be run
8 TESTS = smoketest.php
9 LOG_COMPILER = \
10     $(LIBTOOL) -dlopen xapian.la --mode=execute $(MACOS_SIP_HACK_ENV) $(PHP)
11 # Use -n to disable use of the system php.ini to avoid custom configuration
12 # settings there which might interfere with our tests.
13 AM_LOG_FLAGS = -n -d extension_dir='$(abs_builddir)/$(_libs)' -d extension=xapian
15 installcheck-local:
16         $(MAKE) check AM_LOG_FLAGS=
18 SWIG_GENERATED =\
19         php/xapian_wrap.cc\
20         php/xapian_wrap.h\
21         php/php_xapian.h
23 EXTRA_DIST = php.i except.i \
24         generate-php-exceptions \
25         add-php-ref-handling \
26         docs/index.rst \
27         $(TESTS) $(SWIG_GENERATED)
29 BUILT_SOURCES = $(SWIG_GENERATED)
31 phpextdir = $(PHP_EXTENSION_DIR)
33 phpext_LTLIBRARIES = xapian.la
35 # Remove the .la file - xapian.la is never linked against (it's a module)
36 # and PHP doesn't use libltdl.  Note that the library gets installed by
37 # install-data, so that's where we need to hook.
38 install-data-hook:
39         rm -f $(DESTDIR)$(phpextdir)/xapian.la
41 # Because we don't install the .la file, "make uninstall" doesn't work and
42 # we need to remove the file ourselves.
43 uninstall-local:
44         rm -f $(DESTDIR)$(phpextdir)/xapian.$(PHP_SHLIB_SUFFIX)
46 AM_CPPFLAGS = $(PHP_INC)
47 AM_CXXFLAGS = $(SWIG_CXXFLAGS) $(XAPIAN_CXXFLAGS)
48 xapian_la_LDFLAGS = -avoid-version -module -shrext .$(PHP_SHLIB_SUFFIX) $(NO_UNDEFINED)
49 xapian_la_SOURCES = php/xapian_wrap.cc php/xapian_wrap.h
50 xapian_la_LIBADD = $(XAPIAN_LIBS) $(PHP_LIBS)
52 if MAINTAINER_MODE
53 BUILT_SOURCES += except.i
54 except.i: $(srcdir)/generate-php-exceptions ../../xapian-core/exception_data.pm
55         $(PERL) -w -I$(srcdir)/../../xapian-core $(srcdir)/generate-php-exceptions
57 # We need to explicitly set -outdir because on Windows, SWIG splits paths at
58 # "\" when extracting the output directory from the value passed to the -o
59 # option.
61 stamp = php/xapian_wrap.stamp
62 SWIG_FLAGS += -MD -MP -MT $(stamp)
64 php/xapian_wrap.cc php/xapian_wrap.h php/php_xapian.h: $(stamp)
65         $(make_many_locked)
66 $(stamp): except.i add-php-ref-handling
67         $(MKDIR_P) php
68         $(multitarget_begin)
69         $(SWIG) $(SWIG_WERROR) -I'$(srcdir)' $(SWIG_FLAGS) -c++ \
70             -DPACKAGE_VERSION='"$(PACKAGE_VERSION)"' \
71             -php -prefix Xapian -outdir php \
72             -o php/xapian_wrap.cc '$(srcdir)/'php.i
73         $(PERL) '$(srcdir)/'add-php-ref-handling php/xapian_wrap.cc \
74             > php/xapian_wrap.tmp
75         mv php/xapian_wrap.tmp php/xapian_wrap.cc
76         $(multitarget_end)
78 -include php/xapian_wrap.d
80 CLEANFILES = $(stamp)
81 endif
82 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
84 exampledatadir = $(docdir)/php/examples
85 dist_exampledata_DATA =\
86         docs/examples/simplesearch.php8\
87         docs/examples/simpleindex.php8\
88         docs/examples/simpleexpand.php8\
89         docs/examples/simplematchdecider.php8
91 docdatadir = $(docdir)/php
92 dist_docdata_DATA = docs/index.html
94 if DOCUMENTATION_RULES
95 BUILT_SOURCES += docs/index.html
97 .rst.html:
98         -case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; $(MKDIR_P) "$$d" ;; esac
99         $(RST2HTML) --exit-status=warning $< $@
100 endif