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

Contents of /trunk/pygtk/interface/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


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

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