swig/Makefile.in
2006-07-01 02:19:50 +00:00

478 lines
15 KiB
Makefile

#######################################################################
# $Header$
#######################################################################
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
datarootdir = @datarootdir@
##############################################################################
# Compiler and system configuration
##############################################################################
SHELL = /bin/sh
SWIG_LIB = @swig_lib@
BIN_DIR = @bindir@
TARGET_NOEXE= swig
TARGET = $(TARGET_NOEXE)@EXEEXT@
SOURCE = Source
DOCS = Doc/Manual
swig: libfiles source
source:
@cd $(SOURCE) && $(MAKE)
libfiles: Lib/swigwarn.swg
.PHONY: source libfiles
#####################################################################
# All the languages SWIG speaks (when it wants to)
#####################################################################
skip-tcl = test -n "@SKIP_TCL@"
skip-perl5 = test -n "@SKIP_PERL5@"
skip-python = test -n "@SKIP_PYTHON@"
skip-java = test -n "@SKIP_JAVA@"
skip-guilescm = test -n "@SKIP_GUILESCM@"
skip-guile = test -n "@SKIP_GUILE@"
skip-mzscheme = test -n "@SKIP_MZSCHEME@"
skip-ruby = test -n "@SKIP_RUBY@"
skip-php4 = test -n "@SKIP_PHP4@"
skip-ocaml = test -n "@SKIP_OCAML@"
skip-pike = test -n "@SKIP_PIKE@"
skip-chicken = test -n "@SKIP_CHICKEN@"
skip-csharp = test -n "@SKIP_CSHARP@"
skip-modula3 = test -n "@SKIP_MODULA3@"
skip-lua = test -n "@SKIP_LUA@"
skip-allegrocl = test -n "@SKIP_ALLEGROCL@"
skip-clisp = test -n "@SKIP_CLISP@"
skip-cffi = test -n "@SKIP_CFFI@"
skip-uffi = test -n "@SKIP_UFFI@"
skip-r = test -n "@SKIP_R@"
# Additional dependencies for some tests
skip-gcj = test -n "@SKIP_GCJ@"
#####################################################################
# CHECK
#####################################################################
ACTION = check
chk-set-swiglib = SWIG_LIB=@ROOT_DIR@/Lib
chk-set-swig = SWIG=@ROOT_DIR@/$(TARGET)
chk-set-env = $(chk-set-swiglib) $(chk-set-swig)
chk = $(MAKE) -k -s $(chk-set-env) $(ACTION)
check-aliveness:
test -x ./$(TARGET)
./$(TARGET) -version
./$(TARGET) -help
@$(skip-tcl) || ./$(TARGET) -tcl -help
@$(skip-perl5) || ./$(TARGET) -perl -help
@$(skip-python) || ./$(TARGET) -python -help
@$(skip-java) || ./$(TARGET) -java -help
@$(skip-guile) || ./$(TARGET) -guile -help
@$(skip-mzscheme) || ./$(TARGET) -mzscheme -help
@$(skip-ruby) || ./$(TARGET) -ruby -help
@$(skip-ocaml) || ./$(TARGET) -ocaml -help
@$(skip-php4) || ./$(TARGET) -php4 -help
@$(skip-pike) || ./$(TARGET) -pike -help
@$(skip-chicken) || ./$(TARGET) -chicken -help
@$(skip-csharp) || ./$(TARGET) -csharp -help
@$(skip-modula3) || ./$(TARGET) -modula3 -help
@$(skip-lua) || ./$(TARGET) -lua -help
@$(skip-r) || ./$(TARGET) -r -help
# Checks examples for compilation (does not run them)
check-examples: \
check-tcl-examples \
check-perl5-examples \
check-python-examples \
check-java-examples \
check-guile-examples \
check-mzscheme-examples \
check-ruby-examples \
check-ocaml-examples \
check-php4-examples \
check-pike-examples \
check-chicken-examples \
check-csharp-examples \
check-modula3-examples \
check-lua-examples \
check-allegrocl-examples \
check-clisp-examples \
check-uffi-examples \
check-cffi-examples \
check-r-examples
check-%-examples:
@passed=true; \
dir="Examples/$*"; \
if $(skip-$*); then \
echo skipping $* $(ACTION); \
elif [ ! -f $$dir/check.list ]; then \
echo skipping $* $(ACTION) "(no $$dir/check.list)"; \
else \
all=`sed '/^#/d' $$dir/check.list`; \
for a in $$all; do \
if $(skip-gcj) && test $$a = "java"; then \
echo "skipping $* $$dir/$$a $(ACTION) (gcj test)";\
else \
echo $(ACTION)ing $$dir/$$a; \
(cd $$dir/$$a && $(chk)) \
|| passed=false; \
fi; \
done; \
fi; \
test $$passed = true
gifplot-library:
@echo $(ACTION)ing Examples/GIFPlot/Lib
@cd Examples/GIFPlot/Lib && $(MAKE) -k -s $(ACTION)
check-gifplot: \
check-tcl-gifplot \
check-perl5-gifplot \
check-python-gifplot \
check-java-gifplot \
check-guile-gifplot \
check-mzscheme-gifplot \
check-ruby-gifplot \
check-ocaml-gifplot \
check-php4-gifplot \
check-pike-gifplot \
check-chicken-gifplot \
# check-lua-gifplot \
# check-csharp-gifplot \
# check-modula3-gifplot
check-%-gifplot: gifplot-library
@passed=true; \
up=`$(srcdir)/Tools/capitalize $*`; \
dir="Examples/GIFPlot/$$up"; \
if $(skip-$*); then \
echo skipping $$up $(ACTION); \
elif [ ! -f $$dir/check.list ]; then \
echo skipping $$up $(ACTION) "(no $$dir/check.list)"; \
else \
all=`sed '/^#/d' $$dir/check.list`; \
for a in $$all; do \
echo $(ACTION)ing $$dir/$$a; \
(cd $$dir/$$a && $(chk)) \
|| passed=false; \
done; \
fi; \
test $$passed = true
# Checks testcases in the test-suite excluding those which are known to be broken
check-test-suite: \
check-tcl-test-suite \
check-perl5-test-suite \
check-python-test-suite \
check-java-test-suite \
check-guilescm-test-suite \
check-guile-test-suite \
check-mzscheme-test-suite \
check-ruby-test-suite \
check-ocaml-test-suite \
check-php4-test-suite \
check-pike-test-suite \
check-csharp-test-suite \
check-modula3-test-suite \
check-lua-test-suite \
check-allegrocl-test-suite \
check-clisp-test-suite \
check-uffi-test-suite \
check-cffi-test-suite \
check-chicken-test-suite \
check-r-test-suite
check-%-test-suite:
@passed=true; \
dir="Examples/test-suite/$*"; \
if $(skip-$*); then \
echo skipping $* test-suite $(ACTION); \
elif [ ! -d $$dir ]; then \
echo warning: cannot $(ACTION) $* test-suite "(no dir $$dir)";\
else \
echo $(ACTION)ing $* test-suite; \
(cd $$dir && $(MAKE) -k -s $(ACTION)) \
|| passed=false; \
fi; \
test $$passed = true
check: check-aliveness check-examples check-gifplot check-test-suite
# Run known-to-be-broken as well as not broken testcases in the test-suite
all-test-suite: \
all-tcl-test-suite \
all-perl5-test-suite \
all-python-test-suite \
all-java-test-suite \
all-guilescm-test-suite \
all-guile-test-suite \
all-mzscheme-test-suite \
all-ruby-test-suite \
all-ocaml-test-suite \
all-php4-test-suite \
all-pike-test-suite \
all-csharp-test-suite \
all-modula3-test-suite \
all-lua-test-suite \
all-allegrocl-test-suite \
all-clisp-test-suite \
all-uffi-test-suite \
all-cffi-test-suite \
all-chicken-test-suite \
all-r-test-suite
all-%-test-suite:
@$(MAKE) -k -s check-$*-test-suite ACTION=all
# Run known-to-be-broken testcases in the test-suite
broken-test-suite: \
broken-tcl-test-suite \
broken-perl5-test-suite \
broken-python-test-suite \
broken-java-test-suite \
broken-guilescm-test-suite \
broken-guile-test-suite \
broken-mzscheme-test-suite \
broken-ruby-test-suite \
broken-ocaml-test-suite \
broken-php4-test-suite \
broken-pike-test-suite \
broken-csharp-test-suite \
broken-modula3-test-suite \
broken-lua-test-suite \
broken-allegrocl-test-suite \
broken-clisp-test-suite \
broken-uffi-test-suite \
broken-cffi-test-suite \
broken-chicken-test-suite \
broken-r-test-suite
broken-%-test-suite:
@$(MAKE) -k -s check-$*-test-suite ACTION=broken
#####################################################################
# CLEAN
#####################################################################
clean: clean-objects clean-libfiles clean-examples clean-gifplot clean-test-suite clean-docs
clean-objects: clean-source
clean-source:
@echo cleaning Source
@cd $(SOURCE) && $(MAKE) -s clean
@rm -f $(TARGET)
clean-libfiles:
@rm -f Lib/swigwarn.swg
clean-examples:
@$(MAKE) -k -s check-examples ACTION=clean
clean-gifplot:
@$(MAKE) -k -s check-gifplot ACTION=clean
clean-test-suite:
@$(MAKE) -k -s check-test-suite ACTION=clean
clean-%-examples:
@$(MAKE) -k -s check-$*-examples ACTION=clean
clean-%-test-suite:
@$(MAKE) -k -s check-$*-test-suite ACTION=clean
clean-%-gifplot:
@$(MAKE) -k -s check-$*-gifplot ACTION=clean
clean-docs:
@echo cleaning Docs
@cd $(DOCS) && $(MAKE) -s clean
#####################################################################
# DISTCLEAN
#####################################################################
DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool
distclean: distclean-objects clean-examples clean-gifplot distclean-test-suite clean-docs distclean-dead
distclean-objects: distclean-source
distclean-source:
@echo dist cleaning Source
@cd $(SOURCE) && $(MAKE) -s distclean
@rm -f $(TARGET)
distclean-test-suite:
@echo dist cleaning Examples/test-suite
@$(MAKE) -k -s noskip-test-suite ACTION=distclean
noskip-test-suite: \
noskip-tcl-test-suite \
noskip-perl5-test-suite \
noskip-python-test-suite \
noskip-java-test-suite \
noskip-guilescm-test-suite \
noskip-guile-test-suite \
noskip-mzscheme-test-suite \
noskip-ruby-test-suite \
noskip-ocaml-test-suite \
noskip-php4-test-suite \
noskip-pike-test-suite \
noskip-csharp-test-suite \
noskip-lua-test-suite \
noskip-allegrocl-test-suite \
noskip-clisp-test-suite \
noskip-uffi-test-suite \
noskip-cffi-test-suite \
noskip-chicken-test-suite \
noskip-r-test-suite
noskip-%-test-suite:
dir="Examples/test-suite/$*"; \
if [ ! -d $$dir ]; then \
echo warning: cannot $(ACTION) $* test-suite "(no dir $$dir)";\
else \
(cd $$dir && $(MAKE) -k -s $(ACTION)) \
fi;
distclean-dead:
rm -f $(DISTCLEAN-DEAD)
#####################################################################
# Update the Lib/swigwarn.swg file
#####################################################################
Lib/swigwarn.swg: Source/Include/swigwarn.h
echo "/* Automatically generated file containing all the swig warning codes. */" > $@
echo "/* Do not modify this file by hand, change 'Source/Include/swigwarn.h' */" >> $@
echo "/* and use the command 'make Lib/swigwarn.swg' instead. */" >> $@
echo >> $@; echo >> $@
awk '/#define WARN/{$$1="%define"; $$2="SWIG"$$2; $$3=sprintf("%d %%enddef", $$3); print $$0; next;}\
/#/{next;} {print $0}' < $? >> $@
#####################################################################
# TARGETS: install & friends
#####################################################################
INSTALL = @abs_srcdir@/Tools/config/install-sh -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL} -m 755
MKINSTDIRS = @abs_srcdir@/Tools/config/install-sh -m 0755 -d
# Use standard autoconf approach to transform executable name using --program-prefix and --program-suffix
transform = @program_transform_name@
install: install-main install-lib
@echo "Installation complete"
install-main:
@echo "Installing SWIG executable"
@$(MKINSTDIRS) $(DESTDIR)$(BIN_DIR)
@echo "Installing $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@"
@$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@
lib-languages = gcj typemaps tcl perl5 python guile java mzscheme ruby php4 ocaml \
pike chicken csharp modula3 allegrocl clisp lua cffi uffi r
lib-modules = std
install-lib:
@echo "Installing the SWIG library"
@$(MKINSTDIRS) $(DESTDIR)$(SWIG_LIB)
@for file in $(srcdir)/Lib/*.i $(srcdir)/Lib/*.swg ; do \
i=`basename $$file` ; \
echo "Installing $(DESTDIR)$(SWIG_LIB)/$$i"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(SWIG_LIB)/$$i; \
done;
@for lang in $(lib-languages) $(lib-modules); \
do \
echo "Installing language specific files for $$lang"; \
dst=$(DESTDIR)$(SWIG_LIB)/$$lang; \
$(MKINSTDIRS) $$dst; \
(doti="`cd $(srcdir)/Lib/$$lang && ls *.i 2>/dev/null`" || doti=""; \
dotswg="`cd $(srcdir)/Lib/$$lang && ls *.swg 2>/dev/null`" || dotswg=""; \
if [ -f $(srcdir)/Lib/$$lang/extra-install.list ]; then \
extra="`sed '/^#/d' $(srcdir)/Lib/$$lang/extra-install.list`"; \
fi; \
files="`echo $$doti $$dotswg $$extra`"; \
if [ x"$$files" = x ]; then \
echo "Installing nothing from Lib/$$lang"; \
else for file in $$doti $$dotswg $$extra; \
do \
echo "Installing $$dst/$$file"; \
$(INSTALL_DATA) $(srcdir)/Lib/$$lang/$$file $$dst/$$file; \
done; \
fi) ; \
done
#####################################################################
# TARGETS: uninstall & friends
#####################################################################
uninstall: uninstall-main uninstall-lib
@echo "Uninstall complete"
uninstall-main:
@echo "Uninstalling SWIG executable $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@"
rm -f $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@
uninstall-lib:
@echo "Uninstalling the SWIG library"
rm -rf $(DESTDIR)$(SWIG_LIB)/
############################################################################
# DIST and other maintenance
############################################################################
# distribution directory
dd = @PACKAGE_NAME@-@PACKAGE_VERSION@
srpm = @PACKAGE_NAME@-@PACKAGE_VERSION@
dist:
@echo 'Dave, what do you want to do w/ "make dist"?'
@echo 'See Makefile.in target "dist-suggested" for an idea.'
@echo ' --thi'
false
dist-suggested:
rm -rf $(dd) $(dd).tar.gz
cvs export -d $(dd) -r HEAD SWIG
tar cf - $(dd) | gzip --best > $(dd).tar.gz
rm -rf $(dd)
srcrpm:
rm -fr $(srpm) $(srpm).src.rpm
cvs export -d $(srpm) -r HEAD SWIG
cp swig.spec $(srpm)
tar -cf - $(srpm) | gzip --best > $(srpm).tar.gz
rm -fr $(srpm)
rpmbuild -ts $(srpm).tar.gz
# Update the autoconf files for detecting host/targets. Automake will do this in
# version 1.10 for our case of not having a top level Makefile.am. Until then we
# can fetch them manually and will have to commit them to CVS.
configfiles:
wget ftp://ftp.gnu.org/pub/gnu/config/config.guess -O Tools/config/config.guess
chmod a+x Tools/config/config.guess
wget ftp://ftp.gnu.org/pub/gnu/config/config.sub -O Tools/config/config.sub
chmod a+x Tools/config/config.sub
# This target is usually called from Source/Makefile when configure.in has changed
am--refresh:
@echo "Build system is out of date. Please reconfigure (rerun: ./autogen.sh && ./configure)"
@exit 1
# Makefile ends here