1 #######################################################################
2 # $Id: Makefile.in 11602 2009-08-17 01:10:04Z wsfulton $
3 #######################################################################
5 .PHONY: ccache source swig
8 exec_prefix = @exec_prefix@
10 datarootdir = @datarootdir@
12 ##############################################################################
13 # Compiler and system configuration
14 ##############################################################################
19 ENABLE_CCACHE = @ENABLE_CCACHE@
21 TARGET = $(TARGET_NOEXE)@EXEEXT@
26 swig: libfiles source ccache
29 @cd $(SOURCE) && $(MAKE)
32 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE))
34 libfiles: $(srcdir)/Lib/swigwarn.swg
36 # Files required just for the tarball
38 @cd $(SOURCE) && $(MAKE) CParse/parser.h
40 #####################################################################
42 #####################################################################
44 docs: docs-main docs-ccache
48 @test -d $(DOCS) || exit 0; cd $(DOCS) && $(MAKE) all clean-baks
51 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) docs)
53 #####################################################################
54 # All the languages SWIG speaks (when it wants to)
55 #####################################################################
57 skip-tcl = test -n "@SKIP_TCL@"
58 skip-perl5 = test -n "@SKIP_PERL5@"
59 skip-python = test -n "@SKIP_PYTHON@"
60 skip-java = test -n "@SKIP_JAVA@"
61 skip-guilescm = test -n "@SKIP_GUILESCM@"
62 skip-guile = test -n "@SKIP_GUILE@"
63 skip-mzscheme = test -n "@SKIP_MZSCHEME@"
64 skip-ruby = test -n "@SKIP_RUBY@"
65 skip-php = test -n "@SKIP_PHP@"
66 skip-ocaml = test -n "@SKIP_OCAML@"
67 skip-octave = test -n "@SKIP_OCTAVE@"
68 skip-pike = test -n "@SKIP_PIKE@"
69 skip-chicken = test -n "@SKIP_CHICKEN@"
70 skip-csharp = test -n "@SKIP_CSHARP@"
71 skip-modula3 = test -n "@SKIP_MODULA3@"
72 skip-lua = test -n "@SKIP_LUA@"
73 skip-allegrocl = test -n "@SKIP_ALLEGROCL@"
74 skip-clisp = test -n "@SKIP_CLISP@"
75 skip-cffi = test -n "@SKIP_CFFI@"
76 skip-uffi = test -n "@SKIP_UFFI@"
77 skip-r = test -n "@SKIP_R@"
79 # Additional dependencies for some tests
80 skip-gcj = test -n "@SKIP_GCJ@"
82 #####################################################################
84 #####################################################################
89 chk-set-swiglib = SWIG_LIB=@ROOT_DIR@/Lib
90 chk-set-swig = SWIG=@ROOT_DIR@/$(TARGET)
91 chk-set-env = $(chk-set-swiglib) $(chk-set-swig)
97 @$(skip-tcl) || ./$(TARGET) -tcl -help
98 @$(skip-perl5) || ./$(TARGET) -perl -help
99 @$(skip-python) || ./$(TARGET) -python -help
100 @$(skip-java) || ./$(TARGET) -java -help
101 @$(skip-guile) || ./$(TARGET) -guile -help
102 @$(skip-mzscheme) || ./$(TARGET) -mzscheme -help
103 @$(skip-ruby) || ./$(TARGET) -ruby -help
104 @$(skip-ocaml) || ./$(TARGET) -ocaml -help
105 @$(skip-octave) || ./$(TARGET) -octave -help
106 @$(skip-php) || ./$(TARGET) -php -help
107 @$(skip-pike) || ./$(TARGET) -pike -help
108 @$(skip-chicken) || ./$(TARGET) -chicken -help
109 @$(skip-csharp) || ./$(TARGET) -csharp -help
110 @$(skip-modula3) || ./$(TARGET) -modula3 -help
111 @$(skip-lua) || ./$(TARGET) -lua -help
112 @$(skip-r) || ./$(TARGET) -r -help
115 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) check)
117 # Checks examples for compilation (does not run them)
120 check-perl5-examples \
121 check-python-examples \
122 check-java-examples \
123 check-guile-examples \
124 check-mzscheme-examples \
125 check-ruby-examples \
126 check-ocaml-examples \
127 check-octave-examples \
129 check-pike-examples \
130 check-chicken-examples \
131 check-csharp-examples \
132 check-modula3-examples \
134 check-allegrocl-examples \
135 check-clisp-examples \
136 check-uffi-examples \
137 check-cffi-examples \
140 tcl_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/tcl/check.list)
141 perl5_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/perl5/check.list)
142 python_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/python/check.list)
143 java_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/java/check.list)
144 guile_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/guile/check.list)
145 mzscheme_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/mzscheme/check.list)
146 ruby_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/ruby/check.list)
147 ocaml_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/ocaml/check.list)
148 octave_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/octave/check.list)
149 php_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/php/check.list)
150 pike_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/pike/check.list)
151 chicken_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/chicken/check.list)
152 csharp_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/csharp/check.list)
153 modula3_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/modula3/check.list)
154 lua_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/lua/check.list)
155 allegrocl_examples :=
159 r_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/r/check.list)
163 @if test -z "$(skip-$*)"; then \
167 @if $(skip-$*); then \
168 echo skipping $* $(ACTION); \
170 $(MAKE) -k -s $($*_examples:=.actionexample) LANGUAGE=$* ACTION=$(ACTION); \
175 @echo $(ACTION)ing Examples/$(LANGUAGE)/$*
176 @(cd Examples/$(LANGUAGE)/$* && $(MAKE) -s $(chk-set-env) $(ACTION))
178 # gcj individual example
180 @if $(skip-gcj); then \
181 echo "skipping Examples/$(LANGUAGE)/java $(ACTION) (gcj test)"; \
183 echo $(ACTION)ing Examples/$(LANGUAGE)/java; \
184 (cd Examples/$(LANGUAGE)/java && $(MAKE) -s $(chk-set-env) $(ACTION)) \
188 @echo $(ACTION)ing Examples/GIFPlot/Lib
189 @cd Examples/GIFPlot/Lib && $(MAKE) -k -s $(ACTION)
193 check-perl5-gifplot \
194 check-python-gifplot \
196 check-guile-gifplot \
197 check-mzscheme-gifplot \
199 check-ocaml-gifplot \
200 check-octave-gifplot \
203 check-chicken-gifplot \
204 # check-lua-gifplot \
205 # check-csharp-gifplot \
206 # check-modula3-gifplot
208 check-%-gifplot: gifplot-library
209 @if test -z "$(skip-$*)"; then \
214 up=`$(srcdir)/Tools/capitalize $*`; \
215 dir="Examples/GIFPlot/$$up"; \
216 if $(skip-$*); then \
217 echo skipping $$up $(ACTION); \
218 elif [ ! -f $$dir/check.list ]; then \
219 echo skipping $$up $(ACTION) "(no $$dir/check.list)"; \
221 all=`sed '/^#/d' $$dir/check.list`; \
223 echo $(ACTION)ing $$dir/$$a; \
225 $(MAKE) -k -s $(chk-set-env) $(ACTION)) \
231 # Checks testcases in the test-suite excluding those which are known to be broken
233 check-tcl-test-suite \
234 check-perl5-test-suite \
235 check-python-test-suite \
236 check-java-test-suite \
237 check-guilescm-test-suite \
238 check-guile-test-suite \
239 check-mzscheme-test-suite \
240 check-ruby-test-suite \
241 check-ocaml-test-suite \
242 check-octave-test-suite \
243 check-php-test-suite \
244 check-pike-test-suite \
245 check-csharp-test-suite \
246 check-modula3-test-suite \
247 check-lua-test-suite \
248 check-allegrocl-test-suite \
249 check-clisp-test-suite \
250 check-uffi-test-suite \
251 check-cffi-test-suite \
252 check-chicken-test-suite \
256 @if test -z "$(skip-$*)"; then \
261 dir="Examples/test-suite/$*"; \
262 if $(skip-$*) -a "$(NOSKIP)" != "1"; then \
263 echo skipping $* test-suite $(ACTION); \
264 elif [ ! -d $$dir ]; then \
265 echo warning: cannot $(ACTION) $* test-suite "(no dir $$dir)";\
267 echo $(ACTION)ing $* test-suite; \
268 (cd $$dir && $(MAKE) -k -s $(ACTION)) \
273 # Partial test-suite check - it only invokes SWIG, ie no compilation and no runtime testing
274 partialcheck-test-suite:
275 @$(MAKE) -k -s check-test-suite ACTION=partialcheck NOSKIP=1
277 partialcheck-%-test-suite:
278 @$(MAKE) -k -s check-$*-test-suite ACTION=partialcheck NOSKIP=1
280 check: check-aliveness check-ccache check-examples check-gifplot check-test-suite
282 # Run known-to-be-broken as well as not broken testcases in the test-suite
285 all-perl5-test-suite \
286 all-python-test-suite \
287 all-java-test-suite \
288 all-guilescm-test-suite \
289 all-guile-test-suite \
290 all-mzscheme-test-suite \
291 all-ruby-test-suite \
292 all-ocaml-test-suite \
293 all-octave-test-suite \
295 all-pike-test-suite \
296 all-csharp-test-suite \
297 all-modula3-test-suite \
299 all-allegrocl-test-suite \
300 all-clisp-test-suite \
301 all-uffi-test-suite \
302 all-cffi-test-suite \
303 all-chicken-test-suite \
307 @$(MAKE) -k -s check-$*-test-suite ACTION=all
309 # Run known-to-be-broken testcases in the test-suite
311 broken-tcl-test-suite \
312 broken-perl5-test-suite \
313 broken-python-test-suite \
314 broken-java-test-suite \
315 broken-guilescm-test-suite \
316 broken-guile-test-suite \
317 broken-mzscheme-test-suite \
318 broken-ruby-test-suite \
319 broken-ocaml-test-suite \
320 broken-octave-test-suite \
321 broken-php-test-suite \
322 broken-pike-test-suite \
323 broken-csharp-test-suite \
324 broken-modula3-test-suite \
325 broken-lua-test-suite \
326 broken-allegrocl-test-suite \
327 broken-clisp-test-suite \
328 broken-uffi-test-suite \
329 broken-cffi-test-suite \
330 broken-chicken-test-suite \
334 @$(MAKE) -k -s check-$*-test-suite ACTION=broken
336 #####################################################################
338 #####################################################################
340 clean: clean-objects clean-libfiles clean-examples clean-gifplot clean-test-suite clean-docs
342 clean-objects: clean-source clean-ccache
345 @echo cleaning Source
346 @cd $(SOURCE) && $(MAKE) -s clean
350 @rm -f $(srcdir)/Lib/swigwarn.swg
353 @$(MAKE) -k -s check-examples ACTION=clean
356 @$(MAKE) -k -s check-gifplot ACTION=clean
359 @$(MAKE) -k -s check-test-suite ACTION=clean NOSKIP=1
362 @$(MAKE) -k -s check-$*-examples ACTION=clean
365 @$(MAKE) -k -s check-$*-test-suite ACTION=clean NOSKIP=1
368 @$(MAKE) -k -s check-$*-gifplot ACTION=clean
371 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) -s clean)
373 clean-docs: clean-docs-main clean-docs-ccache
377 @test -d $(DOCS) || exit 0; cd $(DOCS) && $(MAKE) clean
380 @# Use distclean-docs-ccache, else a user requires the yodl tools to generate the docs after a clean
382 maintainer-clean: clean-libfiles
383 @cd $(SOURCE) && $(MAKE) maintainer-clean
385 #####################################################################
387 #####################################################################
389 DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool
391 distclean: distclean-objects clean-examples clean-gifplot distclean-test-suite clean-docs distclean-dead distclean-ccache
393 distclean-objects: distclean-source
396 @echo distcleaning Source
397 @cd $(SOURCE) && $(MAKE) -s distclean
400 distclean-test-suite:
401 @echo distcleaning Examples/test-suite
402 @$(MAKE) -k -s check-test-suite ACTION=distclean NOSKIP=1
405 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) -s distclean)
407 distclean-docs-ccache:
408 @test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) distclean-docs)
411 rm -f $(DISTCLEAN-DEAD)
413 #####################################################################
414 # Update the Lib/swigwarn.swg file
415 # Note: Generated into the source tree rather than build tree
416 #####################################################################
418 $(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
420 echo "/* Automatically generated file containing all the swig warning codes. */" > $@
421 echo "/* Do not modify this file by hand, change 'Source/Include/swigwarn.h' */" >> $@
422 echo "/* and use the command 'make Lib/swigwarn.swg' instead. */" >> $@
423 echo >> $@; echo >> $@
424 awk '/#define WARN/{$$1="%define"; $$2="SWIG"$$2; $$3=sprintf("%d %%enddef", $$3); print $$0; next;}\
425 /#/{next;} {print $0}' < $? >> $@
427 #####################################################################
428 # TARGETS: install & friends
429 #####################################################################
431 INSTALL = @abs_srcdir@/Tools/config/install-sh -c
432 INSTALL_DATA = ${INSTALL} -m 644
433 INSTALL_PROGRAM = ${INSTALL} -m 755
434 MKINSTDIRS = @abs_srcdir@/Tools/config/install-sh -m 0755 -d
435 # Use standard autoconf approach to transform executable name using --program-prefix and --program-suffix
436 transform = @program_transform_name@
438 install: install-main install-lib install-ccache
439 @echo "Installation complete"
442 @echo "Installing SWIG executable"
443 @$(MKINSTDIRS) $(DESTDIR)$(BIN_DIR)
444 @echo "Installing $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@"
445 @$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@
447 lib-languages = gcj typemaps tcl perl5 python guile java mzscheme ruby php ocaml octave \
448 pike chicken csharp modula3 allegrocl clisp lua cffi uffi r
454 @echo "Installing the SWIG library"
455 @$(MKINSTDIRS) $(DESTDIR)$(SWIG_LIB)
456 @for file in $(srcdir)/Lib/*.i $(srcdir)/Lib/*.swg ; do \
457 i=`basename $$file` ; \
458 echo "Installing $(DESTDIR)$(SWIG_LIB)/$$i"; \
459 $(INSTALL_DATA) $$file $(DESTDIR)$(SWIG_LIB)/$$i; \
461 @for lang in $(lib-languages) $(lib-modules); \
463 echo "Installing language specific files for $$lang"; \
464 dst=$(DESTDIR)$(SWIG_LIB)/$$lang; \
465 $(MKINSTDIRS) $$dst; \
466 (doti="`cd $(srcdir)/Lib/$$lang && ls *.i 2>/dev/null || echo ''`"; \
467 dotswg="`cd $(srcdir)/Lib/$$lang && ls *.swg 2>/dev/null || echo ''`"; \
468 if [ -f $(srcdir)/Lib/$$lang/extra-install.list ]; then \
469 extra="`sed '/^#/d' $(srcdir)/Lib/$$lang/extra-install.list`"; \
471 files="`echo $$doti $$dotswg $$extra`"; \
472 if [ x"$$files" = x ]; then \
473 echo "Installing nothing from Lib/$$lang"; \
474 else for file in $$doti $$dotswg $$extra; \
476 echo "Installing $$dst/$$file"; \
477 $(INSTALL_DATA) $(srcdir)/Lib/$$lang/$$file $$dst/$$file; \
483 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) install)
486 #####################################################################
487 # TARGETS: uninstall & friends
488 #####################################################################
490 uninstall: uninstall-main uninstall-lib uninstall-ccache
491 @echo "Uninstall complete"
494 @echo "Uninstalling SWIG executable $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@"
495 rm -f $(DESTDIR)$(BIN_DIR)/`echo $(TARGET_NOEXE) | sed '$(transform)'`@EXEEXT@
498 @echo "Uninstalling the SWIG library"
499 rm -rf $(DESTDIR)$(SWIG_LIB)/
502 test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) uninstall)
504 ############################################################################
505 # DIST and other maintenance
506 ############################################################################
508 # distribution directory
509 dd = @PACKAGE_NAME@-@PACKAGE_VERSION@
510 srpm = @PACKAGE_NAME@-@PACKAGE_VERSION@
513 @echo "not implemented"
517 rm -fr $(srpm) $(srpm).src.rpm
518 echo "TODO: update to use svn instead of cvs"
519 cvs export -d $(srpm) -r HEAD SWIG
521 tar -cf - $(srpm) | gzip --best > $(srpm).tar.gz
523 rpmbuild -ts $(srpm).tar.gz
525 # Update the autoconf files for detecting host/targets. Automake will do this in
526 # version 1.10 for our case of not having a top level Makefile.am. Until then we
527 # can fetch them manually and will have to commit them to CVS.
529 wget ftp://ftp.gnu.org/pub/gnu/config/config.guess -O Tools/config/config.guess
530 chmod a+x Tools/config/config.guess
531 wget ftp://ftp.gnu.org/pub/gnu/config/config.sub -O Tools/config/config.sub
532 chmod a+x Tools/config/config.sub
534 # Regenerate Makefile if Makefile.in or config.status have changed.
535 Makefile: $(srcdir)/Makefile.in config.status
536 $(SHELL) ./config.status
538 # This target is usually called from Source/Makefile when configure.in has
540 am--refresh: $(srcdir)/configure
542 $(srcdir)/configure: $(srcdir)/configure.in
543 @echo "Build system is out of date. If the following commands fail, please reconfigure by hand (rerun: ./autogen.sh && ./configure)"
544 cd $(srcdir) && ./autogen.sh
545 $(SHELL) ./config.status --recheck