scriptindex: Finish parsing index script after error
[xapian.git] / xapian-bindings / ruby / Makefile.am
blobd209d2a2201abcb78997a7872da78548350ff4b3
1 ## Process this file with automake to produce Makefile.in
3 include ../generic/generic.mk
5 ## Test programs to be run
6 TESTS = smoketest.rb
7 LOG_COMPILER = $(OSX_SIP_HACK_ENV) $(RUBY)
8 AM_LOG_FLAGS = -I.libs -I'$(srcdir)'
10 installcheck-local:
11         $(MAKE) check AM_LOG_FLAGS=
13 SWIG_GENERATED = xapian_wrap.cc xapian_wrap.h
15 EXTRA_DIST = ruby.i extra.i docs/index.rst $(TESTS) \
16         $(SWIG_GENERATED)
18 BUILT_SOURCES = $(SWIG_GENERATED)
20 rubylibdir = $(RUBY_LIB)
21 dist_rubylib_DATA = xapian.rb
23 rubylibarchdir = $(RUBY_LIB_ARCH)
24 rubylibarch_LTLIBRARIES = _xapian.la
26 # Remove the .la file - _xapian.la is never linked against (it's a module)
27 # and Ruby doesn't use libltdl.  Note that the library gets installed by
28 # install-data, so that's where we need to hook.
29 install-data-hook:
30         rm -f $(DESTDIR)$(rubylibarchdir)/_xapian.la
32 AM_CPPFLAGS = -I$(RUBY_INC) -I$(RUBY_INC_ARCH)
33 AM_CXXFLAGS = @SWIG_CXXFLAGS@ $(XAPIAN_CXXFLAGS)
34 _xapian_la_LDFLAGS = -avoid-version -module -shrext ".$(RUBY_DLEXT)" $(NO_UNDEFINED)
35 _xapian_la_SOURCES = xapian_wrap.cc xapian_wrap.h
36 _xapian_la_LIBADD = $(XAPIAN_LIBS) $(RUBY_LIBS)
38 CLEANFILES =
39 if MAINTAINER_MODE
40 stamp = xapian_wrap.stamp
41 RUN_SWIG = stamp='$(stamp)' $(PERL) '$(top_srcdir)'/swig-depcomp $(SWIG)
43 xapian_wrap.cc xapian_wrap.h: $(stamp)
44         $(make_many_locked)
45 $(stamp):
46         $(multitarget_begin)
47         $(RUN_SWIG) $(SWIG_WERROR) -I'$(srcdir)' $(SWIG_FLAGS) -c++ \
48             -initname _xapian -ruby \
49             -o xapian_wrap.cc '$(srcdir)/'ruby.i
50         ## Fix code to avoid GCC -Wconversion-null warnings.  This was fixed
51         ## in SWIG git master after SWIG 3.0.12.
52         ##
53         ## Also support Ruby 2.7 - fixed in SWIG git master after SWIG 4.0.1.
54         $(PERL) -pi -e 's/\b(rb_funcall\(.*, )NULL(\);)/$$1Qnil$$2/; s!^(#include <ruby)(\.h>\n)!$$1$$2$$1/version$$2!; if (/SWIG_TRACKINGS/) {$$_.="#endif\n"; print "#if RUBY_API_VERSION_CODE >= 20700\n  rb_define_virtual_variable(\"SWIG_TRACKINGS_COUNT\", swig_ruby_trackings_count, (rb_gvar_setter_t*)NULL);\n#else\n"}' \
55             xapian_wrap.cc
56         $(multitarget_end)
58 -include xapian_wrap.d
60 CLEANFILES += $(stamp)
61 endif
62 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
64 # Compatibility wrapper which configure creates when required.
65 DISTCLEANFILES = rubyio.h
67 exampledatadir = $(docdir)/ruby/examples
68 dist_exampledata_DATA = \
69         docs/examples/simpleexpand.rb \
70         docs/examples/simpleindex.rb \
71         docs/examples/simplematchdecider.rb \
72         docs/examples/simplesearch.rb
74 install-data-local:
75         $(mkinstalldirs) $(DESTDIR)$(docdatadir)
76         ## In a VPATH build, install files from srcdir first.  Use
77         ## $(abs_builddir) because we need to cd there having already
78         ## changed directory.
79         @paths=docs ; \
80           test '$(abs_srcdir)' = '$(abs_builddir)' || paths='$(srcdir)/docs $(abs_builddir)/docs' ; \
81           for docs in $$paths ; do \
82             cd "$$docs" && for dir in `find rdocs -type d -print` ; do \
83               echo " $(mkinstalldirs) '$(DESTDIR)$(docdatadir)/$$dir'"; \
84               $(mkinstalldirs) "$(DESTDIR)$(docdatadir)/$$dir"; \
85             done && for f in `find rdocs -type f -print` ; do \
86               echo " $(INSTALL_DATA) '$$f' '$(DESTDIR)$(docdatadir)/$$f'"; \
87               $(INSTALL_DATA) "$$f" "$(DESTDIR)$(docdatadir)/$$f"; \
88             done ; \
89           done
91 uninstall-local:
92         ## Because we don't install the .la file, "make uninstall" doesn't work
93         ## and we need to remove the file ourselves.
94         rm -f $(DESTDIR)$(rubylibarchdir)/_xapian.$(RUBY_DLEXT)
95         @paths=docs ; \
96           test '$(abs_srcdir)' = '$(abs_builddir)' || paths='$(srcdir)/docs $(abs_builddir)/docs' ; \
97           for docs in $$paths ; do \
98             cd "$$docs" && for f in `find rdocs -type f -print` ; do \
99               echo " rm -f '$(DESTDIR)$(docdatadir)/$$f'"; \
100               rm -f "$(DESTDIR)$(docdatadir)/$$f"; \
101             done; \
102           done
104 docdatadir = $(docdir)/ruby
105 dist_docdata_DATA = docs/index.html
107 EXTRA_DIST += generate-rdoc-stubs docs/xapian.rb
109 BUILT_SOURCES += docs/rdocs/index.html
111 docs/rdocs/index.html: docs/xapian.rb
112         rm -rf docs/rdocs
113         $(MKDIR_P) docs
114         cd docs && $(RDOC) --op rdocs `test -f xapian.rb||echo '$(abs_srcdir)/docs/'`xapian.rb
116 if DOCUMENTATION_RULES
117 docs/xapian.rb: generate-rdoc-stubs xapian.rb ../doxygen-xml/index.xml
118         $(PERL) $(srcdir)/generate-rdoc-stubs
120 BUILT_SOURCES += docs/index.html
122 .rst.html:
123         -case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; $(MKDIR_P) "$$d" ;; esac
124         $(RST2HTML) --exit-status=warning $< $@
126 CLEANFILES += docs/xapian.rb
127 endif