import source from 1.3.40
[external/swig.git] / Makefile.in
1 #######################################################################
2 # $Id: Makefile.in 11602 2009-08-17 01:10:04Z wsfulton $
3 #######################################################################
4
5 .PHONY: ccache source swig
6
7 prefix      = @prefix@
8 exec_prefix = @exec_prefix@
9 srcdir      = @srcdir@
10 datarootdir = @datarootdir@
11
12 ##############################################################################
13 # Compiler and system configuration
14 ##############################################################################
15
16 SHELL       = /bin/sh
17 SWIG_LIB    = @swig_lib@
18 BIN_DIR     = @bindir@
19 ENABLE_CCACHE = @ENABLE_CCACHE@
20 TARGET_NOEXE= swig
21 TARGET      = $(TARGET_NOEXE)@EXEEXT@
22 SOURCE      = Source
23 CCACHE      = CCache
24 DOCS        = Doc/Manual
25
26 swig: libfiles source ccache
27
28 source:
29         @cd $(SOURCE) && $(MAKE)
30
31 ccache:
32         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE))
33
34 libfiles: $(srcdir)/Lib/swigwarn.swg
35
36 # Files required just for the tarball
37 maintainer: libfiles
38         @cd $(SOURCE) && $(MAKE) CParse/parser.h
39
40 #####################################################################
41 # Documentation
42 #####################################################################
43
44 docs: docs-main docs-ccache
45
46 docs-main:
47         @echo making docs
48         @test -d $(DOCS) || exit 0; cd $(DOCS) && $(MAKE) all clean-baks
49
50 docs-ccache:
51         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) docs)
52
53 #####################################################################
54 # All the languages SWIG speaks (when it wants to)
55 #####################################################################
56
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@"
78
79 # Additional dependencies for some tests
80 skip-gcj        = test -n "@SKIP_GCJ@"
81
82 #####################################################################
83 # CHECK
84 #####################################################################
85
86 ACTION = check
87 NOSKIP =
88
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)
92
93 check-aliveness:
94         test -x ./$(TARGET)
95         ./$(TARGET) -version
96         ./$(TARGET) -help
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
113
114 check-ccache:
115         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) check)
116
117 # Checks examples for compilation (does not run them)
118 check-examples:                                 \
119         check-tcl-examples                      \
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                   \
128         check-php-examples                      \
129         check-pike-examples                     \
130         check-chicken-examples                  \
131         check-csharp-examples                   \
132         check-modula3-examples                  \
133         check-lua-examples                      \
134         check-allegrocl-examples                \
135         check-clisp-examples                    \
136         check-uffi-examples                     \
137         check-cffi-examples                     \
138         check-r-examples
139
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 :=
156 clisp_examples     :=
157 uffi_examples      :=
158 cffi_examples      :=
159 r_examples         :=$(shell sed '/^\#/d' $(srcdir)/Examples/r/check.list)
160
161 # all examples
162 check-%-examples :
163         @if test -z "$(skip-$*)"; then                          \
164           echo $* unknown;                                      \
165           exit 1;                                               \
166         fi
167         @if $(skip-$*); then                                    \
168           echo skipping $* $(ACTION);                           \
169         else                                                    \
170           $(MAKE) -k -s $($*_examples:=.actionexample) LANGUAGE=$* ACTION=$(ACTION); \
171         fi
172
173 # individual example
174 %.actionexample:
175         @echo $(ACTION)ing Examples/$(LANGUAGE)/$*
176         @(cd Examples/$(LANGUAGE)/$* && $(MAKE) -s $(chk-set-env) $(ACTION))
177
178 # gcj individual example
179 java.actionexample:
180         @if $(skip-gcj); then                                   \
181           echo "skipping Examples/$(LANGUAGE)/java $(ACTION) (gcj test)";       \
182         else                                                    \
183           echo $(ACTION)ing Examples/$(LANGUAGE)/java;          \
184           (cd Examples/$(LANGUAGE)/java && $(MAKE) -s $(chk-set-env) $(ACTION)) \
185         fi
186
187 gifplot-library:
188         @echo $(ACTION)ing Examples/GIFPlot/Lib
189         @cd Examples/GIFPlot/Lib && $(MAKE) -k -s $(ACTION)
190
191 check-gifplot:                                  \
192         check-tcl-gifplot                       \
193         check-perl5-gifplot                     \
194         check-python-gifplot                    \
195         check-java-gifplot                      \
196         check-guile-gifplot                     \
197         check-mzscheme-gifplot                  \
198         check-ruby-gifplot                      \
199         check-ocaml-gifplot                     \
200         check-octave-gifplot                    \
201         check-php-gifplot                       \
202         check-pike-gifplot                      \
203         check-chicken-gifplot                   \
204 #       check-lua-gifplot                       \
205 #       check-csharp-gifplot                    \
206 #       check-modula3-gifplot
207
208 check-%-gifplot: gifplot-library
209         @if test -z "$(skip-$*)"; then                          \
210           echo $* unknown;                                      \
211           exit 1;                                               \
212         fi
213         @passed=true;                                           \
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)"; \
220         else                                                    \
221           all=`sed '/^#/d' $$dir/check.list`;                   \
222           for a in $$all; do                                    \
223             echo $(ACTION)ing $$dir/$$a;                        \
224             (cd $$dir/$$a &&                                    \
225             $(MAKE) -k -s $(chk-set-env) $(ACTION))             \
226             || passed=false;                                    \
227           done;                                                 \
228         fi;                                                     \
229         test $$passed = true
230
231 # Checks testcases in the test-suite excluding those which are known to be broken
232 check-test-suite:                               \
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                \
253         check-r-test-suite
254
255 check-%-test-suite:
256         @if test -z "$(skip-$*)"; then                                  \
257           echo $* unknown;                                              \
258           exit 1;                                                       \
259         fi
260         @passed=true;                                                   \
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)";\
266         else                                                            \
267           echo $(ACTION)ing $* test-suite;                              \
268           (cd $$dir && $(MAKE) -k -s $(ACTION))                         \
269           || passed=false;                                              \
270         fi;                                                             \
271         test $$passed = true
272
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
276
277 partialcheck-%-test-suite:
278         @$(MAKE) -k -s check-$*-test-suite ACTION=partialcheck NOSKIP=1
279
280 check: check-aliveness check-ccache check-examples check-gifplot check-test-suite
281
282 # Run known-to-be-broken as well as not broken testcases in the test-suite
283 all-test-suite:                                 \
284         all-tcl-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                   \
294         all-php-test-suite                      \
295         all-pike-test-suite                     \
296         all-csharp-test-suite                   \
297         all-modula3-test-suite                  \
298         all-lua-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                  \
304         all-r-test-suite
305
306 all-%-test-suite:
307         @$(MAKE) -k -s check-$*-test-suite ACTION=all
308
309 # Run known-to-be-broken testcases in the test-suite
310 broken-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               \
331         broken-r-test-suite
332
333 broken-%-test-suite:
334         @$(MAKE) -k -s check-$*-test-suite ACTION=broken
335
336 #####################################################################
337 # CLEAN
338 #####################################################################
339
340 clean: clean-objects clean-libfiles clean-examples clean-gifplot clean-test-suite clean-docs
341
342 clean-objects: clean-source clean-ccache
343
344 clean-source:
345         @echo cleaning Source
346         @cd $(SOURCE) && $(MAKE) -s clean
347         @rm -f $(TARGET)
348
349 clean-libfiles:
350         @rm -f $(srcdir)/Lib/swigwarn.swg
351
352 clean-examples:
353         @$(MAKE) -k -s check-examples ACTION=clean
354
355 clean-gifplot:
356         @$(MAKE) -k -s check-gifplot ACTION=clean
357
358 clean-test-suite:
359         @$(MAKE) -k -s check-test-suite ACTION=clean NOSKIP=1
360
361 clean-%-examples:
362         @$(MAKE) -k -s check-$*-examples ACTION=clean
363
364 clean-%-test-suite:
365         @$(MAKE) -k -s check-$*-test-suite ACTION=clean NOSKIP=1
366
367 clean-%-gifplot:
368         @$(MAKE) -k -s check-$*-gifplot ACTION=clean
369
370 clean-ccache:
371         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) -s clean)
372
373 clean-docs: clean-docs-main clean-docs-ccache
374
375 clean-docs-main:
376         @echo cleaning Docs
377         @test -d $(DOCS) || exit 0; cd $(DOCS) && $(MAKE) clean
378
379 clean-docs-ccache:
380         @# Use distclean-docs-ccache, else a user requires the yodl tools to generate the docs after a clean
381
382 maintainer-clean: clean-libfiles
383         @cd $(SOURCE) && $(MAKE) maintainer-clean
384
385 #####################################################################
386 # DISTCLEAN
387 #####################################################################
388
389 DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool
390
391 distclean: distclean-objects clean-examples clean-gifplot distclean-test-suite clean-docs distclean-dead distclean-ccache
392
393 distclean-objects: distclean-source
394
395 distclean-source:
396         @echo distcleaning Source
397         @cd $(SOURCE) && $(MAKE) -s distclean
398         @rm -f $(TARGET)
399
400 distclean-test-suite:
401         @echo distcleaning Examples/test-suite
402         @$(MAKE) -k -s check-test-suite ACTION=distclean NOSKIP=1
403
404 distclean-ccache:
405         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) -s distclean)
406
407 distclean-docs-ccache:
408         @test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) distclean-docs)
409
410 distclean-dead:
411         rm -f $(DISTCLEAN-DEAD)
412
413 #####################################################################
414 # Update the Lib/swigwarn.swg file
415 # Note: Generated into the source tree rather than build tree
416 #####################################################################
417
418 $(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
419         mkdir -p Lib
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}' < $? >> $@
426
427 #####################################################################
428 # TARGETS: install & friends
429 #####################################################################
430
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@
437
438 install: install-main install-lib install-ccache
439         @echo "Installation complete"
440
441 install-main:
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@
446
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
449
450 lib-modules = std
451
452
453 install-lib: 
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;   \
460             done;
461         @for lang in $(lib-languages) $(lib-modules);           \
462             do                                                  \
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`";        \
470               fi;                                               \
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;         \
475                   do                                            \
476                   echo "Installing $$dst/$$file";               \
477                   $(INSTALL_DATA) $(srcdir)/Lib/$$lang/$$file $$dst/$$file; \
478                   done;                                         \
479               fi) ;                                             \
480         done
481
482 install-ccache:
483         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) install)
484
485
486 #####################################################################
487 # TARGETS: uninstall & friends
488 #####################################################################
489
490 uninstall: uninstall-main uninstall-lib uninstall-ccache
491         @echo "Uninstall complete"
492
493 uninstall-main:
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@
496
497 uninstall-lib:
498         @echo "Uninstalling the SWIG library"
499         rm -rf $(DESTDIR)$(SWIG_LIB)/
500
501 uninstall-ccache:
502         test -z "$(ENABLE_CCACHE)" || (cd $(CCACHE) && $(MAKE) uninstall)
503
504 ############################################################################
505 # DIST and other maintenance
506 ############################################################################
507
508 # distribution directory
509 dd = @PACKAGE_NAME@-@PACKAGE_VERSION@
510 srpm = @PACKAGE_NAME@-@PACKAGE_VERSION@
511
512 dist:
513         @echo "not implemented"
514         false
515
516 srcrpm:
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
520         cp swig.spec $(srpm)
521         tar -cf - $(srpm) | gzip --best > $(srpm).tar.gz
522         rm -fr $(srpm)
523         rpmbuild -ts $(srpm).tar.gz
524
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.
528 configfiles:
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
533
534 # Regenerate Makefile if Makefile.in or config.status have changed.
535 Makefile: $(srcdir)/Makefile.in config.status
536         $(SHELL) ./config.status
537
538 # This target is usually called from Source/Makefile when configure.in has
539 # changed.
540 am--refresh: $(srcdir)/configure
541
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
546
547 # Makefile ends here