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

Contents of /trunk/pygtk/interface/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

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