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 |
# Options from here on should not require routine tweaking |
56 |
|
57 |
# Tools required for complete build (comment out if not present). |
58 |
# The build system works around their absence if necessary. |
59 |
# Note that they are available for Windows, for example: |
60 |
# http://sourceforge.net/projects/gnuWin32 |
61 |
SED = sed ; |
62 |
YACC = yacc ; |
63 |
YACCFLAGS = -d ; |
64 |
YACCFILES = y.tab ; |
65 |
LEX = flex ; |
66 |
|
67 |
#====================================================================== |
68 |
# General build options |
69 |
#====================================================================== |
70 |
# Build directory - - will be qualified for compiler & build type |
71 |
BUILD_DIR_ROOT = $(DOT) ; |
72 |
|
73 |
# Comment for normal jam deletion of object files after building targets |
74 |
KEEPOBJS = true ; |
75 |
|
76 |
# platform-independent options |
77 |
# sizeof(void*) - change value if not a typical 32-bit system |
78 |
SIZEOF_VOIDPTR = 4 ; |
79 |
|
80 |
CCFLAGS += -DTHIS_IS_AN_UNUSED_FUNCTION -DSIZEOF_VOID_P=$(SIZEOF_VOIDPTR) ; |
81 |
|
82 |
if $(NODEBUG) |
83 |
{ |
84 |
CCFLAGS += -DNDEBUG ; |
85 |
BUILD_SUBDIR = $(SLASH)Release ; |
86 |
} |
87 |
else |
88 |
{ |
89 |
BUILD_SUBDIR = $(SLASH)Debug ; |
90 |
} |
91 |
|
92 |
# platform- & complier-specific options |
93 |
if $(NT) |
94 |
{ |
95 |
# Windows-specific defines |
96 |
CCFLAGS += -D_X86_=1 -DWIN32 -D_WIN32 -DASC_BUILD_LIB -D$(HAVE_PACKAGES) ; |
97 |
SUFSHR = .dll ; |
98 |
|
99 |
if $(BCCROOT) || ( $(TOOLSET) = BORLANDC ) |
100 |
{ |
101 |
FORTRAN = ; |
102 |
CCFLAGS += -q -d -g0 -j0 -K -DMOD_ASCMALLOC ; |
103 |
CCWARN = -w ; |
104 |
if $(NODEBUG) |
105 |
{ |
106 |
CCDEBUG = -v- -O2 ; |
107 |
} |
108 |
else |
109 |
{ |
110 |
CCDEBUG = -v -y -Od ; |
111 |
} |
112 |
C++FLAGS = $(CCFLAGS) ; |
113 |
COFF2OMF = coff2omf ; # add location if not in path |
114 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)bcc ; |
115 |
} |
116 |
|
117 |
else if $(MSVCNT) || ( $(TOOLSET) = VISUALC ) |
118 |
{ |
119 |
FORTRAN = ; |
120 |
CCFLAGS += /Ze ; |
121 |
CCWARN = /W4 ; |
122 |
if $(NODEBUG) |
123 |
{ |
124 |
CCDEBUG = /O2 ; |
125 |
} |
126 |
else |
127 |
{ |
128 |
CCDEBUG = /Zi /Od ; |
129 |
} |
130 |
# Libraries are in different paths depending on VC version |
131 |
LINKFLAGS += /LIBPATH:$(VISUALC)\\lib /LIBPATH:$(VISUALC)\\PlatformSDK\\lib\\ ; |
132 |
LINKLIBS = advapi32.lib |
133 |
libc.lib |
134 |
oldnames.lib |
135 |
gdi32.lib |
136 |
user32.lib |
137 |
kernel32.lib ; |
138 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)msvc ; |
139 |
} |
140 |
|
141 |
else if $(MINGW) || ( $(TOOLSET) = MINGW ) |
142 |
{ |
143 |
FORTRANFLAGS = -c -I4 -O ; |
144 |
F77_LIBS += $(MINGW)$(SLASH)lib$(SLASH)libg2c.a ; |
145 |
|
146 |
CCFLAGS += -DHAVE_ERF=1 ; |
147 |
# uncomment to select desired warning level and ansi-strictness |
148 |
CCWARN += -Wall ; |
149 |
CCWARN += -W ; |
150 |
CCWARN += -pedantic ; |
151 |
#CCWARN += -Wshadow ; |
152 |
#CCWARN += -ansi ; |
153 |
|
154 |
if $(NODEBUG) |
155 |
{ |
156 |
CCDEBUG = -O3 ; |
157 |
} |
158 |
else |
159 |
{ |
160 |
CCDEBUG = -g -O0 ; |
161 |
} |
162 |
C++FLAGS = $(CCFLAGS) ; |
163 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)mingw ; |
164 |
} |
165 |
|
166 |
else if $(WATCOM) || ( $(TOOLSET) = WATCOM ) |
167 |
{ |
168 |
FORTRANFLAGS = /NOER ; |
169 |
CCFLAGS += /fr /dMOD_ASCMALLOC ; |
170 |
CCWARN = /wx ; |
171 |
if $(NODEBUG) |
172 |
{ |
173 |
CCDEBUG = /ox ; |
174 |
FORTRANFLAGS += /OX ; |
175 |
} |
176 |
else |
177 |
{ |
178 |
CCDEBUG = /od /d2 ; |
179 |
FORTRANFLAGS += /OD /D2 ; |
180 |
} |
181 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)watcom ; |
182 |
} |
183 |
} |
184 |
|
185 |
else if $(OS) = LINUX |
186 |
{ |
187 |
SUFSHR = .so ; |
188 |
CCFLAGS += -D$(HAVE_PACKAGES) ; |
189 |
FORTRANFLAGS = -c -I4 -O -lg2c ; |
190 |
|
191 |
# uncomment to select desired warning level and ansi-strictness |
192 |
CCWARN += -Wall ; |
193 |
CCWARN += -W ; |
194 |
CCWARN += -pedantic ; |
195 |
#CCWARN += -Wshadow ; |
196 |
#CCWARN += -ansi ; |
197 |
|
198 |
if $(NODEBUG) |
199 |
{ |
200 |
CCDEBUG = -O3 ; |
201 |
} |
202 |
else |
203 |
{ |
204 |
CCDEBUG = -g -O0 ; |
205 |
} |
206 |
BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)linux ; |
207 |
} |
208 |
|
209 |
CCFLAGS += $(CCWARN) $(CCDEBUG) $(DEBUG_MALLOC) ; |
210 |
C++FLAGS = $(CCFLAGS) ; |
211 |
BUILD_DIR = $(BUILD_DIR_ROOT)$(BUILD_SUBDIR) ; |
212 |
|
213 |
#====================================================================== |
214 |
# Ascend base library names & paths |
215 |
#====================================================================== |
216 |
ASC_COMPILER_LIBROOT = libasc_compiler ; |
217 |
ASC_GENERAL_LIBROOT = libasc_general ; |
218 |
ASC_SOLVER_LIBROOT = libasc_solver ; |
219 |
ASC_UTILITIES_LIBROOT = libasc_utilities ; |
220 |
ASC_PACKAGES_LIBROOT = libasc_packages ; |
221 |
|
222 |
ASC_COMPILER_LIB = $(ASC_COMPILER_LIBROOT)$(SUFLIB) ; |
223 |
ASC_GENERAL_LIB = $(ASC_GENERAL_LIBROOT)$(SUFLIB) ; |
224 |
ASC_SOLVER_LIB = $(ASC_SOLVER_LIBROOT)$(SUFLIB) ; |
225 |
ASC_UTILITIES_LIB = $(ASC_UTILITIES_LIBROOT)$(SUFLIB) ; |
226 |
ASC_PACKAGES_LIB = $(ASC_PACKAGES_LIBROOT)$(SUFLIB) ; |
227 |
|
228 |
ASC_BASE_LIBS = |
229 |
$(ASC_GENERAL_LIB) |
230 |
$(ASC_UTILITIES_LIB) |
231 |
$(ASC_SOLVER_LIB) |
232 |
$(ASC_COMPILER_LIB) |
233 |
$(ASC_PACKAGES_LIB) |
234 |
; |
235 |
|
236 |
ASC_BASE_SOURCE_RELPATH = ..$(SLASH)base$(SLASH)generic ; |
237 |
ASC_BASE_LIBS_RELPATH = ..$(SLASH)base$(SLASH)jam$(SLASH)$(BUILD_DIR)$(SLASH) ; |
238 |
|
239 |
#====================================================================== |
240 |
# PACKAGES |
241 |
# |
242 |
# Package settings for building Ascend. |
243 |
# Packages are bits of compiled code that represent models, or solvers, |
244 |
# or, in general, any bits of external code. |
245 |
# |
246 |
# Choose one of the following, comment out the others: |
247 |
# STATIC_PACKAGES packages should be statically linked/loaded |
248 |
# DYNAMIC_PACKAGES packages should be dynamically linked/loaded |
249 |
# NO_PACKAGES no packages |
250 |
# |
251 |
# If STATIC_PACKAGES are chosen, also indicate the location of |
252 |
# the packages in PACK_LIBS. Otherwise leave PACK_LIBS empty. |
253 |
#====================================================================== |
254 |
HAVE_PACKAGES = STATIC_PACKAGES ; |
255 |
#HAVE_PACKAGES = DYNAMIC_PACKAGES ; |
256 |
#HAVE_PACKAGES = NO_PACKAGES ; |
257 |
|
258 |
PACK_LIBS = $(ASC_PACKAGES_LIB_PATH) ; |
259 |
#PACK_LIBS = ; |
260 |
|
261 |
#====================================================================== |
262 |
# SOLVERS / INTEGRATORS |
263 |
# |
264 |
# If you are linking to MINOS or other external solvers, the solver |
265 |
# interface needs to know about it. |
266 |
# Set the comment flags as appropriate on the following definitions. |
267 |
# If the settings here do not match the libraries you link, you will |
268 |
# almost certainly get runtime errors if not link errors. |
269 |
#====================================================================== |
270 |
|
271 |
# >>>> UNDER CONSTRUCTION <<<< |
272 |
|
273 |
# Slv is the original ASCEND nonlinear solver. It is not currently supported. |
274 |
# to build with slv, uncomment the next line. |
275 |
#SOLVER_DEFS += -DSTATIC_SLV ; |
276 |
|
277 |
# Opt is not currently supported. |
278 |
# to build with optsqp, uncomment the next line |
279 |
#SOLVER_DEFS += -DSTATIC_OPTSQP ; |
280 |
|
281 |
# QRSlv is the current ASCEND nonlinear algebraic solver. |
282 |
# to build with qrslv, uncomment the next line |
283 |
SOLVER_DEFS += -DSTATIC_QRSLV ; |
284 |
|
285 |
# makeMPS is currently not supported. |
286 |
# to build with mps, uncomment the next line |
287 |
#SOLVER_DEFS += -DSTATIC_MPS ; |
288 |
|
289 |
# to build with ngslv, uncomment the next line |
290 |
#SOLVER_DEFS += -DSTATIC_NGSLV ; |
291 |
|
292 |
# to build with cmslv (requires CONOPT), uncomment the next line |
293 |
#SOLVER_DEFS += -DSTATIC_CMSLV ; |
294 |
|
295 |
# to build with lrslv, uncomment the next line |
296 |
#SOLVER_DEFS += -DSTATIC_LRSLV ; |
297 |
|
298 |
# TODO the configure script sets the following depending on its search for minos. |
299 |
# Minos is an external solver. It is not currently supported. |
300 |
# to force a build WITHOUT minos, comment the next line |
301 |
#SOLVER_DEFS += -DSTATIC_MINOS ; |
302 |
# |
303 |
# Name & path to the minos library |
304 |
#MINOSLIB = ; |
305 |
#MINOSLIB_RELPATH = ; |
306 |
|
307 |
# TODO the configure script sets the following depending on its search for conopt. |
308 |
# to force a build WITHOUT conopt, comment the next line |
309 |
#SOLVER_DEFS += -DSTATIC_CONOPT ; |
310 |
# |
311 |
# Path to the conopt library |
312 |
#CONOPTLIB = ; |
313 |
#CONOPTLIB_RELPATH = ; |
314 |
|
315 |
# TODO the configure script sets the following depending on its search for lsode. |
316 |
# Choose one of the following to build with lsode, comment both to build WITHOUT lsode |
317 |
SOLVER_DEFS += -DSTATIC_LSOD ; |
318 |
#SOLVER_DEFS += -DDYNAMIC_LSOD ; |
319 |
# |
320 |
# Name & path to the lsode library. Comment out if not using lsode. |
321 |
ASC_LSOD_LIBROOT = liblsode ; |
322 |
ASC_LSOD_LIB = $(ASC_LSOD_LIBROOT)$(SUFLIB) ; |
323 |
LSODLIB_RELPATH = ..$(SLASH)lsod$(SLASH)jam$(SLASH)$(BUILD_DIR) ; |
324 |
LSODLIB = $(ASC_LSOD_LIB) ; |
325 |
|
326 |
#====================================================================== |
327 |
# FORTRAN options - set to override compiler defaults |
328 |
#====================================================================== |
329 |
# Your FORTRAN compiler |
330 |
#FORTRAN = g77 ; |
331 |
|
332 |
# Fortran compilation flags & options: |
333 |
# These are used for making the ASCEND libraries based on FORTRAN codes. |
334 |
# These should be set to get the best performance possible out of your |
335 |
# f77 compiler without optimizing away functions that are not obviously |
336 |
# called, as some compilers do by default. |
337 |
# |
338 |
#FORTRANFLAGS = -c -I4 -O -lg2c ; |
339 |
|
340 |
# F77LIBS is for the base f77 libraries. If you are linking no f77 |
341 |
# objects to ascend, it may be left undefined. |
342 |
# Set F77LIBS appropriate for your machine and desired loader behavior. |
343 |
# |
344 |
#F77_LIBS = ; |
345 |
|
346 |
#====================================================================== |
347 |
# FORTRAN Support Libraries |
348 |
# |
349 |
# Point BLASLIB and LPAKLIB to machine-specific BLAS and LINPACK |
350 |
# libraries (if you have them) to get the best speed out of ASCEND. |
351 |
# Otherwise, generic versions can be built if FORTRAN is available. |
352 |
#====================================================================== |
353 |
|
354 |
# Name & path to the blas library |
355 |
ASC_BLAS_LIBROOT = libblas ; |
356 |
ASC_BLAS_LIB = $(ASC_BLAS_LIBROOT)$(SUFLIB) ; |
357 |
BLASLIB_RELPATH = ..$(SLASH)blas$(SLASH)jam$(SLASH)$(BUILD_DIR) ; |
358 |
BLASLIB = $(ASC_BLAS_LIB) ; |
359 |
|
360 |
# Name & path to the linpack library |
361 |
ASC_LINPACK_LIBROOT = liblpak ; |
362 |
ASC_LINPACK_LIB = $(ASC_LINPACK_LIBROOT)$(SUFLIB) ; |
363 |
LPAKLIB_RELPATH = ..$(SLASH)linpack$(SLASH)jam$(SLASH)$(BUILD_DIR) ; |
364 |
LPAKLIB = $(ASC_LINPACK_LIB) ; |
365 |
|
366 |
#====================================================================== |
367 |
# Ascend-specific jam instructions |
368 |
#====================================================================== |
369 |
|
370 |
#---------------------------------------------------------------------- |
371 |
# LEX_or_copy |
372 |
# |
373 |
# Generates a c source file using the lexer defined by $(LEX), |
374 |
# or by copying a specified file if $(LEX) is not defined. |
375 |
# The following parameters are used: |
376 |
# |
377 |
# 1 source file to generate |
378 |
# 2 lex/flex definition file |
379 |
# 3 pre-generated source file to copy if $(LEX) is empty |
380 |
# 4 header file associated with the source file, if any |
381 |
#---------------------------------------------------------------------- |
382 |
rule LEX_or_copy |
383 |
{ |
384 |
if $(LEX) |
385 |
{ |
386 |
Echo Generating $(1) from $(LEX) ; |
387 |
DEPENDS $(1) : $(2) ; |
388 |
Lex_with_options $(1) : $(2) ; |
389 |
} |
390 |
else |
391 |
{ |
392 |
Echo Copying $(1) from $(4) ; |
393 |
File $(1) : $(3) ; |
394 |
} |
395 |
|
396 |
# make the header dependent |
397 |
if $(4) |
398 |
{ |
399 |
INCLUDES $(1) : $(4) ; |
400 |
} |
401 |
|
402 |
Clean clean : $(1) ; |
403 |
} |
404 |
|
405 |
# run LEX using options specified in LEXOPTS |
406 |
actions Lex_with_options |
407 |
{ |
408 |
$(LEX) $(LEXOPTS) -o$(1) $(2) |
409 |
} |