summaryrefslogtreecommitdiff
path: root/Source/Makefile.am
blob: 095c5d4ea32492d03a717c3bbe59118acb9e895b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
## Process this file with automake to produce Makefile.in

# subdir-objects generates object files using the directory structure of the source files.
AUTOMAKE_OPTIONS = foreign nostdinc subdir-objects 1.7.2

SOURCE_DIR=$(top_srcdir)/Source
BUILD_SOURCE_DIR=$(top_builddir)/Source

AM_CPPFLAGS =	-I$(BUILD_SOURCE_DIR)/Include	\
		-I$(BUILD_SOURCE_DIR)/CParse	\
		-I$(SOURCE_DIR)/Include		\
		-I$(SOURCE_DIR)/DOH		\
		-I$(SOURCE_DIR)/CParse		\
		-I$(SOURCE_DIR)/Doxygen		\
		-I$(SOURCE_DIR)/Preprocessor	\
		-I$(SOURCE_DIR)/Swig		\
		-I$(SOURCE_DIR)/Modules

AM_CXXFLAGS =

AM_YFLAGS = -d

BUILT_SOURCES = CParse/parser.h
eswig_SOURCES =	CParse/cscanner.c		\
		CParse/parser.y			\
		CParse/templ.c			\
		CParse/util.c			\
		DOH/base.c			\
		DOH/file.c			\
		DOH/fio.c			\
		DOH/hash.c			\
		DOH/list.c			\
		DOH/memory.c			\
		DOH/string.c			\
		DOH/void.c			\
		Doxygen/doxyentity.cxx		\
		Doxygen/doxyentity.h		\
		Doxygen/doxyparser.cxx		\
		Doxygen/doxyparser.h		\
		Doxygen/doxytranslator.cxx	\
		Doxygen/doxytranslator.h	\
		Doxygen/javadoc.cxx		\
		Doxygen/javadoc.h		\
		Doxygen/pydoc.cxx		\
		Doxygen/pydoc.h			\
		Modules/allocate.cxx		\
		Modules/contract.cxx		\
		Modules/csharp.cxx		\
		Modules/d.cxx			\
		Modules/directors.cxx		\
		Modules/emit.cxx		\
		Modules/go.cxx			\
		Modules/guile.cxx		\
		Modules/interface.cxx		\
		Modules/java.cxx		\
		Modules/javascript.cxx		\
		Modules/lang.cxx		\
		Modules/lua.cxx			\
		Modules/main.cxx		\
		Modules/mzscheme.cxx		\
		Modules/nested.cxx		\
		Modules/ocaml.cxx		\
		Modules/octave.cxx		\
		Modules/overload.cxx		\
		Modules/perl5.cxx		\
		Modules/php.cxx			\
		Modules/python.cxx		\
		Modules/r.cxx			\
		Modules/ruby.cxx		\
		Modules/scilab.cxx		\
		Modules/swigmain.cxx		\
		Modules/tcl8.cxx		\
		Modules/typepass.cxx		\
		Modules/utils.cxx		\
		Modules/xml.cxx			\
		Preprocessor/cpp.c		\
		Preprocessor/expr.c		\
		Swig/cwrap.c			\
		Swig/deprecate.c		\
		Swig/error.c			\
		Swig/extend.c			\
		Swig/fragment.c			\
		Swig/getopt.c			\
		Swig/include.c			\
		Swig/misc.c			\
		Swig/naming.c			\
		Swig/parms.c			\
		Swig/scanner.c			\
		Swig/stype.c			\
		Swig/symbol.c			\
		Swig/tree.c			\
		Swig/typemap.c			\
		Swig/typeobj.c			\
		Swig/typesys.c			\
		Swig/wrapfunc.c

bin_PROGRAMS = eswig

# Override the link stage to avoid using Libtool
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@

# The executable is copied to the root directory for installation and running the test-suite.
# This occurs on each invocation of make and is a step towards providing support for multiple
# build directories.
all-local: eswig@EXEEXT@
	cp -f $(top_builddir)/Source/eswig@EXEEXT@ $(top_builddir)/swig@EXEEXT@

clean-local:
	rm -f $(top_builddir)/swig@EXEEXT@
	rm -f core @EXTRA_CLEAN@

distclean-local:
	rm -f $(top_builddir)/Source/Include/swigconfig.h
	rm -f $(top_builddir)/Source/Include/stamp-h1

# Beautify the code.
# Note that this works well on C code, but does some odd joining of lines for C++ code.
# Compiling with -DNDEBUG and no optimisations will allow one to do a binary diff of the
# swig executable as a way of checking before and after the 'beautifying'.
# Single files can be beautified with the beautify-file target, eg: 'make beautify-file INDENTFILE=chosenfile.c'

SWIGTYPEDEFS=-T bool -T File -T DohObjInfo -T Parm -T Language -T List -T TargetLanguageModule -T Typetab -T ModuleFactory -T ErrorMessageFormat -T Symtab -T Hash -T Scanner -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 DOHObj_or_char -T DOHFile -T DOHString -T DOHString_or_char -T UpcallData
INDENTBAKSDIR=../IndentBaks

beautify:
	rm -rf $(INDENTBAKSDIR)
	mkdir $(INDENTBAKSDIR)
	mkdir $(INDENTBAKSDIR)/CParse
	mkdir $(INDENTBAKSDIR)/DOH
	mkdir $(INDENTBAKSDIR)/Modules
	mkdir $(INDENTBAKSDIR)/Preprocessor
	mkdir $(INDENTBAKSDIR)/Swig
	mkdir $(INDENTBAKSDIR)/Include
	(csources=`find . -name "*.c"` && \
	hsources=`find . -name "*.h"` && \
	cxxsources=`find . -name "*.cxx"` && \
	for file in $$csources $$hsources $$cxxsources; do \
	  $(MAKE) beautify-file INDENTFILE=$$file; \
	done; )

beautify-file:
	test -e $(INDENTBAKSDIR) || (echo $(INDENTBAKSDIR) directory does not exist && exit 1;)
	test -n "$(INDENTFILE)" || (echo INDENTFILE not defined && exit 1;)
	test -e $(INDENTFILE) || (echo File does not exist: $(INDENTFILE) && exit 1;)
	cp $(INDENTFILE) $(INDENTBAKSDIR)/$(INDENTFILE);
	indent -kr --honour-newlines --line-length160 --indent-level2 --braces-on-func-def-line --leave-optional-blank-lines $(SWIGTYPEDEFS) $(INDENTFILE) -o $(INDENTFILE).tmp;
	cat $(INDENTFILE).tmp | sed -e 's/const const /const /' > $(INDENTFILE);
	rm $(INDENTFILE).tmp;