https://github.com/kwwette/swiglal
Tip revision: 2718b7452e6edd700723be6eeba2ae51d1af047e authored by Karl Wette on 01 December 2011, 10:20:46 UTC
whitespace cleanup of swiglal-common.i
whitespace cleanup of swiglal-common.i
Tip revision: 2718b74
swig-common.am
# common SWIG language build makefile
# Author: Karl Wette, 2011
if SWIG_BUILD
### variables ###
# SWIG source and build directory
swig_srcdir = $(top_srcdir)/swig
swig_builddir = $(top_builddir)/swig
# the library SWIG wrappings are being generated for
swig_lib = $(PACKAGE_NAME)
# name of the output SWIG wrapping module
swig_wrapname = swig$(swig_lib)
# name of the SWIG interface file
swig_ifacename = swig-$(swig_lib)
swig_ifacefile = $(swig_builddir)/$(swig_ifacename).i
# SWIG interface file dependencies file
swig_iface_deps = .$(swig_ifacename).deps
# name of the SWIG wrapping code
swig_wrapfile = $(swig_wrapname).cpp
# SWIG interface file preamble
swig_iface_pre = $(swig_srcdir)/$(swig_ifacename).swg
# SWIG interface header include files
swig_iface_headers = $(wildcard $(swig_builddir)/swig-iface-header-*.swg)
# path where SWIG should look for SWIG interface / LAL header files
swig_inclpath = \
$(swig_srcdir) \
$(top_builddir)/include \
$(wildcard $(sort $(SWIG_INCLPATH)))
# script which checks headers for correct use of SWIGLAL macros
swig_check_headers = $(swig_srcdir)/swig-check-headers.pl
# SWIG wrapping module dependencies
swig_wrap_depends = $(swig_wrapfile)
# symbols to define when compiling SWIG wrapping code
swig_defines = $(SWIG_CXX_DEFINES) $(subst -D,,$(DEFS))
# path where SWIG should look for LAL libraries while linking
swig_libpath = $(wildcard $(sort $(SWIG_PREINST_LIBPATH) $(SWIG_LIBPATH)))
# directory where LAL libraries will eventually be installed
swig_libdir = $(libdir)
# libraries that SWIG wrapping code should link against
swig_libs = $(sort lal lalsupport $(swig_lib))
# build colon-separated path by repeated concatenation
swig_makepath = $(if $(word 2,$1),$(word 1,$1):$(call swig_makepath,$(wordlist 2,$(words $1),$1)),$(word 1,$1))
# name of the test script for the SWIG wrapping module
swig_wrapcheck = $(srcdir)/check-$(swig_wrapname)
# set library load path when running check scripts prior to installation
swig_ldlibpath = $(call swig_makepath,$(SWIG_PREINST_LIBPATH))
# installation location for SWIG interface headers
swigincludedir = $(includedir)/lal
# installed SWIG interface headers
EXTRA_HEADERS =
nodist_swiginclude_HEADERS = $(swig_ifacefile)
swiginclude_HEADERS = $(SWIG_HEADERS)
# extra distribution files
EXTRA_DIST = \
$(swig_check_headers) \
$(swig_iface_pre)
# cleanup
CLEANFILES = \
$(swig_wrapfile) \
$(swig_ifacefile) \
$(swig_iface_deps)
# export variables to SWIG wrapping module build script
export build_vendor
export PACKAGE_NAME
export PACKAGE_VERSION
export swig_wrapname
export swig_defines
export swig_inclpath
export swig_libpath
export swig_libdir
export swig_libs
export swig_wrapfile
### rules ###
# build SWIG wrapping module
all : $(swig_wrap)
# build SWIG interface file
$(swig_ifacefile) : $(swig_iface_pre) $(swig_iface_headers)
@cat $+ > $@
# generate dummy dependencies file
$(swig_iface_deps) : $(swig_ifacefile)
@echo "#$(swig_iface_deps)" > $@
include $(swig_iface_deps)
# create links to SWIG interface headers
.PHONY : swig-header-links
swig-header-links :
@for file in $(nodist_swiginclude_HEADERS) $(swiginclude_HEADERS); do \
basename=`echo "/$$file" | $(SED) 's|^.*/\([^/]*\)$$|\1|'`; \
srcdir=`cd $(top_srcdir)/$(subdir) && pwd`; \
builddir=`cd $(top_builddir)/$(subdir) && pwd`; \
incldir=`cd $(top_builddir)/include/lal && pwd`; \
if test ! -r $$incldir/$$basename; then \
rm -f $$incldir/$$basename; \
if test -f $$srcdir/$$file; then \
$(LN_S) $$srcdir/$$file $$incldir; \
elif test -f $$builddir/$$file; then \
$(LN_S) $$builddir/$$file $$incldir; \
fi; \
fi; \
done
# generate SWIG wrapping code
$(swig_wrapfile) : $(swig_iface_deps) $(swig_check_headers)
@$(MAKE) swig-header-links
CPP='$(CPP)' $(PERL) $(swig_check_headers) \
--include $(top_builddir)/include --interface $(swig_ifacefile)
$(SWIG) $(addprefix -D,$(SWIG_SWIG_DEFINES)) \
-module $(swig_wrapname) -$(swig_language) -c++ $(swig_language_opts) \
-MD -MF $(swig_iface_deps) -MT $(swig_wrapfile) \
$(addprefix -I,$(swig_inclpath)) \
-o $(swig_wrapfile) $(swig_ifacefile)
# test SWIG wrapping module
.PHONY : swig-check
check : swig-check
# install SWIG wrapping module
.PHONY : swig-install
install-exec-local : swig-install
# uninstall SWIG wrapping module
.PHONY : swig-uninstall
uninstall-local : swig-uninstall
else # !SWIG_BUILD
# dummy targets
.PHONY : swig-check
swig-check :
.PHONY : swig-install
swig-install :
.PHONY : swig-uninstall
swig-uninstall :
endif # SWIG_BUILD