[Xapian-devel] Rules for running SWIG

Richard Boulton richard at lemurconsulting.com
Thu Apr 26 20:12:53 BST 2007


Olly Betts wrote:
> With the new "stamp" rules for running SWIG, things don't seem to get
> rebuilt when I expect them to, e.g.:
> 
> olly at ixion:~/svn/xapian/xapian-bindings/python $ make modern/xapian_wrap.cc
> make: Nothing to be done for `modern/xapian_wrap.cc'.
> olly at ixion:~/svn/xapian/xapian-bindings/python $ ls -l modern/xapian_wrap.cc
> ls: modern/xapian_wrap.cc: No such file or directory
> 
> Problem being that the "stamp" file already exists.  This used to work
> before though...

Ah, I see the problem, though not a nice solution.

My first thought was "how does the .stamp file end up existing when the 
xapian_wrap.cc file doesn't", but I suppose that that could happen in 
various ways.  (The build system should never leave it like that, 
though, as far as I can see.)

I have seen a nasty solution, though, which is attached to this email: 
basically, it adds a rule for generating the xapian_wrap.cc files from 
the .stamp file, which checks if the _wrap.cc files already exist, and 
if not, deletes the stamp file and runs a sub-make to regenerate it.

There must be a nicer way; I'll have a think.

-- 
Richard
-------------- next part --------------
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 8395)
+++ Makefile.am	(working copy)
@@ -62,6 +62,12 @@
 	$(PYTHON) doxy2swig.py ../../xapian-core/docs/apidoc/xml/index.xml doccomments.i
 
 modern/xapian_wrap.cc modern/xapian_wrap.h modern/xapian.py: modern/xapian_wrap.stamp
+	if test ! -e modern/xapian_wrap.cc || \
+	   test ! -e modern/xapian_wrap.h || \
+	   test ! -e modern/xapian.py; \
+	then \
+	    (rm modern/xapian_wrap.stamp && $(MAKE) modern/xapian_wrap.stamp) \
+	fi
 modern/xapian_wrap.stamp: $(SWIG_sources) util.i except.i doccomments.i extra.i extracomments.i
 	test -d modern || mkdir modern
 	$(SWIG) $(SWIG_includes) $(SWIG_FLAGS) -c++ \


More information about the Xapian-devel mailing list