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