help-make
[Top][All Lists]
Advanced

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

Re: make and swig


From: Philip Guenther
Subject: Re: make and swig
Date: Tue, 16 Sep 2008 09:47:28 -0700

On Tue, Sep 16, 2008 at 4:41 AM, Boris Godin <address@hidden> wrote:
> OUTPUT_DIR = ...
> INPUT_DIR  = ...
>
> $(OUTPUT_DIR)/%.py : $(INPUT_DIR)/%.i
>    swig -cxx -python $< -o $@

It's been a long while since I've used swig, but that doesn't appear
correct to me.  The file named by the -o option is the C or C++ output
file.  IIRC, the scripting-language-specific output is placed in the
same directory as the C/C++ output, but with a different suffix, so
that rule will result in the two output files colliding, no?

Digging out the swig docs, it looks like the rule should be written ala:

%_wrap.cxx %.py: %.i
        swig -cxx -python -o ${@:.py=_wrap.cxx} $<

(That uses "${@:.py=_wrap.cxx}" instead of just "$@" so that it'll
work regardless of whether it's triggered by make needing to build the
.cxx file or the .py file.)

You can add directories to the patterns in that rule, but if the
%_wrap.cxx and %.py targets will be in different directories then you
need to add the -outdir option to the swig command line.


Philip Guenther




reply via email to

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