1 |
# |
2 |
# Jamfile to build Ascend4 base libraries |
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 Jamfile builds the Ascend base libraries using the jam* build |
28 |
# tool. Using generic Jambase and Jamrules_general files (located at |
29 |
# ../../jam), it builds the Ascend base functionality as a set of static |
30 |
# libraries. It does not currently support building dynamic libraries, |
31 |
# executables, or interface libraries. |
32 |
# |
33 |
# The Ascend jam build system currently supports building the libraries |
34 |
# under Windows using the MSVC, Borland, MinGW, and Watcom** compilers, |
35 |
# and under Linux with gcc. With use of the customized ../.../jam/Jambase |
36 |
# file, it should work with both the original and ftjam variants of jam. |
37 |
# The system was developed primarily using ftjam. |
38 |
# |
39 |
# The libraries are built in ./CONFIGTYPE/COMPILER where |
40 |
# CONFIGTYPE = Debug, Release |
41 |
# COMPILER = bcc, msvc, mingw, watcom, unix |
42 |
# |
43 |
# Installation of the libraries or headers is not supported at this time. |
44 |
#------------------------------------------------------------------------- |
45 |
# |
46 |
# Build Instructions |
47 |
# |
48 |
# 1. jam must be installed and configured for the compiler in use. |
49 |
# |
50 |
# 2. Copy the ../../jam/Jamrules_general.in to ../../jam/Jamrules_general. |
51 |
# |
52 |
# 3. Manually edit Jamrules_general and (if necessary) this Jamfile to set |
53 |
# configuration and local directory options. |
54 |
# |
55 |
# 4. Run jam from using the provided Jambase: |
56 |
# jam -f ../../jam/Jambase libs |
57 |
# |
58 |
# 5. A prototype CUnit test suite may also be built. At this point it |
59 |
# only covers the general and utilities components. For maximal |
60 |
# testing, NODEBUG should be commented and DEBUG_MALLOC should be |
61 |
# active in Jamrules_general. This will require that the ASCEND base |
62 |
# libs be built with these options also. Build the tests using: |
63 |
# jam -f ../../jam/Jambase tests |
64 |
# |
65 |
#------------------------------------------------------------------------- |
66 |
# Notes: |
67 |
# |
68 |
# * jam is an open source, multi-platform build tool which is |
69 |
# available in several flavors. These include the original |
70 |
# (http://www.perforce.com) and ftjam |
71 |
# (http://www.freetype.org/jam/index.html) variants, among others. |
72 |
# |
73 |
# ** Currently, Open Watcom 1.3 can compile the Ascend sources |
74 |
# and build the libraries. However, it does not supply the required |
75 |
# IEEE math functions isnan() and copysign(). At present, Ascend does |
76 |
# not supply these, so the user must provide these functions to use |
77 |
# the libraries under Watcom. |
78 |
# |
79 |
#--------------------------------------------------------------------------- |
80 |
|
81 |
# TODO: remove if end up using SubDir rules |
82 |
JAM_GENERAL_DIR = ..$(SLASH)..$(SLASH)jam ; |
83 |
include $(JAM_GENERAL_DIR)$(SLASH)Jamrules_general ; |
84 |
|
85 |
srcdir = ..$(SLASH)generic ; |
86 |
|
87 |
# Build flags for Ascend base libraries |
88 |
BUILD_COMPILER = 1 ; |
89 |
BUILD_GENERAL = 1 ; |
90 |
BUILD_SOLVER = 1 ; |
91 |
BUILD_UTILITIES = 1 ; |
92 |
BUILD_PACKAGES = 1 ; |
93 |
|
94 |
# Ascend modules subdirectories |
95 |
ASC_COMPILER_DIR = $(srcdir)$(SLASH)compiler ; |
96 |
ASC_GENERAL_DIR = $(srcdir)$(SLASH)general ; |
97 |
ASC_SOLVER_DIR = $(srcdir)$(SLASH)solver ; |
98 |
ASC_UTILITIES_DIR = $(srcdir)$(SLASH)utilities ; |
99 |
ASC_PACKAGES_DIR = $(srcdir)$(SLASH)packages ; |
100 |
|
101 |
HDRS += $(srcdir) ; |
102 |
|
103 |
DEPENDS all : libs ; |
104 |
NOTFILE libs ; |
105 |
|
106 |
# Location of old Ascend Tcl/Tk interface sources. |
107 |
# Some solver modules include headers originally located in |
108 |
# the Tcl/Tk-specific interface subdirectory. Until the |
109 |
# source is reorganized to decouple the base and interface |
110 |
# components, we have to be able to find those headers |
111 |
# TODO: remove/rework when Tcl/Tk decoupled from base library |
112 |
ASC_INTERFACE_ROOT = ..$(SLASH)..$(SLASH)tcltk98$(SLASH)generic ; |
113 |
|
114 |
# Comment to compile without using the Epperly malloc debugger |
115 |
#DEBUG_MALLOC = -DMALLOC_DEBUG ; |
116 |
|
117 |
# Location of the tcl.h and tk.h header files |
118 |
# TODO: remove when Tcl/Tk decoupled from base library |
119 |
TK_HDRS = ..$(SLASH)..$(SLASH)..$(SLASH)Tcl$(SLASH)include ; |
120 |
|
121 |
#========================================================================= |
122 |
# Compiler module |
123 |
#========================================================================= |
124 |
if $(BUILD_COMPILER) |
125 |
{ |
126 |
ASC_COMPILER_SOURCES = |
127 |
anoncopy.c |
128 |
anonmerg.c |
129 |
anontype.c |
130 |
arrayinst.c |
131 |
ascCompiler.c |
132 |
ascParse.c |
133 |
atomsize.c |
134 |
atomvalue.c |
135 |
bintoken.c |
136 |
bit.c |
137 |
braced.c |
138 |
case.c |
139 |
check.c |
140 |
child.c |
141 |
childdef.c |
142 |
childio.c |
143 |
childinfo.c |
144 |
cmpfunc.c |
145 |
commands.c |
146 |
copyinst.c |
147 |
createinst.c |
148 |
destroyinst.c |
149 |
dimen.c |
150 |
dimen_io.c |
151 |
dump.c |
152 |
evaluate.c |
153 |
exprio.c |
154 |
exprs.c |
155 |
exprsym.c |
156 |
extcall.c |
157 |
extfunc.c |
158 |
extinst.c |
159 |
find.c |
160 |
forvars.c |
161 |
fractions.c |
162 |
freestore.c |
163 |
func.c |
164 |
initialize.c |
165 |
instance.c |
166 |
instance_io.c |
167 |
instantiate.c |
168 |
instmacro.c |
169 |
instquery.c |
170 |
interval.c |
171 |
library.c |
172 |
linkinst.c |
173 |
logrel_io.c |
174 |
logrel_util.c |
175 |
logrelation.c |
176 |
mathinst.c |
177 |
mergeinst.c |
178 |
module.c |
179 |
name.c |
180 |
nameio.c |
181 |
notate.c |
182 |
numlist.c |
183 |
packages.c |
184 |
parentchild.c |
185 |
parpend.c |
186 |
pending.c |
187 |
proc.c |
188 |
procframe.c |
189 |
procio.c |
190 |
prototype.c |
191 |
redirectFile.c |
192 |
refineinst.c |
193 |
rel_common.c |
194 |
relation.c |
195 |
relation_io.c |
196 |
relation_util.c |
197 |
rootfind.c |
198 |
rounded.c |
199 |
safe.c |
200 |
scanner.c |
201 |
select.c |
202 |
setinst_io.c |
203 |
setinstval.c |
204 |
setio.c |
205 |
sets.c |
206 |
slist.c |
207 |
simlist.c |
208 |
statement.c |
209 |
statio.c |
210 |
switch.c |
211 |
symtab.c |
212 |
syntax.c |
213 |
temp.c |
214 |
tmpnum.c |
215 |
type_desc.c |
216 |
type_descio.c |
217 |
typedef.c |
218 |
typelint.c |
219 |
units.c |
220 |
universal.c |
221 |
value_type.c |
222 |
visitinst.c |
223 |
visitlink.c |
224 |
vlist.c |
225 |
vlistio.c |
226 |
watchpt.c |
227 |
watchptio.c |
228 |
when.c |
229 |
when_io.c |
230 |
when_util.c |
231 |
; |
232 |
|
233 |
SEARCH on $(ASC_COMPILER_SOURCES) = $(ASC_COMPILER_DIR) ; |
234 |
|
235 |
#---------------------------------------------------------------------- |
236 |
# rounded.c needs a special define |
237 |
#---------------------------------------------------------------------- |
238 |
CCFLAGS on rounded$(SUFOBJ) += -DSLOPPY ; |
239 |
|
240 |
#---------------------------------------------------------------------- |
241 |
# ascParse.c & ascParse.h |
242 |
# |
243 |
# ascParse implements the Ascend grammar. It is generated by |
244 |
# yacc with modification (e.g. by sed) to change the default |
245 |
# 'yy' prefixes to 'zz_'. If yacc and sed are available in |
246 |
# the build environment (i.e. $(YACC) and $(SED) are non-null |
247 |
# in jam), ascParse.c and ascParse.h are generated using these |
248 |
# tools. If not, copies of pre-generated files are used instead. |
249 |
#---------------------------------------------------------------------- |
250 |
|
251 |
# ascParse.c needs a special define |
252 |
CCFLAGS on ascParse$(SUFOBJ) += -DYY_USE_CONST ; |
253 |
|
254 |
rule make_ascParse |
255 |
{ |
256 |
if $(YACC) && $(SED) |
257 |
{ |
258 |
Echo Generating ascParse from $(YACC) and $(SED) ; |
259 |
DEPENDS $(ascParse_c) $(ascParse_h) : $(ascParse_y) ; |
260 |
Yacc1 $(ascParse_c) $(ascParse_h) : $(ascParse_y) ; |
261 |
YaccMv $(ascParse_c) $(ascParse_h) : $(ascParse_y) ; |
262 |
yy_to_zz_c $(ascParse_c) : $(ascParse_y) ; |
263 |
yy_to_zz_h $(ascParse_h) : $(ascParse_y) ; |
264 |
} |
265 |
else |
266 |
{ |
267 |
Echo Copying ascParse.* from ascParse.*.no.yacc ; |
268 |
File $(ascParse_c) : ascParse.c.no.yacc ; |
269 |
File $(ascParse_h) : ascParse.h.no.yacc ; |
270 |
} |
271 |
|
272 |
# make the header dependent |
273 |
INCLUDES $(ascParse_c) : $(ascParse_h) ; |
274 |
|
275 |
Clean clean : $(ascParse_c) $(ascParse_h) ; |
276 |
} |
277 |
|
278 |
actions yy_to_zz_c |
279 |
{ |
280 |
$(SED) -e "/#ifndef YYSTYPE/,/#endif/d" -e "/^#line /d" -e "s\yy\zz_\g" -e "s\YY\ZZ_\g" $(1) > tempfile.tmp |
281 |
$(MV) tempfile.tmp $(1) |
282 |
} |
283 |
|
284 |
actions yy_to_zz_h |
285 |
{ |
286 |
$(SED) -e "s\yy\zz_\g" -e "s\YY\ZZ_\g" $(1) > tempfile.tmp |
287 |
$(MV) tempfile.tmp $(1) |
288 |
} |
289 |
|
290 |
ascParse_c = [ FGristSourceFiles ascParse.c ] ; |
291 |
ascParse_h = [ FGristSourceFiles ascParse.h ] ; |
292 |
ascParse_y = ascParse.y ; |
293 |
|
294 |
LOCATE on $(ascParse_c) = $(ASC_COMPILER_DIR) ; |
295 |
LOCATE on $(ascParse_h) = $(ASC_COMPILER_DIR) ; |
296 |
LOCATE on $(ascParse_y) = $(ASC_COMPILER_DIR) ; |
297 |
|
298 |
make_ascParse ; |
299 |
|
300 |
#---------------------------------------------------------------------- |
301 |
# scanner.c |
302 |
# |
303 |
# scanner.c implements the Ascend lexical analyzer. It is |
304 |
# generated by lex/flex if available in the build environment |
305 |
# (i.e. $(LEX) is non-null in jam). If lex/flex is not available, |
306 |
# the a copy of a pre-generated file is used instead. |
307 |
#---------------------------------------------------------------------- |
308 |
|
309 |
# scanner.c needs a special define (Watcom requires the '=""'. ) |
310 |
CCFLAGS on scanner$(SUFOBJ) += -DYY_USE_CONST="" ; |
311 |
|
312 |
scanner_c = [ FGristSourceFiles scanner.c ] ; |
313 |
scanner_h = scanner.h ; |
314 |
scanner_l = scanner.l ; |
315 |
LEXOPTS on $(scanner_c) = -Pzz_ ; |
316 |
|
317 |
LOCATE on $(scanner_c) = $(ASC_COMPILER_DIR) ; |
318 |
LOCATE on $(scanner_h) = $(ASC_COMPILER_DIR) ; |
319 |
LOCATE on $(scanner_l) = $(ASC_COMPILER_DIR) ; |
320 |
|
321 |
LEX_or_copy $(scanner_c) : $(scanner_l) : scanner_c_no_flex : $(scanner_h) ; |
322 |
|
323 |
#---------------------------------------------------------------------- |
324 |
# Build the compiler library |
325 |
#---------------------------------------------------------------------- |
326 |
LOCATE_TARGET = $(BUILD_DIR)$(SLASH)compiler ; |
327 |
SEARCH_SOURCE = $(ASC_COMPILER_DIR) ; |
328 |
|
329 |
Library $(ASC_COMPILER_LIBROOT) : $(ASC_COMPILER_SOURCES) ; |
330 |
MakeLocate $(ASC_COMPILER_LIB) : $(BUILD_DIR) ; |
331 |
|
332 |
DEPENDS libs : $(ASC_COMPILER_LIB) ; |
333 |
|
334 |
# Main $(ASC_COMPILER_LIBROOT)$(SUFSHR) : $(ASC_COMPILER_SOURCES) ; |
335 |
# MakeLocate $(ASC_COMPILER_LIB)$(SUFSHR) : $(BUILD_DIR) ; |
336 |
} |
337 |
|
338 |
#========================================================================= |
339 |
# General module |
340 |
#========================================================================= |
341 |
if $(BUILD_GENERAL) |
342 |
{ |
343 |
ASC_GENERAL_SOURCES = |
344 |
dstring.c |
345 |
hashpjw.c |
346 |
list.c |
347 |
listio.c |
348 |
pool.c |
349 |
pretty.c |
350 |
stack.c |
351 |
table.c |
352 |
tm_time.c |
353 |
; |
354 |
|
355 |
LOCATE_TARGET = $(BUILD_DIR)$(SLASH)general ; |
356 |
SEARCH_SOURCE = $(ASC_GENERAL_DIR) ; |
357 |
|
358 |
Library $(ASC_GENERAL_LIBROOT) : $(ASC_GENERAL_SOURCES) ; |
359 |
MakeLocate $(ASC_GENERAL_LIB) : $(BUILD_DIR) ; |
360 |
|
361 |
DEPENDS libs : $(ASC_GENERAL_LIB) ; |
362 |
} |
363 |
|
364 |
#========================================================================= |
365 |
# Solver module |
366 |
#========================================================================= |
367 |
if $(BUILD_SOLVER) |
368 |
{ |
369 |
ASC_SOLVER_SOURCES = |
370 |
analyze.c |
371 |
bnd.c |
372 |
bndman.c |
373 |
calc.c |
374 |
cond_config.c |
375 |
conditional.c |
376 |
conopt.c |
377 |
discrete.c |
378 |
linsol.c |
379 |
linsolqr.c |
380 |
linutils.c |
381 |
logrel.c |
382 |
logrelman.c |
383 |
model_reorder.c |
384 |
mps.c |
385 |
mtx_basic.c |
386 |
mtx_linal.c |
387 |
mtx_perms.c |
388 |
mtx_query.c |
389 |
mtx_reorder.c |
390 |
mtx_use_only.c |
391 |
rel.c |
392 |
relman.c |
393 |
rootfind.c |
394 |
slv.c |
395 |
slv0.c |
396 |
slv1.c |
397 |
slv2.c |
398 |
slv3.c |
399 |
slv6.c |
400 |
slv7.c |
401 |
slv8.c |
402 |
slv9.c |
403 |
slv9a.c |
404 |
slvDOF.c |
405 |
slv_common.c |
406 |
slv_interface.c |
407 |
slv_stdcalls.c |
408 |
system.c |
409 |
var.c |
410 |
; |
411 |
|
412 |
LOCATE_TARGET = $(BUILD_DIR)$(SLASH)solver ; |
413 |
SEARCH_SOURCE = $(ASC_SOLVER_DIR) ; |
414 |
|
415 |
Library $(ASC_SOLVER_LIBROOT) : $(ASC_SOLVER_SOURCES) ; |
416 |
MakeLocate $(ASC_SOLVER_LIB) : $(BUILD_DIR) ; |
417 |
ObjectCcFlags $(ASC_SOLVER_SOURCES) : $(SOLVER_DEFS) ; |
418 |
|
419 |
# TODO: remove when Tcl/Tk interface decoupled from base library |
420 |
ObjectHdrs slv6.c slv_interface.c : $(ASC_INTERFACE_ROOT) ; |
421 |
|
422 |
DEPENDS libs : $(ASC_SOLVER_LIB) ; |
423 |
} |
424 |
|
425 |
#========================================================================= |
426 |
# Utilities module |
427 |
#========================================================================= |
428 |
if $(BUILD_UTILITIES) |
429 |
{ |
430 |
ASC_UTILITIES_SOURCES = |
431 |
ascDynaLoad.c |
432 |
ascEnvVar.c |
433 |
ascMalloc.c |
434 |
ascPanic.c |
435 |
ascPrint.c |
436 |
ascSignal.c |
437 |
mem.c |
438 |
readln.c |
439 |
set.c |
440 |
; |
441 |
|
442 |
LOCATE_TARGET = $(BUILD_DIR)$(SLASH)utilities ; |
443 |
SEARCH_SOURCE = $(ASC_UTILITIES_DIR) ; |
444 |
|
445 |
Library $(ASC_UTILITIES_LIBROOT) : $(ASC_UTILITIES_SOURCES) ; |
446 |
MakeLocate $(ASC_UTILITIES_LIB) : $(BUILD_DIR) ; |
447 |
|
448 |
# TODO: remove when Tcl/Tk decoupled from base library |
449 |
ObjectHdrs ascPrint.c : $(TK_HDRS) ; |
450 |
|
451 |
DEPENDS libs : $(ASC_UTILITIES_LIB) ; |
452 |
} |
453 |
|
454 |
#========================================================================= |
455 |
# Packages module |
456 |
#========================================================================= |
457 |
if $(BUILD_PACKAGES) |
458 |
{ |
459 |
ASC_PACKAGES_SOURCES = |
460 |
sensitivity.c |
461 |
ascFreeAllVars.c |
462 |
; |
463 |
|
464 |
LOCATE_TARGET = $(BUILD_DIR)$(SLASH)packages ; |
465 |
SEARCH_SOURCE = $(ASC_PACKAGES_DIR) ; |
466 |
|
467 |
Library $(ASC_PACKAGES_LIBROOT) : $(ASC_PACKAGES_SOURCES) ; |
468 |
MakeLocate $(ASC_PACKAGES_LIB) : $(BUILD_DIR) ; |
469 |
|
470 |
DEPENDS libs : $(ASC_PACKAGES_LIB) ; |
471 |
} |
472 |
|
473 |
#====================================================================== |
474 |
# ASCEND base regression test |
475 |
#====================================================================== |
476 |
|
477 |
TEST_PROG = test_ascend_base ; |
478 |
|
479 |
# set location for target, source, and temporary files |
480 |
LOCATE_TARGET = $(BUILD_DIR)$(SLASH)test ; |
481 |
SEARCH_SOURCE = |
482 |
$(ASC_COMPILER_DIR)$(SLASH)test |
483 |
$(ASC_GENERAL_DIR)$(SLASH)test |
484 |
$(ASC_SOLVER_DIR)$(SLASH)test |
485 |
$(ASC_UTILITIES_DIR)$(SLASH)test |
486 |
$(ASC_PACKAGES_DIR)$(SLASH)test |
487 |
$(srcdir)$(SLASH)test |
488 |
$(srcdir)$(SLASH)..$(SLASH)..$(SLASH)test ; |
489 |
|
490 |
# extra symbolic targets for building test program |
491 |
DEPENDS tests : $(TEST_PROG)$(SUFEXE) ; |
492 |
NOTFILE tests ; |
493 |
|
494 |
TEST_SOURCES = |
495 |
assertimpl.c |
496 |
printutil.c |
497 |
redirectStdStreams.c |
498 |
test_ascend_base.c |
499 |
test_register_general.c |
500 |
test_dstring.c |
501 |
test_hashpjw.c |
502 |
test_list.c |
503 |
test_listio.c |
504 |
test_pool.c |
505 |
test_pretty.c |
506 |
test_stack.c |
507 |
test_table.c |
508 |
test_tm_time.c |
509 |
test_register_utilities.c |
510 |
test_ascDynaLoad.c |
511 |
test_ascEnvVar.c |
512 |
test_ascMalloc.c |
513 |
test_ascPanic.c |
514 |
test_ascPrint.c |
515 |
test_ascSignal.c |
516 |
test_mem.c |
517 |
test_readln.c |
518 |
test_set.c |
519 |
test_register_solver.c |
520 |
test_slv_common.c |
521 |
# test_slv.c |
522 |
; |
523 |
|
524 |
CCFLAGS on $(TEST_SOURCES) += |
525 |
-I..$(SLASH)..$(SLASH)test |
526 |
-DALLOCATED_TESTS |
527 |
; |
528 |
|
529 |
Main $(TEST_PROG) : $(TEST_SOURCES) ; |
530 |
MakeLocate $(TEST_PROG)$(SUFEXE) : $(BUILD_DIR) ; |
531 |
|
532 |
CUNIT_LIB_NAME = libcunit ; |
533 |
|
534 |
if $(NT) |
535 |
{ |
536 |
if ($(BCCROOT) || ($(TOOLSET) = BORLANDC)) |
537 |
{ |
538 |
# need to fix Borland to include library location |
539 |
LINKFLAGS on $(TEST_PROG)$(SUFEXE) += -L$(STDLIBPATH) -tWC ; |
540 |
} |
541 |
else if $(MINGW) || ( $(TOOLSET) = MINGW ) |
542 |
{ |
543 |
CUNIT_LIB_NAME = libcunit_mingw ; |
544 |
} |
545 |
} |
546 |
|
547 |
if $(UNIX) || $(OS) = LINUX |
548 |
{ |
549 |
LINKFLAGS on $(TEST_PROG)$(SUFEXE) += $(DL_LIBS) $(MATH_LIBS) ; |
550 |
} |
551 |
|
552 |
LinkLibraries $(TEST_PROG) : |
553 |
$(ASC_BASE_LIBS) |
554 |
$(ASC_BASE_LIBS) |
555 |
..$(SLASH)..$(SLASH)test$(SLASH)$(CUNIT_LIB_NAME)$(SUFLIB) |
556 |
; |
557 |
|
558 |
#LINKLIBS on $(TEST_PROG)$(SUFEXE) += |
559 |
# $(FOR_LIBS) |
560 |
# $(PC_LIBS) |
561 |
# $(MATH_LIBS) |
562 |
# $(DL_LIBS) |
563 |
# $(DEBUG_LIBS) |
564 |
# ; |
565 |
|