/[ascend]/trunk/base/jam/Jamfile
ViewVC logotype

Contents of /trunk/base/jam/Jamfile

Parent Directory Parent Directory | Revision Log Revision Log


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

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