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

Annotation of /trunk/pygtk/interface/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (hide annotations) (download)
Wed Mar 1 00:51:23 2006 UTC (18 years, 4 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 johnpye 132 SOURCE_ROOT = ../..
2    
3     CXX = g++
4 johnpye 190 CC = gcc
5 johnpye 132
6 johnpye 190
7 johnpye 337 ifeq ($(OSTYPE),"msys")
8     PLATFORM_CPPFLAGS =
9     SO_SUFF = .dll
10 johnpye 191 else
11 johnpye 337 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 johnpye 191 endif
19 johnpye 190
20 johnpye 132 CXXFLAGS = -c -g
21    
22 johnpye 190 LD = libtool --mode=link gcc
23     LD_CXX = libtool --mode=link g++
24 johnpye 132
25 johnpye 190 # -lieee -ldl
26 johnpye 337 LDFLAGS = -g -lm -lstdc++
27 johnpye 132
28     # Are you on a dual processor machine?
29     _smp_mflags = -j2
30    
31 johnpye 255 CLASSES = library type module symchar \
32     instance instanceinterfacedata \
33     method name \
34 johnpye 212 reporter simulation set units dimensions extmethod \
35 johnpye 238 variable relation \
36 johnpye 221 solver curve plot \
37 johnpye 233 solverparameters solverparameter solverparameteriterator \
38 johnpye 310 solverstatus solverreporter \
39 johnpye 233 incidencematrix
40 johnpye 175
41 johnpye 132 OBJS = $(CLASSES:%=%.o)
42     HDRS = $(CLASSES:%=%.h)
43    
44     all:
45 johnpye 190 @echo "OS TYPE: $(OSTYPE)"
46 johnpye 132
47 johnpye 143 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 johnpye 132 #-------------------------
50     # Linking with ASCEND
51    
52 johnpye 189 USE_JAM_LIBS = 1
53 johnpye 132
54 johnpye 189 ARDIR = $(SOURCE_ROOT)/base/autotools/archive
55     ASC_BUILD_LIBS = cd $(SOURCE_ROOT)/base/autotools; make libs
56 johnpye 132
57 johnpye 143 # Libs now are named the same way on both autotools and jam builds...
58 johnpye 132 ASC_LIBS_STEM = compiler packages solver utilities general
59 johnpye 143 ASC_LIBS = $(ASC_LIBS_STEM:%=$(ARDIR)/libasc%.a)
60 johnpye 132
61     $(ASC_LIBS): libs
62    
63     .PHONY: libs
64    
65     libs:
66 johnpye 189 @echo $(ASC_LIBS)
67 johnpye 143 $(ASC_BUILD_LIBS)
68 johnpye 132
69     #------------------
70     # PYTHON STUFF
71    
72 johnpye 153 USE_PYTHON := 1
73 johnpye 132
74 johnpye 138 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 johnpye 337 PYTHON_LDFLAGS := -L$(PYTHON_ROOT)/libs -lpython$(PYTHON_VERSION)
80 johnpye 138 else
81 johnpye 190 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 johnpye 138 endif
92     endif
93 johnpye 132
94 johnpye 151 ifeq ($(USE_PYTHON),1)
95 johnpye 132 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 johnpye 190 -rm *$(SO_SUFF)
104 johnpye 132 -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 johnpye 143 cd $(SOURCE_ROOT)/jam; \
115     jam clean;
116 johnpye 132
117     #--------------------------
118     # Pure C++ testing
119    
120 johnpye 190 CPPFLAGS := $(ASCXX_CPPFLAGS) $(PLATFORM_CPPFLAGS)
121 johnpye 132
122     main: main.o $(OBJS) $(ASC_LIBS)
123     $(LD) -o $@ $^ $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
124    
125     #------------------------
126     # SWIG targets
127    
128 johnpye 315
129 johnpye 132 SWIG_MODULE = ascend
130 johnpye 337 SWIG = ~/swigwin-1.3.28/swig
131 johnpye 138
132     ifeq ($(OSTYPE),msys)
133 johnpye 337 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 johnpye 138 else
137 johnpye 315 SWIG_VERSION = $(shell $(SWIG) -version | grep "^SWIG Version " | sed s/SWIG\ Version\ \\\([0-9][0-9]*\\\(\\.[0-9][0-9]*\\\)*\\\).*/\\1/)
138 johnpye 138 SWIG_INCLUDES =
139     endif
140    
141 johnpye 315 # 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 johnpye 138 SWIGFLAGS = -c++ -python $(SWIG_INCLUDES)
156 johnpye 132 SWIG_CFLAGS = -c -fPIC
157 johnpye 190 SWIG_CPPFLAGS = $(ASCXX_CPPFLAGS) $(PLATFORM_CPPFLAGS)
158 johnpye 132
159     SWIG_OBJS = $(SWIG_MODULE:%=%_wrap.o)
160 johnpye 315 SWIG_PY = $(SWIG_MODULE:%=%.py)
161 johnpye 132
162 johnpye 190 LIB = _ascend$(SO_SUFF)
163 johnpye 132
164     all: $(LIB)
165    
166 johnpye 221 SWIGS = plot.i solver.i
167 johnpye 176
168 johnpye 132 # FIXME add ' $(ASC_LIBS)' to deps once Jam build is fixed:
169 johnpye 176 %_wrap.cxx %.py: %.i $(SWIGS) $(HDRS)
170 johnpye 337 @echo "SWIG = $(SWIG), VERSION = $(SWIG_VERSION)"
171 johnpye 315 SWIG_FEATURES=$(SWIG_FEATURES) $(SWIG) $(SWIGFLAGS) $<
172 johnpye 132
173 johnpye 164 .precious: $(SWIG_MODULE:%=%_wrap.cxx)
174 johnpye 337 .precious: _ascend$(SO_SUFF)
175 johnpye 132
176     %_wrap.o: %_wrap.cxx
177     $(CC) $(SWIG_CFLAGS) -o $@ $^ $(SWIG_CPPFLAGS)
178    
179 johnpye 315 $(LIB): $(ASC_LIBS) $(OBJS) $(SWIG_OBJS) $(SWIG_PY)
180 johnpye 337 @echo "OS TYPE = $(OSTYPE)"
181     @echo "SO_SUFF = $(SO_SUFF)"
182     @echo "CREATING LIBRARY FILE '$(LIB)'"
183 johnpye 315 $(LD) -module -shared -o $@ $(ASC_LIBS) $(OBJS) $(SWIG_OBJS) $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
184 johnpye 132
185     #------------------------
186 johnpye 151 # 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 johnpye 153 $(LD) -o $@ $^ $(LDFLAGS) $(ASCXX_PYTHON_LDFLAGS)
193 johnpye 151
194    
195     #------------------------
196 johnpye 195 # 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 johnpye 132 # 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