/[ascend]/trunk/pygtk/interface/Makefile.in
ViewVC logotype

Contents of /trunk/pygtk/interface/Makefile.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 377 - (show annotations) (download)
Wed Mar 15 11:27:22 2006 UTC (14 years, 4 months ago) by johnpye
File size: 6012 byte(s)
By default, no xterm console colour codes are used now.
More output in extfn test python script.
pygtk/interface/Makefile cleans up gcov files when 'make clean'.
1 SOURCE_ROOT = ../..
2
3 CXX = g++
4 CC = gcc
5
6 SO_SUFF = @SO_SUFF@
7 PLATFORM_CPPFLAGS = @PLATFORM_CPPFLAGS@
8
9 COVERAGE_FLAGS = @COVERAGE_FLAGS@
10
11 CXXFLAGS = -c -g $(COVERAGE_FLAGS)
12
13 LD = libtool --mode=link gcc
14 LD_CXX = libtool --mode=link g++
15
16 # -lieee -ldl
17 LDFLAGS = -g -lm -lstdc++ $(COVERAGE_FLAGS)
18
19 # Are you on a dual processor machine?
20 _smp_mflags = -j2
21
22 CLASSES = library type module symchar \
23 instance instanceinterfacedata \
24 method name \
25 reporter simulation set units dimensions extmethod \
26 variable relation \
27 solver curve plot \
28 solverparameters solverparameter solverparameteriterator \
29 solverstatus solverreporter \
30 incidencematrix
31
32 OBJS = $(CLASSES:%=%.o)
33 HDRS = $(CLASSES:%=%.h)
34
35 all:
36 @echo "SO SUFF: $(SO_SUFF)"
37 @echo "OS TYPE: $(OSTYPE)"
38
39 ASCEND_CPPFLAGS = -I../../base/generic -I../../base/generic/solver -I../../base/generic/compiler -I../../base/generic/utilities -I../../base/generic/general -I../../base/generic/packages
40
41 #-------------------------
42 # Linking with ASCEND
43
44 USE_JAM_LIBS = 1
45
46 ARDIR = $(SOURCE_ROOT)/base/autotools/archive
47 ASC_BUILD_LIBS = cd $(SOURCE_ROOT)/base/autotools; make libs
48
49 # Libs now are named the same way on both autotools and jam builds...
50 ASC_LIBS_STEM = compiler packages solver utilities general
51 ASC_LIBS = $(ASC_LIBS_STEM:%=$(ARDIR)/libasc%.a)
52
53 $(ASC_LIBS): libs
54
55 .PHONY: libs
56
57 libs:
58 @echo $(ASC_LIBS)
59 $(ASC_BUILD_LIBS)
60
61 #------------------
62 # PYTHON STUFF
63
64 USE_PYTHON := 1
65
66 ifeq ($(USE_PYTHON),1)
67 ifeq ($(OSTYPE),msys)
68 PYTHON_VERSION := 24
69 PYTHON_ROOT := /c/Python$(PYTHON_VERSION)
70 PYTHON_CPPFLAGS := -I$(PYTHON_ROOT)/include
71 PYTHON_LDFLAGS := -L$(PYTHON_ROOT)/libs -lpython$(PYTHON_VERSION)
72 else
73 ifeq ($(TERM),cygwin)
74 PYTHON_VERSION := 24
75 PYTHON_ROOT := /cygdrive/c/Python$(PYTHON_VERSION)
76 PYTHON_CPPFLAGS := -I$(PYTHON_ROOT)/include
77 PYTHON_LDFLAGS := -L$(PYTHON_ROOT)/libs -lpython24
78 else
79 PYTHON_VERSION := $(shell python -V 2>&1 | sed s/Python\ // | sed s/^\\\([0-9][0-9]*\\.[0-9][0-9]*\\\).*/\\1/ )
80 PYTHON_CPPFLAGS := -I/usr/include/python$(PYTHON_VERSION)
81 PYTHON_LDFLAGS := -lpython$(PYTHON_VERSION)
82 endif
83 endif
84 endif
85
86 ifeq ($(USE_PYTHON),1)
87 ASCXX_CPPFLAGS := $(ASCEND_CPPFLAGS) $(PYTHON_CPPFLAGS) -DASCXX_USE_PYTHON
88 ASCXX_PYTHON_LDFLAGS := $(PYTHON_LDFLAGS)
89 else
90 ASCXX_CPPFLAGS := $(ASCEND_CPPFLAGS)
91 ASCXX_PYTHON_LDFLAGS :=
92 endif
93
94 clean:
95 -rm *$(SO_SUFF) *.so *.dll
96 -rm *.o
97 -rm *_wrap.cxx
98 -rm *_wrap.c
99 -rm *_wrap.o
100 -rm ascend.py
101 -rm main
102 -rm *.pyc
103 -rm *.gcno
104 -rm *.gcda
105 -rmdir .libs
106
107 cleanall: clean
108 cd $(SOURCE_ROOT)/jam; \
109 jam clean;
110
111
112 #------------------------
113 # SWIG targets
114
115 SWIG_MODULE = ascend
116
117 ifeq ($(OSTYPE),msys)
118 SWIG=~/swigwin-1.3.28/swig
119 SWIG_LIB = $(shell $(SWIG) -swiglib)
120 SWIG_VERSION = $(shell $(SWIG) -version | grep "^SWIG Version " | sed s/SWIG\ Version\ \\\([0-9][0-9]*\\\(\\.[0-9][0-9]*\\\)*\\\).*/\\1/)
121 SWIG_INCLUDES = -I$(SWIG_LIB)
122 else
123 SWIG=swig
124 SWIG_VERSION = $(shell $(SWIG) -version | grep "^SWIG Version " | sed s/SWIG\ Version\ \\\([0-9][0-9]*\\\(\\.[0-9][0-9]*\\\)*\\\).*/\\1/)
125 SWIG_INCLUDES =
126 endif
127
128 # optimize for SWIG 1.3.28 and newer
129 SWIG_MAJOR = $(shell echo $(SWIG_VERSION) | sed s/^\\\([0-9]*\\\).*/\\1/)
130 SWIG_MINOR = $(shell echo $(SWIG_VERSION) | sed s/^[0-9]*\\.\\\([0-9]*\\\).*/\\1/)
131 SWIG_PATCH = $(shell echo $(SWIG_VERSION) | sed s/^[0-9]*\\.[0-9]*\\.\\\([0-9]*\\\).*/\\1/)
132
133 SWIG_FEATURES =
134 ifeq ($(SWIG_MAJOR),1)
135 ifeq ($(SWIG_MINOR),3)
136 ifeq ($(shell test $(SWIG_PATCH) -ge 28 && echo 1),1)
137 SWIG_FEATURES="-O"
138 endif
139 endif
140 endif
141
142 SWIGFLAGS = -c++ -python $(SWIG_INCLUDES)
143 SWIG_CFLAGS = -c -fPIC
144 SWIG_CPPFLAGS = $(ASCXX_CPPFLAGS) $(PLATFORM_CPPFLAGS)
145
146 SWIG_OBJS = $(SWIG_MODULE:%=%_wrap.o)
147 SWIG_PY = $(SWIG_MODULE:%=%.py)
148
149 LIB = _ascend$(SO_SUFF)
150
151 all: $(LIB)
152
153 SWIGS = plot.i solver.i
154
155 # FIXME add ' $(ASC_LIBS)' to deps once Jam build is fixed:
156 %_wrap.cxx %.py: %.i $(SWIGS) $(HDRS)
157 @echo "SWIG = $(SWIG), VERSION = $(SWIG_VERSION)"
158 SWIG_FEATURES=$(SWIG_FEATURES) $(SWIG) $(SWIGFLAGS) $<
159
160 .precious: $(SWIG_MODULE:%=%_wrap.cxx)
161 .precious: _ascend$(SO_SUFF)
162
163 %_wrap.o: %_wrap.cxx
164 $(CC) $(SWIG_CFLAGS) -o $@ $^ $(SWIG_CPPFLAGS)
165
166 $(LIB): $(ASC_LIBS) $(OBJS) $(SWIG_OBJS) $(SWIG_PY)
167 @echo "OS TYPE = $(OSTYPE)"
168 @echo "SO_SUFF = $(SO_SUFF)"
169 @echo "CREATING LIBRARY FILE '$(LIB)'"
170 $(LD) -module -shared -o $@ $(ASC_LIBS) $(OBJS) $(SWIG_OBJS) $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
171
172
173 #--------------------------
174 # Pure C++ tests (no swigging required)
175
176 CPPFLAGS := $(ASCXX_CPPFLAGS) $(PLATFORM_CPPFLAGS)
177
178 main: main.o $(OBJS) $(ASC_LIBS)
179 $(LD) -o $@ $^ $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
180
181 #------------------------
182 # Trying to debug this GDPITA '3' problem, bug #178
183
184 testsolverinit.o: testsolverinit.cpp
185 $(CXX) -c $(CPPFLAGS) $(CFLAGS) -o $@ $^
186
187 testsolverinit: testsolverinit.o $(OBJS) $(ASC_LIBS)
188 $(LD) -o $@ $^ $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
189
190
191 #------------------------
192 # Trying to fix implementation of external functions
193
194 testextfn.o: testextfn.cpp
195 $(CXX) -c $(CPPFLAGS) $(CFLAGS) -o $@ $^
196
197 testextfn: testextfn.o $(OBJS) $(ASC_LIBS)
198 $(LD) -o $@ $^ $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
199
200
201 #------------------------
202 # Testing the Python module
203
204 test: $(LIB)
205 # @echo "Does module include 'do_solve_eval' symbol?"
206 # nm $(LIB) | grep "do_solve_eval" | egrep -v "U"
207 # @echo "Does module include 'system_build' symbol?"
208 # nm $(LIB) | grep "system_build" | egrep -v "U"
209 @echo "Can python load the $(LIB) file?"
210 python -c "import _ascend"
211 python librarytest.py
212
213
214 #--------------------------
215 # tarfile
216
217 tar: clean
218 pushd $(SOURCE_ROOT) && \
219 tar jcvf pygtk.tar.bz2 pygtk/ && \
220 popd
221 mv ../../pygtk.tar.bz2 .
222
223 #--------------------------
224 # storing a patch
225
226 patch: clean
227 pushd $(SOURCE_ROOT)/base && \
228 svn diff > ../pygtk/interface/ascend-base.patch && \
229 popd
230 pushd $(SOURCE_ROOT)/tcltk98 && \
231 svn diff > ../pygtk/interface/ascend-tcltk98.patch && \
232 popd
233
234 #---------------------------
235 patchapplybase: clean
236 pushd $(SOURCE_ROOT)/base && \
237 patch -p0 < ../pygtk/interface/ascend-base.patch && \
238 popd
239

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22