1 |
# |
2 |
# General Jamrules support file for building Ascend4 |
3 |
# (see http://www.freetype.org/jam/index.html) |
4 |
# |
5 |
# This file is part of the Ascend Build System. |
6 |
# |
7 |
# Copyright (C) 2005 Jerry D. St.Clair |
8 |
# |
9 |
# The Ascend Build System is free software; you can redistribute |
10 |
# it and/or modify it under the terms of the GNU General Public |
11 |
# License as published by the Free Software Foundation; either |
12 |
# version 2 of the License, or (at your option) any later version. |
13 |
# |
14 |
# This program is distributed in hope that it will be useful, |
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
# GNU General Public License for more details. |
18 |
# |
19 |
# You should have received a copy of the GNU General Public License |
20 |
# along with the program; if not, write to the Free Software |
21 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. |
22 |
# Check the file named COPYING. |
23 |
#--------------------------------------------------------------------------- |
24 |
# |
25 |
# UNDER CONSTRUCTION |
26 |
# |
27 |
# This is a template Jamrules file which supports building the |
28 |
# Ascend libraries and executables. It contains general variable |
29 |
# and rule definitions required for execution of jam in any of the |
30 |
# source subdirectories. The Ascend jam build system currently |
31 |
# supports the MSVC, Borland, MinGW, and Watcom compilers |
32 |
# (extension to gcc on Linux is on the TODO: list). |
33 |
# |
34 |
# This file is not currently customized by the configure mechanism, |
35 |
# although this may be implemented in the future. |
36 |
# |
37 |
# Users should copy/rename this file to 'Jamrules_general', then |
38 |
# modify the settings manually for their particular system. |
39 |
# Ascend cannot be built by jam unless the Jamrules_general file |
40 |
# is present. |
41 |
# |
42 |
# User-customized Jamrules_general files should not be placed in |
43 |
# version control. Only the Jamrules_general.in template should |
44 |
# be versioned. |
45 |
# |
46 |
#--------------------------------------------------------------------------- |
47 |
|
48 |
# Comment to compile with debugging & assertions enabled |
49 |
NODEBUG = 1 ; |
50 |
|
51 |
# Comment to compile without using the Epperly malloc debugger |
52 |
#DEBUG_MALLOC = -DMALLOC_DEBUG ; |
53 |
|
54 |
#--------------------------------------------------------------------------- |
55 |
|
56 |
# Tools required for complete build (comment out if not present). |
57 |
# The build system works around their absence if necessary. |
58 |
# Note that they are available for Windows, for example: |
59 |
# http://sourceforge.net/projects/gnuWin32 |
60 |
SED = sed ; |
61 |
YACC = yacc ; |
62 |
YACCFLAGS = -d ; |
63 |
YACCFILES = y.tab ; |
64 |
LEX = flex ; |
65 |
|
66 |
# Location of system libraries on Linux. |
67 |
# TODO This is a hack and needs to be redone. |
68 |
if $(UNIX) || $(OS) = LINUX |
69 |
{ |
70 |
DL_LIB_DIRS = /usr/lib ; |
71 |
X11_LIB_DIRS = /usr/X11R6/lib ; |
72 |
MATH_LIB_DIRS = /usr/lib ; |
73 |
FOR_LIB_DIRS = /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1 ; |
74 |
} |
75 |
|
76 |
#====================================================================== |
77 |
# General build options |
78 |
#====================================================================== |
79 |
# Build directory - - will be qualified for compiler & build type |
80 |
BUILD_DIR_ROOT = $(DOT) ; |
81 |
|
82 |
# Comment for normal jam deletion of object files after building targets |
83 |
KEEPOBJS = true ; |
84 |
|
85 |
# platform-independent options |
86 |
# sizeof(void*) - change value if not a typical 32-bit system |
87 |
SIZEOF_VOIDPTR = 4 ; |
88 |
|
89 |
CCFLAGS += -DTHIS_IS_AN_UNUSED_FUNCTION -DSIZEOF_VOID_P=$(SIZEOF_VOIDPTR) ; |
90 |
|
91 |
if $(NODEBUG) |
92 |
{ |
93 |
CCFLAGS += -DNDEBUG ; |
94 |
BUILD_SUBDIR = $(SLASH)Release ; |
95 |
} |
96 |
else |
97 |
{ |
98 |
BUILD_SUBDIR = $(SLASH)Debug ; |
99 |
} |
100 |
|
101 |
# platform- & complier-specific options |
102 |
if $(NT) |
103 |
{ |
104 |
# Windows-specific defines |
105 |
CCFLAGS += -D_X86_=1 -DWIN32 -D_WIN32 -DASC_BUILD_LIB -D$(HAVE_PACKAGES) ; |
106 |
SUFSHR = .dll ; |
107 |
|
108 |
if $(BCCROOT) || ( $(TOOLSET) = BORLANDC ) |
109 |
{ |
110 |
FORTRAN = ; |
111 |
CCFLAGS += -q -d -g0 -j0 -K -DMOD_ASCMALLOC ; |
112 |
CCWARN = -w ; |
113 |
if $(NODEBUG) |
114 |
{ |
115 |
CCDEBUG = -v- -O2 ; |
116 |
} |
117 |
else |
118 |
{ |
119 |
CCDEBUG = -v -y -Od ; |
120 |
} |
121 |
C++FLAGS = $(CCFLAGS) ; |
122 |
COFF2OMF = coff2omf ; # add location if not in path |
123 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)bcc ; |
124 |
} |
125 |
|
126 |
else if $(MSVCNT) || ( $(TOOLSET) = VISUALC ) |
127 |
{ |
128 |
FORTRAN = ; |
129 |
CCFLAGS += /Ze ; |
130 |
CCWARN = /W4 ; |
131 |
if $(NODEBUG) |
132 |
{ |
133 |
CCDEBUG = /O2 ; |
134 |
} |
135 |
else |
136 |
{ |
137 |
CCDEBUG = /Zi /Od ; |
138 |
} |
139 |
# Libraries are in different paths depending on VC version |
140 |
LINKFLAGS += /LIBPATH:$(VISUALC)\\lib /LIBPATH:$(VISUALC)\\PlatformSDK\\lib\\ ; |
141 |
LINKLIBS = advapi32.lib |
142 |
libc.lib |
143 |
oldnames.lib |
144 |
gdi32.lib |
145 |
user32.lib |
146 |
kernel32.lib ; |
147 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)msvc ; |
148 |
} |
149 |
|
150 |
else if $(MINGW) || ( $(TOOLSET) = MINGW ) |
151 |
{ |
152 |
FORTRANFLAGS = -c -I4 -O ; |
153 |
F77_LIBS += $(MINGW)$(SLASH)lib$(SLASH)libg2c.a ; |
154 |
|
155 |
CCFLAGS += -DHAVE_ERF=1 ; |
156 |
# uncomment to select desired warning level and ansi-strictness |
157 |
CCWARN += -Wall ; |
158 |
CCWARN += -W ; |
159 |
CCWARN += -pedantic ; |
160 |
#CCWARN += -Wshadow ; |
161 |
#CCWARN += -ansi ; |
162 |
|
163 |
if $(NODEBUG) |
164 |
{ |
165 |
CCDEBUG = -O3 ; |
166 |
} |
167 |
else |
168 |
{ |
169 |
CCDEBUG = -g -O0 ; |
170 |
} |
171 |
C++FLAGS = $(CCFLAGS) ; |
172 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)mingw ; |
173 |
} |
174 |
|
175 |
else if $(WATCOM) || ( $(TOOLSET) = WATCOM ) |
176 |
{ |
177 |
FORTRANFLAGS = /NOER ; |
178 |
CCFLAGS += /fr /dMOD_ASCMALLOC ; |
179 |
CCWARN = /wx ; |
180 |
if $(NODEBUG) |
181 |
{ |
182 |
CCDEBUG = /ox ; |
183 |
FORTRANFLAGS += /OX ; |
184 |
} |
185 |
else |
186 |
{ |
187 |
CCDEBUG = /od /d2 ; |
188 |
FORTRANFLAGS += /OD /D2 ; |
189 |
} |
190 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)watcom ; |
191 |
} |
192 |
} |
193 |
|
194 |
else if $(UNIX) || $(OS) = LINUX |
195 |
{ |
196 |
SUFSHR = .so ; |
197 |
CCFLAGS += -D$(HAVE_PACKAGES) ; |
198 |
FORTRANFLAGS = -c -I4 -O ; |
199 |
|
200 |
# uncomment to select desired warning level and ansi-strictness |
201 |
CCWARN += -Wall ; |
202 |
CCWARN += -W ; |
203 |
CCWARN += -pedantic ; |
204 |
#CCWARN += -Wshadow ; |
205 |
#CCWARN += -ansi ; |
206 |
|
207 |
if $(NODEBUG) |
208 |
{ |
209 |
CCDEBUG = -O3 ; |
210 |
} |
211 |
else |
212 |
{ |
213 |
CCDEBUG = -g -O0 ; |
214 |
} |
215 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)linux ; |
216 |
} |
217 |
|
218 |
CCFLAGS += $(CCWARN) $(CCDEBUG) $(DEBUG_MALLOC) ; |
219 |
C++FLAGS = $(CCFLAGS) ; |
220 |
BUILD_DIR = $(BUILD_DIR_ROOT)$(BUILD_SUBDIR) ; |
221 |
|
222 |
#====================================================================== |
223 |
# Ascend base library names & paths |
224 |
#====================================================================== |
225 |
ASC_COMPILER_LIBROOT = libasc_compiler ; |
226 |
ASC_GENERAL_LIBROOT = libasc_general ; |
227 |
ASC_SOLVER_LIBROOT = libasc_solver ; |
228 |
ASC_UTILITIES_LIBROOT = libasc_utilities ; |
229 |
ASC_PACKAGES_LIBROOT = libasc_packages ; |
230 |
|
231 |
ASC_COMPILER_LIB = $(ASC_COMPILER_LIBROOT)$(SUFLIB) ; |
232 |
ASC_GENERAL_LIB = $(ASC_GENERAL_LIBROOT)$(SUFLIB) ; |
233 |
ASC_SOLVER_LIB = $(ASC_SOLVER_LIBROOT)$(SUFLIB) ; |
234 |
ASC_UTILITIES_LIB = $(ASC_UTILITIES_LIBROOT)$(SUFLIB) ; |
235 |
ASC_PACKAGES_LIB = $(ASC_PACKAGES_LIBROOT)$(SUFLIB) ; |
236 |
|
237 |
ASC_BASE_LIBS = |
238 |
$(ASC_COMPILER_LIB) |
239 |
$(ASC_GENERAL_LIB) |
240 |
$(ASC_PACKAGES_LIB) |
241 |
$(ASC_SOLVER_LIB) |
242 |
$(ASC_UTILITIES_LIB) |
243 |
; |
244 |
|
245 |
# Path to base library sources & libs from top-level jam directory |
246 |
ASC_BASE_SOURCE_RELPATH = ..$(SLASH)base$(SLASH)generic ; |
247 |
ASC_BASE_LIBS_RELPATH = ..$(SLASH)base$(SLASH)jam$(SLASH)$(BUILD_DIR)$(SLASH) ; |
248 |
|
249 |
#====================================================================== |
250 |
# PACKAGES |
251 |
# |
252 |
# Package settings for building Ascend. |
253 |
# Packages are bits of compiled code that represent models, or solvers, |
254 |
# or, in general, any bits of external code. |
255 |
# |
256 |
# Choose one of the following, comment out the others: |
257 |
# STATIC_PACKAGES packages should be statically linked/loaded |
258 |
# DYNAMIC_PACKAGES packages should be dynamically linked/loaded |
259 |
# NO_PACKAGES no packages |
260 |
# |
261 |
# If STATIC_PACKAGES are chosen, also indicate the location of |
262 |
# the packages in PACK_LIBS. Otherwise leave PACK_LIBS empty. |
263 |
#====================================================================== |
264 |
HAVE_PACKAGES = STATIC_PACKAGES ; |
265 |
#HAVE_PACKAGES = DYNAMIC_PACKAGES ; |
266 |
#HAVE_PACKAGES = NO_PACKAGES ; |
267 |
|
268 |
PACK_LIBS = $(ASC_PACKAGES_LIB_PATH) ; |
269 |
#PACK_LIBS = ; |
270 |
|
271 |
#====================================================================== |
272 |
# SOLVERS / INTEGRATORS |
273 |
# |
274 |
# If you are linking to MINOS or other external solvers, the solver |
275 |
# interface needs to know about it. |
276 |
# Set the comment flags as appropriate on the following definitions. |
277 |
# If the settings here do not match the libraries you link, you will |
278 |
# almost certainly get runtime errors if not link errors. |
279 |
#====================================================================== |
280 |
|
281 |
# >>>> UNDER CONSTRUCTION <<<< |
282 |
|
283 |
# Slv is the original ASCEND nonlinear solver. It is not currently supported. |
284 |
# to build with slv, uncomment the next line. |
285 |
#SOLVER_DEFS += -DSTATIC_SLV ; |
286 |
|
287 |
# Opt is not currently supported. |
288 |
# to build with optsqp, uncomment the next line |
289 |
#SOLVER_DEFS += -DSTATIC_OPTSQP ; |
290 |
|
291 |
# QRSlv is the current ASCEND nonlinear algebraic solver. |
292 |
# to build with qrslv, uncomment the next line |
293 |
SOLVER_DEFS += -DSTATIC_QRSLV ; |
294 |
|
295 |
# makeMPS is currently not supported. |
296 |
# to build with mps, uncomment the next line |
297 |
#SOLVER_DEFS += -DSTATIC_MPS ; |
298 |
|
299 |
# to build with ngslv, uncomment the next line |
300 |
#SOLVER_DEFS += -DSTATIC_NGSLV ; |
301 |
|
302 |
# to build with cmslv (requires CONOPT), uncomment the next line |
303 |
#SOLVER_DEFS += -DSTATIC_CMSLV ; |
304 |
|
305 |
# to build with lrslv, uncomment the next line |
306 |
#SOLVER_DEFS += -DSTATIC_LRSLV ; |
307 |
|
308 |
# TODO the configure script sets the following depending on its search for minos. |
309 |
# Minos is an external solver. It is not currently supported. |
310 |
# to force a build WITHOUT minos, comment the next line |
311 |
#SOLVER_DEFS += -DSTATIC_MINOS ; |
312 |
# |
313 |
# Name & path to the minos library |
314 |
#MINOSLIB = ; |
315 |
#MINOSLIB_RELPATH = ; |
316 |
|
317 |
# TODO the configure script sets the following depending on its search for conopt. |
318 |
# to force a build WITHOUT conopt, comment the next line |
319 |
#SOLVER_DEFS += -DSTATIC_CONOPT ; |
320 |
# |
321 |
# Path to the conopt library |
322 |
#CONOPTLIB = ; |
323 |
#CONOPTLIB_RELPATH = ; |
324 |
|
325 |
# TODO the configure script sets the following depending on its search for lsode. |
326 |
# Choose one of the following to build with lsode, comment both to build WITHOUT lsode |
327 |
SOLVER_DEFS += -DSTATIC_LSOD ; |
328 |
#SOLVER_DEFS += -DDYNAMIC_LSOD ; |
329 |
# |
330 |
# Name & path to the lsode library. Comment out if not using lsode. |
331 |
ASC_LSOD_LIBROOT = liblsode ; |
332 |
ASC_LSOD_LIB = $(ASC_LSOD_LIBROOT)$(SUFLIB) ; |
333 |
LSODLIB_RELPATH = ..$(SLASH)lsod$(SLASH)jam$(SLASH)$(BUILD_DIR) ; |
334 |
LSODLIB = $(ASC_LSOD_LIB) ; |
335 |
|
336 |
#====================================================================== |
337 |
# FORTRAN options - set to override compiler defaults |
338 |
#====================================================================== |
339 |
# Your FORTRAN compiler |
340 |
#FORTRAN = g77 ; |
341 |
|
342 |
# Fortran compilation flags & options: |
343 |
# These are used for making the ASCEND libraries based on FORTRAN codes. |
344 |
# These should be set to get the best performance possible out of your |
345 |
# f77 compiler without optimizing away functions that are not obviously |
346 |
# called, as some compilers do by default. |
347 |
# |
348 |
#FORTRANFLAGS = -c -I4 -O -lg2c ; |
349 |
|
350 |
# F77LIBS is for the base f77 libraries. If you are linking no f77 |
351 |
# objects to ascend, it may be left undefined. |
352 |
# Set F77LIBS appropriate for your machine and desired loader behavior. |
353 |
# |
354 |
#F77_LIBS = ; |
355 |
if $(UNIX) || $(OS) = LINUX |
356 |
{ |
357 |
F77_LIBS = -L$(FOR_LIB_DIRS) -lg2c ; |
358 |
} |
359 |
|
360 |
#====================================================================== |
361 |
# FORTRAN Support Libraries |
362 |
# |
363 |
# Point BLASLIB and LPAKLIB to machine-specific BLAS and LINPACK |
364 |
# libraries (if you have them) to get the best speed out of ASCEND. |
365 |
# Otherwise, generic versions can be built if FORTRAN is available. |
366 |
#====================================================================== |
367 |
|
368 |
# Name & path to the blas library |
369 |
ASC_BLAS_LIBROOT = libblas ; |
370 |
ASC_BLAS_LIB = $(ASC_BLAS_LIBROOT)$(SUFLIB) ; |
371 |
BLASLIB_RELPATH = ..$(SLASH)blas$(SLASH)jam$(SLASH)$(BUILD_DIR) ; |
372 |
BLASLIB = $(ASC_BLAS_LIB) ; |
373 |
|
374 |
# Name & path to the linpack library |
375 |
ASC_LINPACK_LIBROOT = liblpak ; |
376 |
ASC_LINPACK_LIB = $(ASC_LINPACK_LIBROOT)$(SUFLIB) ; |
377 |
LPAKLIB_RELPATH = ..$(SLASH)linpack$(SLASH)jam$(SLASH)$(BUILD_DIR) ; |
378 |
LPAKLIB = $(ASC_LINPACK_LIB) ; |
379 |
|
380 |
#====================================================================== |
381 |
# Math libraries |
382 |
#====================================================================== |
383 |
if $(UNIX) || $(OS) = LINUX |
384 |
{ |
385 |
MATH_LIBS = -L$(MATH_LIB_DIRS) -lieee -lm ; |
386 |
} |
387 |
|
388 |
#====================================================================== |
389 |
# Dynamic loading support |
390 |
#====================================================================== |
391 |
if $(UNIX) || $(OS) = LINUX |
392 |
{ |
393 |
DL_LIBS = -L$(DL_LIB_DIRS) -ldl ; |
394 |
} |
395 |
|
396 |
#====================================================================== |
397 |
# X11 |
398 |
#====================================================================== |
399 |
if $(UNIX) || $(OS) = LINUX |
400 |
{ |
401 |
X11_LIBS = -L$(X11_LIB_DIRS) -lX11 ; |
402 |
} |
403 |
|
404 |
#====================================================================== |
405 |
# Ascend-specific jam instructions |
406 |
#====================================================================== |
407 |
|
408 |
#---------------------------------------------------------------------- |
409 |
# LEX_or_copy |
410 |
# |
411 |
# Generates a c source file using the lexer defined by $(LEX), |
412 |
# or by copying a specified file if $(LEX) is not defined. |
413 |
# The following parameters are used: |
414 |
# |
415 |
# 1 source file to generate |
416 |
# 2 lex/flex definition file |
417 |
# 3 pre-generated source file to copy if $(LEX) is empty |
418 |
# 4 header file associated with the source file, if any |
419 |
#---------------------------------------------------------------------- |
420 |
rule LEX_or_copy |
421 |
{ |
422 |
if $(LEX) |
423 |
{ |
424 |
Echo Generating $(1) from $(LEX) ; |
425 |
DEPENDS $(1) : $(2) ; |
426 |
Lex_with_options $(1) : $(2) ; |
427 |
} |
428 |
else |
429 |
{ |
430 |
Echo Copying $(1) from $(4) ; |
431 |
File $(1) : $(3) ; |
432 |
} |
433 |
|
434 |
# make the header dependent |
435 |
if $(4) |
436 |
{ |
437 |
INCLUDES $(1) : $(4) ; |
438 |
} |
439 |
|
440 |
Clean clean : $(1) ; |
441 |
} |
442 |
|
443 |
# run LEX using options specified in LEXOPTS |
444 |
actions Lex_with_options |
445 |
{ |
446 |
$(LEX) $(LEXOPTS) -o$(1) $(2) |
447 |
} |