1## Process this file with automake to produce Makefile.in
2
3# subdir-objects generates object files using the directory structure of the source files.
4AUTOMAKE_OPTIONS = foreign nostdinc subdir-objects 1.7.2
5
6SOURCE_DIR=$(top_srcdir)/Source
7BUILD_SOURCE_DIR=$(top_builddir)/Source
8
9SWIG_CXX_DEFS = @SWILL@
10
11AM_CPPFLAGS =	-I$(BUILD_SOURCE_DIR)/Include	\
12		-I$(BUILD_SOURCE_DIR)/CParse	\
13		-I$(SOURCE_DIR)/Include		\
14		-I$(SOURCE_DIR)/DOH		\
15		-I$(SOURCE_DIR)/CParse		\
16		-I$(SOURCE_DIR)/Preprocessor	\
17		-I$(SOURCE_DIR)/Swig		\
18		-I$(SOURCE_DIR)/Modules
19
20AM_CXXFLAGS =	$(SWIG_CXX_DEFS)
21
22AM_YFLAGS = -d
23
24BUILT_SOURCES = CParse/parser.h
25eswig_SOURCES =	CParse/cscanner.c		\
26		CParse/parser.y			\
27		CParse/templ.c			\
28		CParse/util.c			\
29		DOH/base.c			\
30		DOH/file.c			\
31		DOH/fio.c			\
32		DOH/hash.c			\
33		DOH/list.c			\
34		DOH/memory.c			\
35		DOH/string.c			\
36		DOH/void.c			\
37		Modules/allegrocl.cxx		\
38		Modules/allocate.cxx		\
39		Modules/browser.cxx		\
40		Modules/cffi.cxx		\
41		Modules/chicken.cxx		\
42		Modules/clisp.cxx		\
43		Modules/contract.cxx		\
44		Modules/csharp.cxx		\
45		Modules/directors.cxx		\
46		Modules/emit.cxx		\
47		Modules/guile.cxx		\
48		Modules/java.cxx		\
49		Modules/lang.cxx		\
50		Modules/lua.cxx			\
51		Modules/main.cxx		\
52		Modules/modula3.cxx		\
53		Modules/module.cxx		\
54		Modules/mzscheme.cxx		\
55		Modules/ocaml.cxx		\
56		Modules/octave.cxx		\
57		Modules/overload.cxx		\
58		Modules/perl5.cxx		\
59		Modules/php.cxx			\
60		Modules/pike.cxx		\
61		Modules/python.cxx		\
62		Modules/r.cxx			\
63		Modules/ruby.cxx		\
64		Modules/s-exp.cxx		\
65		Modules/swigmain.cxx		\
66		Modules/tcl8.cxx		\
67		Modules/typepass.cxx		\
68		Modules/uffi.cxx		\
69		Modules/utils.cxx		\
70		Modules/xml.cxx			\
71		Preprocessor/cpp.c		\
72		Preprocessor/expr.c		\
73		Swig/cwrap.c			\
74		Swig/deprecate.c		\
75		Swig/error.c			\
76		Swig/fragment.c			\
77		Swig/getopt.c			\
78		Swig/include.c			\
79		Swig/misc.c			\
80		Swig/naming.c			\
81		Swig/parms.c			\
82		Swig/scanner.c			\
83		Swig/stype.c			\
84		Swig/symbol.c			\
85		Swig/tree.c			\
86		Swig/typeobj.c			\
87		Swig/typemap.c			\
88		Swig/typesys.c			\
89		Swig/warn.c			\
90		Swig/wrapfunc.c			
91
92bin_PROGRAMS = eswig
93eswig_LDADD   = @SWIGLIBS@
94
95# Override the link stage to avoid using Libtool
96CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
97
98# The executable is copied to the root directory for installation and running the test-suite.
99# This occurs on each invocation of make and is a step towards providing support for multiple 
100# build directories.
101all-local: eswig@EXEEXT@
102	cp -f $(top_builddir)/Source/eswig@EXEEXT@ $(top_builddir)/swig@EXEEXT@
103
104clean-local:
105	rm -f $(top_builddir)/swig@EXEEXT@
106	rm -f core @EXTRA_CLEAN@
107
108
109# Beautify the code.
110# Note that this works well on C code, but does some odd joining of lines for C++ code.
111# Compiling with -DNDEBUG and no optimisations will allow one to do a binary diff of the
112# swig executable as a way of checking before and after the 'beautifying'.
113# Single files can be beautified with the beautify-file target, eg: 'make beautify-file INDENTFILE=chosenfile.c'
114
115SWIGTYPEDEFS=-T File -T DohObjInfo -T Parm -T Language -T List -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T String -T DohBase -T Node -T String_or_char -T SwigType -T Dispatcher -T Wrapper -T DohStringMethods -T DohFileMethods -T DohListMethods -T DohHashMethods -T DOH -T DohIterator -T ParmList -T FILE -T HashNode -T DOHString_or_char
116INDENTBAKSDIR=../IndentBaks
117
118beautify:
119	rm -rf $(INDENTBAKSDIR)
120	mkdir $(INDENTBAKSDIR)
121	mkdir $(INDENTBAKSDIR)/CParse
122	mkdir $(INDENTBAKSDIR)/DOH
123	mkdir $(INDENTBAKSDIR)/Modules
124	mkdir $(INDENTBAKSDIR)/Preprocessor
125	mkdir $(INDENTBAKSDIR)/Swig
126	mkdir $(INDENTBAKSDIR)/Include
127	(csources=`find . -name "*.c"` && \
128	hsources=`find . -name "*.h"` && \
129	cxxsources=`find . -name "*.cxx"` && \
130	for file in $$csources $$hsources $$cxxsources; do \
131	  $(MAKE) beautify-file INDENTFILE=$$file; \
132	done; )
133
134beautify-file:
135	test -e $(INDENTBAKSDIR) || (echo $(INDENTBAKSDIR) directory does not exist && exit 1;)
136	test -n "$(INDENTFILE)" || (echo INDENTFILE not defined && exit 1;)
137	test -e $(INDENTFILE) || (echo File does not exist: $(INDENTFILE) && exit 1;)
138	cp $(INDENTFILE) $(INDENTBAKSDIR)/$(INDENTFILE);
139	unix2dos $(INDENTFILE)
140	dos2unix $(INDENTFILE)
141	indent -kr --honour-newlines --line-length160 --indent-level2 --braces-on-func-def-line --leave-optional-blank-lines $(SWIGTYPEDEFS) $(INDENTFILE) -o $(INDENTFILE).tmp;
142	cat $(INDENTFILE).tmp | sed -e 's/const const /const /' > $(INDENTFILE);
143	rm $(INDENTFILE).tmp;
144
145