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

Contents of /trunk/pygtk/interface/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

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