# # Jamfile to build Ascend4 base libraries # (see http://www.freetype.org/jam/index.html) # # This file is part of the Ascend Build System. # # Copyright (C) 2005 Jerry D. St.Clair # # The Ascend Build System is free software; you can redistribute # it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with the program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. # Check the file named COPYING. #--------------------------------------------------------------------------- # # UNDER CONSTRUCTION # # This Jamfile builds the base library subset of ASCEND using the jam # build tool as a set of static libraries. A regression test suite for # the base libraries is also built. # # This file is part of the ASCEND jam build system rooted at ../../jam. # See ../../jam/ReadMe.txt for more information. # #------------------------------------------------------------------------- # # File-specific Build Instructions # # 1. Follow the general instructions in ../../jam/ReadMe.txt for your platform. # # 2. To generate the base libraries, run: # jam libs # # 3. A prototype CUnit test suite may also be built. At this point it # only covers the general and utilities components. For maximal # testing, NODEBUG should be commented and DEBUG_MALLOC and # ALLOCATED_TESTS should be active in ../../jam/Jamrules. The # ASCEND base libs should be built with these options also. # Build the tests using: # jam tests # #------------------------------------------------------------------------- SubDir TOP base generic ; if ! $(JAMRULES_ALREADY_SEEN) { include $(TOP)$(SLASH)jam$(SLASH)Jamrules ; } srcdir = $(TOP)$(SLASH)base$(SLASH)generic ; # Build flags for Ascend base libraries BUILD_COMPILER = 1 ; BUILD_GENERAL = 1 ; BUILD_SOLVER = 1 ; BUILD_UTILITIES = 1 ; BUILD_PACKAGES = 1 ; # Ascend modules subdirectories ASC_COMPILER_DIR = $(srcdir)$(SLASH)compiler ; ASC_GENERAL_DIR = $(srcdir)$(SLASH)general ; ASC_SOLVER_DIR = $(srcdir)$(SLASH)solver ; ASC_UTILITIES_DIR = $(srcdir)$(SLASH)utilities ; ASC_PACKAGES_DIR = $(srcdir)$(SLASH)packages ; HDRS += $(srcdir) ; DEPENDS all : libs ; NOTFILE libs ; # Location of old Ascend Tcl/Tk interface sources. # Some solver modules include headers originally located in # the Tcl/Tk-specific interface subdirectory. Until the # source is reorganized to decouple the base and interface # components, we have to be able to find those headers # TODO: remove/rework when Tcl/Tk decoupled from base library ASC_INTERFACE_ROOT = $(TOP)$(SLASH)tcltk98$(SLASH)generic ; #========================================================================= # Compiler module #========================================================================= if $(BUILD_COMPILER) { ASC_COMPILER_SOURCES = anoncopy.c anonmerg.c anontype.c arrayinst.c ascCompiler.c ascParse.c atomsize.c atomvalue.c bintoken.c bit.c braced.c case.c check.c child.c childdef.c childio.c childinfo.c cmpfunc.c commands.c copyinst.c createinst.c destroyinst.c dimen.c dimen_io.c dump.c evaluate.c exprio.c exprs.c exprsym.c extcall.c extfunc.c extinst.c find.c forvars.c fractions.c freestore.c func.c initialize.c instance.c instance_io.c instantiate.c instmacro.c instquery.c interval.c library.c linkinst.c logrel_io.c logrel_util.c logrelation.c mathinst.c mergeinst.c module.c name.c nameio.c notate.c numlist.c packages.c parentchild.c parpend.c pending.c proc.c procframe.c procio.c prototype.c qlfdid.c redirectFile.c refineinst.c rel_common.c relation.c relation_io.c relation_util.c rootfind.c rounded.c safe.c scanner.c select.c setinst_io.c setinstval.c setio.c sets.c slist.c simlist.c statement.c statio.c switch.c symtab.c syntax.c temp.c tmpnum.c type_desc.c type_descio.c typedef.c typelint.c units.c universal.c value_type.c visitinst.c visitlink.c vlist.c vlistio.c watchpt.c watchptio.c when.c when_io.c when_util.c ; SEARCH on $(ASC_COMPILER_SOURCES) = $(ASC_COMPILER_DIR) ; #---------------------------------------------------------------------- # rounded.c needs a special define #---------------------------------------------------------------------- CCFLAGS on rounded$(SUFOBJ) += -DSLOPPY ; #---------------------------------------------------------------------- # ascParse.c & ascParse.h # # ascParse implements the Ascend grammar. It is generated by # yacc with modification (e.g. by sed) to change the default # 'yy' prefixes to 'zz_'. If yacc and sed are available in # the build environment (i.e. $(YACC) and $(SED) are non-null # in jam), ascParse.c and ascParse.h are generated using these # tools. If not, copies of pre-generated files are used instead. #---------------------------------------------------------------------- # ascParse.c needs a special define CCFLAGS on ascParse$(SUFOBJ) += -DYY_USE_CONST ; rule make_ascParse { if $(YACC) && $(SED) { Echo Generating ascParse from $(YACC) and $(SED) ; DEPENDS $(ascParse_c) $(ascParse_h) : $(ascParse_y) ; Yacc1 $(ascParse_c) $(ascParse_h) : $(ascParse_y) ; YaccMv $(ascParse_c) $(ascParse_h) : $(ascParse_y) ; yy_to_zz_c $(ascParse_c) : $(ascParse_y) ; yy_to_zz_h $(ascParse_h) : $(ascParse_y) ; } else { Echo Copying ascParse.* from ascParse.*.no.yacc ; File $(ascParse_c) : ascParse.c.no.yacc ; File $(ascParse_h) : ascParse.h.no.yacc ; } # make the header dependent INCLUDES $(ascParse_c) : $(ascParse_h) ; Clean clean : $(ascParse_c) $(ascParse_h) ; } actions yy_to_zz_c { $(SED) -e "/#ifndef YYSTYPE/,/#endif/d" -e "/^#line /d" -e "s\yy\zz_\g" -e "s\YY\ZZ_\g" $(1) > tempfile.tmp $(MV) tempfile.tmp $(1) } actions yy_to_zz_h { $(SED) -e "s\yy\zz_\g" -e "s\YY\ZZ_\g" $(1) > tempfile.tmp $(MV) tempfile.tmp $(1) } ascParse_c = [ FGristSourceFiles ascParse.c ] ; ascParse_h = [ FGristSourceFiles ascParse.h ] ; ascParse_y = ascParse.y ; LOCATE on $(ascParse_c) = $(ASC_COMPILER_DIR) ; LOCATE on $(ascParse_h) = $(ASC_COMPILER_DIR) ; LOCATE on $(ascParse_y) = $(ASC_COMPILER_DIR) ; make_ascParse ; #---------------------------------------------------------------------- # scanner.c # # scanner.c implements the Ascend lexical analyzer. It is # generated by lex/flex if available in the build environment # (i.e. $(LEX) is non-null in jam). If lex/flex is not available, # the a copy of a pre-generated file is used instead. #---------------------------------------------------------------------- # scanner.c needs a special define (Watcom requires the '=""'. ) CCFLAGS on scanner$(SUFOBJ) += -DYY_USE_CONST="" ; scanner_c = [ FGristSourceFiles scanner.c ] ; scanner_h = scanner.h ; scanner_l = scanner.l ; LEXOPTS on $(scanner_c) = -Pzz_ ; LOCATE on $(scanner_c) = $(ASC_COMPILER_DIR) ; LOCATE on $(scanner_h) = $(ASC_COMPILER_DIR) ; LOCATE on $(scanner_l) = $(ASC_COMPILER_DIR) ; LEX_or_copy $(scanner_c) : $(scanner_l) : scanner_c_no_flex : $(scanner_h) ; #---------------------------------------------------------------------- # Build the compiler library #---------------------------------------------------------------------- LOCATE_TARGET = $(BUILD_DIR)$(SLASH)compiler ; SEARCH_SOURCE = $(ASC_COMPILER_DIR) ; Library $(ASC_COMPILER_LIBROOT) : $(ASC_COMPILER_SOURCES) ; MakeLocate $(ASC_COMPILER_LIB) : $(BUILD_DIR) ; DEPENDS libs : $(ASC_COMPILER_LIB) ; # Main $(ASC_COMPILER_LIBROOT)$(SUFSHR) : $(ASC_COMPILER_SOURCES) ; # MakeLocate $(ASC_COMPILER_LIB)$(SUFSHR) : $(BUILD_DIR) ; } #========================================================================= # General module #========================================================================= if $(BUILD_GENERAL) { ASC_GENERAL_SOURCES = dstring.c hashpjw.c list.c listio.c pool.c pretty.c stack.c table.c tm_time.c ; LOCATE_TARGET = $(BUILD_DIR)$(SLASH)general ; SEARCH_SOURCE = $(ASC_GENERAL_DIR) ; Library $(ASC_GENERAL_LIBROOT) : $(ASC_GENERAL_SOURCES) ; MakeLocate $(ASC_GENERAL_LIB) : $(BUILD_DIR) ; DEPENDS libs : $(ASC_GENERAL_LIB) ; } #========================================================================= # Solver module #========================================================================= if $(BUILD_SOLVER) { ASC_SOLVER_SOURCES = analyze.c bnd.c bndman.c calc.c cond_config.c conditional.c conopt.c discrete.c linsol.c linsolqr.c linutils.c logrel.c logrelman.c model_reorder.c mps.c mtx_basic.c mtx_linal.c mtx_perms.c mtx_query.c mtx_reorder.c mtx_use_only.c rel.c relman.c slv.c slv0.c slv1.c slv2.c slv3.c slv6.c slv7.c slv8.c slv9.c slv9a.c slvDOF.c slv_common.c slv_interface.c slv_stdcalls.c system.c var.c ; LOCATE_TARGET = $(BUILD_DIR)$(SLASH)solver ; SEARCH_SOURCE = $(ASC_SOLVER_DIR) ; Library $(ASC_SOLVER_LIBROOT) : $(ASC_SOLVER_SOURCES) ; MakeLocate $(ASC_SOLVER_LIB) : $(BUILD_DIR) ; ObjectCcFlags $(ASC_SOLVER_SOURCES) : $(SOLVER_DEFS) ; # TODO: remove when Tcl/Tk interface decoupled from base library ObjectHdrs slv6.c slv_interface.c : $(ASC_INTERFACE_ROOT) ; DEPENDS libs : $(ASC_SOLVER_LIB) ; } #========================================================================= # Utilities module #========================================================================= if $(BUILD_UTILITIES) { ASC_UTILITIES_SOURCES = ascDynaLoad.c ascEnvVar.c ascMalloc.c ascPanic.c ascPrint.c error.c ascSignal.c mem.c readln.c set.c ; LOCATE_TARGET = $(BUILD_DIR)$(SLASH)utilities ; SEARCH_SOURCE = $(ASC_UTILITIES_DIR) ; Library $(ASC_UTILITIES_LIBROOT) : $(ASC_UTILITIES_SOURCES) ; MakeLocate $(ASC_UTILITIES_LIB) : $(BUILD_DIR) ; # TODO: remove when Tcl/Tk decoupled from base library ObjectHdrs ascPrint.c : $(TK_HDRS) ; DEPENDS libs : $(ASC_UTILITIES_LIB) ; } #========================================================================= # Packages module #========================================================================= if $(BUILD_PACKAGES) { ASC_PACKAGES_SOURCES = sensitivity.c ascFreeAllVars.c ; LOCATE_TARGET = $(BUILD_DIR)$(SLASH)packages ; SEARCH_SOURCE = $(ASC_PACKAGES_DIR) ; Library $(ASC_PACKAGES_LIBROOT) : $(ASC_PACKAGES_SOURCES) ; MakeLocate $(ASC_PACKAGES_LIB) : $(BUILD_DIR) ; DEPENDS libs : $(ASC_PACKAGES_LIB) ; } #====================================================================== # ASCEND base regression test #====================================================================== TEST_PROG = test_ascend_base ; # set location for target, source, and temporary files LOCATE_TARGET = $(BUILD_DIR)$(SLASH)test ; SEARCH_SOURCE = $(ASC_COMPILER_DIR)$(SLASH)test $(ASC_GENERAL_DIR)$(SLASH)test $(ASC_SOLVER_DIR)$(SLASH)test $(ASC_UTILITIES_DIR)$(SLASH)test $(ASC_PACKAGES_DIR)$(SLASH)test $(srcdir)$(SLASH)test $(srcdir)$(SLASH)..$(SLASH)..$(SLASH)test ; # extra symbolic targets for building test program DEPENDS tests : $(TEST_PROG)$(SUFEXE) ; NOTFILE tests ; TEST_SOURCES = assertimpl.c printutil.c redirectStdStreams.c test_ascend_base.c test_register_general.c test_dstring.c test_hashpjw.c test_list.c test_listio.c test_pool.c test_pretty.c test_stack.c test_table.c test_tm_time.c test_register_utilities.c test_ascDynaLoad.c test_ascEnvVar.c test_ascMalloc.c test_ascPanic.c test_ascPrint.c test_ascSignal.c test_mem.c test_readln.c test_set.c test_register_solver.c test_slv_common.c # slv_test.c # test_slv.c ; CCFLAGS on $(TEST_SOURCES:S=$(SUFOBJ)) += -I..$(SLASH)..$(SLASH)test -DALLOCATED_TESTS ; Main $(TEST_PROG) : $(TEST_SOURCES) ; MakeLocate $(TEST_PROG)$(SUFEXE) : $(BUILD_DIR) ; CUNIT_LIB_NAME = libcunit ; if $(NT) { if ($(BCCROOT) || ($(TOOLSET) = BORLANDC)) { # need to fix Borland to include library location LINKFLAGS on $(TEST_PROG)$(SUFEXE) += -L$(STDLIBPATH) -tWC ; } else if $(MINGW) || ( $(TOOLSET) = MINGW ) { CUNIT_LIB_NAME = libcunit_mingw ; } } if $(UNIX) || $(OS) = LINUX { LINKFLAGS on $(TEST_PROG)$(SUFEXE) += $(DL_LIBS) $(MATH_LIBS) ; } LinkLibraries $(TEST_PROG) : $(ASC_BASE_LIBS) $(ASC_BASE_LIBS) $(TOP)$(SLASH)test$(SLASH)$(CUNIT_LIB_NAME)$(SUFLIB) ; #LINKLIBS on $(TEST_PROG)$(SUFEXE) += # $(FOR_LIBS) # $(PC_LIBS) # $(MATH_LIBS) # $(DL_LIBS) # $(DEBUG_LIBS) # ;