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

Contents of /trunk/pygtk/interface/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

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