[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Distributing BUILT_SOURCES dependencies and not target

From: Alexandre Duret-Lutz
Subject: Re: Distributing BUILT_SOURCES dependencies and not target
Date: Sun, 08 Aug 2004 00:48:48 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

>>> "Xavier" == Xavier Décoret <address@hidden> writes:

 Xavier> Hi,
 Xavier> I am compiling a project with a swig generated file. Swig is a tool
 Xavier> that takes a foo.i file and generates a foo_wrap.cxx (it can do more
 Xavier> but no our concerne here ;-)).

 Xavier> In my, I put:

 Xavier> line 1: foo_wrap.cxx: foo.i
 Xavier> line 2:     $SWIG -c++ -python foo.i
 Xavier> line 3:
 Xavier> line 4: BUILT_SOURCES: foo_wrap.cxx
 Xavier> line 5: libfoo.la_SOURCES: foo_wrap.cxx
 Xavier> line 6:
 Xavier> line 7: dist_data_DATA: foo.i

This should be something like

foo_wrap.cxx: $(srcdir)/foo.i
        $(SWIG) -c++ -python -o $@ $(srcdir)/foo.i

whereveryouwantitinstalled_LTLIBRARIES =
nodist_libfoo_la_SOURCES = foo_wrap.cxx
CLEANFILES = $(nodist_libfoo_la_SOURCES)
EXTRA_DIST = foo.i

if you want foo_wrap.cxx to be rebuilt on the user-side and not
distributed, or something like
$(srcdir)/foo_wrap.cxx: $(srcdir)/foo.i
        $(SWIG) -c++ -python $(srcdir)/foo.i

whereveryouwantitinstalled_LTLIBRARIES =
libfoo_la_SOURCES = $(srcdir)/foo_wrap.cxx
MAINTAINERCLEANFILES = $(srcdir)/foo_wrap.cxx
EXTRA_DIST = foo.i

if you want to distribute foo_wrap.cxx so users do not need to
have SWIG installed.

BUILT_SOURCE is not needed here since foo_wrap.cxx is an
explicit dependency of

Here is a more concrete setup I'm using to build two
interdependent Python modules using SWIG and Libtool.  I decided
to distribute the SWIG wrapper sources so as not to require SWIG
on the build host.

| AM_CPPFLAGS = -I$(PYTHONINC) -I$(top_srcdir)/src $(BUDDY_CPPFLAGS)
| EXTRA_DIST = spot.i buddy.i
| python_PYTHON = $(srcdir)/ $(srcdir)/
| pyexec_LTLIBRARIES =
| libspotswigpy_la_SOURCES = libpy.c
| libspotswigpy_la_CFLAGS = -DSWIG_GLOBAL
| libspotswigpy_la_LDFLAGS = -avoid-version
| _spot_la_SOURCES = $(srcdir)/spot_wrap.cxx
| _spot_la_LDFLAGS = -avoid-version -module
| _spot_la_LIBADD = $(top_builddir)/src/
| $(srcdir)/spot_wrap.cxx: $(srcdir)/spot.i
|       swig -noruntime -c++ -python -I$(srcdir) -I$(top_srcdir)/src 
| $(srcdir)/ $(srcdir)/spot.i
|       $(MAKE) $(AM_MAKEFLAGS) spot_wrap.cxx
| _buddy_la_SOURCES = $(srcdir)/buddy_wrap.cxx
| _buddy_la_LDFLAGS = -avoid-version -module $(BUDDY_LDFLAGS)
| _buddy_la_LIBADD =
| $(srcdir)/buddy_wrap.cxx: $(srcdir)/buddy.i
|       swig -noruntime -c++ -python $(BUDDY_CPPFLAGS) $(srcdir)/buddy.i
| $(srcdir)/ $(srcdir)/buddy.i
|       $(MAKE) $(AM_MAKEFLAGS) buddy_wrap.cxx
|   $(srcdir)/spot_wrap.cxx $(srcdir)/ \
|   $(srcdir)/buddy_wrap.cxx $(srcdir)/

 Xavier> First question: I put line 7 because I want the .i file to be
 Xavier> distributed so people can re-generate the .cxx file with their own
 Xavier> version of swig ($SWIG is set by a m4 command SWIG_PROG in
 Xavier> Is this the correct way to do it. It seems make dist
 Xavier> produce tarballs with the file in it som I am happy.

`dist_data_DATA = foo.i' also means to install foo.i in $(datadir)/; I don't
think you want that.  Use EXTRA_DIST.

 Xavier> Second question: The problem is that foo_wrap.cxx gets distributed
 Xavier> too. And since it is always more recent that .i file after I ran
 Xavier> make. I don't have the expected behaviour. Downloaders of the lib
 Xavier> won't get the foo_wrap.cxx regenerated. How do I remove this file from
 Xavier> the dist.

*_SOURCES are distributed by default, and you should use
nodist_*_SOURCES otherwise.

 Xavier> Third question: with this, make dist produce a tarball
 Xavier> that I can install, compile, etc... but make distcheck complains that
 Xavier> it cannot find foo.i!! But it *is* in the tarball?!? I don't get at
 Xavier> all what's happening here.

It cannot find foo.i in the build directory because it is in the
source directory.
Alexandre Duret-Lutz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]