# # General Jamrules support file for building Ascend4 # (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 is a template Jamrules file which supports building the # Ascend libraries and executables. It contains general variable # and rule definitions required for execution of jam in any of the # source subdirectories. # # This file is part of the ASCEND jam build system rooted at ../../jam. # See ../../jam/ReadMe.txt for more information. # # This file is customized on unix/linux by configure. # # On other platforms, users should copy/rename this file to 'Jamrules', # then modify the settings manually for their particular system. # Ascend cannot be built by jam unless the Jamrules file is present. # # User-customized Jamrules files should not be placed in version # control. Only the Jamrules.in template should be versioned. # #--------------------------------------------------------------------------- JAMRULES_ALREADY_SEEN = TRUE ; # The slash thing gets messed up sith SubDir somehow - make sure it's correct! SLASH = / ; if $(NT) { SLASH = \\ ; } # Comment to compile with debugging & assertions enabled. # Should be commented for regression tests to work properly. #NODEBUG = 1 ; # Comment to compile without using the Epperly malloc debugger # Should be UNcommented for regression tests to work properly. DEBUG_MALLOC = -DMALLOC_DEBUG -DALLOCATED_TESTS ; #====================================================================== # PACKAGES # # Package settings for building Ascend. # Packages are bits of compiled code that represent models, or solvers, # or, in general, any bits of external code. # # Choose one of the following, comment out the others: # STATIC_PACKAGES packages should be statically linked/loaded # DYNAMIC_PACKAGES packages should be dynamically linked/loaded # NO_PACKAGES no packages # # If STATIC_PACKAGES are chosen, also indicate the location of # the packages in PACK_LIBS. Otherwise leave PACK_LIBS empty. #====================================================================== #PACKAGE_FLAGS = -DSTATIC_PACKAGES ; PACKAGE_FLAGS = -DDYNAMIC_PACKAGES ; #PACKAGE_FLAGS = -DNO_PACKAGES ; PACK_LIBS = $(ASC_PACKAGES_LIB_PATH) ; #PACK_LIBS = ; #====================================================================== # SIGNAL TRAPS # # If you want to be able to interrupt ASCEND with ctrl-C, then comment the # following line. Uncomment the line for disabling of ctrl-C. # # Comment the line for regression testing to work properly. #====================================================================== #CCFLAGS += -DNO_SIGINT_TRAP -DNO_SIGSEGV_TRAP ; #--------------------------------------------------------------------------- # Tools required for complete build (comment out if not present). # The build system works around their absence if necessary. # Note that they are available for Windows, for example: # http://sourceforge.net/projects/gnuWin32 SED = sed ; YACC = yacc ; YACCFLAGS = -d ; YACCFILES = y.tab ; LEX = flex ; #====================================================================== # General build options #====================================================================== # Build directory - - will be qualified for compiler & build type BUILD_DIR_ROOT = $(TOP)$(SLASH)jam ; # Comment for normal jam deletion of object files after building targets KEEPOBJS = true ; #--------------------------------------------------------------------------- # platform-independent options #--------------------------------------------------------------------------- # sizeof(void*) - change value if not a typical 32-bit system # the following are defined by Autoconf, so uncomment if you don't have that: # SIZEOF_VOID_P = 4 ; # CCFLAGS += -DSIZEOF_VOID_P=$(SIZEOF_VOID_P) ; CCFLAGS += $(PACKAGE_FLAGS) ; if $(NODEBUG) { CCFLAGS += -DNDEBUG ; BUILD_SUBDIR = $(SLASH)Release ; } else { BUILD_SUBDIR = $(SLASH)Debug ; } #--------------------------------------------------------------------------- # platform- & complier-specific options #--------------------------------------------------------------------------- if $(NT) { # Windows-specific commands not done right in Jambase RM = del ; MV = move /Y ; # Windows-specific defines CCFLAGS += -D_X86_=1 -DWIN32 -D_WIN32 -DASC_BUILD_LIB ; SUFSHR = .dll ; if $(BCCROOT) || ( $(TOOLSET) = BORLANDC ) { CC = bcc32 ; C++ = $(CC) ; FORTRAN = ; CCFLAGS += -q -d -g0 -j0 -K -DMOD_ASCMALLOC ; CCWARN = -w ; if $(NODEBUG) { CCDEBUG = -v- -O2 ; } else { CCDEBUG = -v -y -Od ; } C++FLAGS = $(CCFLAGS) ; LINKFLAGS += -L$(STDLIBPATH) ; COFF2OMF = coff2omf ; # add location if not in path BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)bcc ; } else if $(MSVCNT) || ( $(TOOLSET) = VISUALC ) { CC = cl /nologo ; C++ = $(CC) ; FORTRAN = ; CCFLAGS += /Ze ; CCWARN = /W4 ; if $(NODEBUG) { CCDEBUG = /O2 ; } else { CCDEBUG = /Zi /Od ; } # Libraries are in different paths depending on VC version LINKFLAGS += /LIBPATH:$(VISUALC)\\lib /LIBPATH:$(VISUALC)\\PlatformSDK\\lib\\ ; LINKLIBS = advapi32.lib libc.lib oldnames.lib gdi32.lib user32.lib kernel32.lib ; BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)msvc ; } else if $(MINGW) || ( $(TOOLSET) = MINGW ) { CC = gcc ; C++ = $(CC) ; CCFLAGS += -DHAVE_ERF=1 ; # uncomment to select desired warning level and ansi-strictness CCWARN += -Wall ; CCWARN += -W ; CCWARN += -pedantic ; #CCWARN += -Wshadow ; #CCWARN += -ansi ; CCWARN += -std=c99 ; if $(NODEBUG) { CCDEBUG = -O3 ; } else { CCDEBUG = -g -O0 ; CCFLAGS += -ggdb ; } C++FLAGS = $(CCFLAGS) ; FORTRAN = g77 ; FORTRANFLAGS = -c -I4 -O ; F77_LIBS = $(MINGW)$(SLASH)lib$(SLASH)libg2c.a ; BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)mingw ; } else if $(WATCOM) || ( $(TOOLSET) = WATCOM ) { CC = wcc386 ; C++ = wpp386 ; FORTRAN = wfc386 ; FORTRANFLAGS = /NOER ; CCFLAGS += /fr /dMOD_ASCMALLOC ; CCWARN = /wx ; if $(NODEBUG) { CCDEBUG = /ox ; FORTRANFLAGS += /OX ; } else { CCDEBUG = /od /d2 ; FORTRANFLAGS += /OD /D2 ; } BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)watcom ; } } else if $(UNIX) || $(OS) = LINUX { SUFSHR = @SHLIB_SUFFIX@ ; CC = @CC@ ; CPP = @CPP@ ; # DEFS = defines generated by configure CCFLAGS += @DEFS@ ; if $(CC) = gcc { if $(NODEBUG) { CCDEBUG = -O3 ; } else { CCDEBUG = -g -O0 ; Echo "DEBUGGER SYMBOLS TURNED ON" ; CCFLAGS += -ggdb ; } # uncomment to select desired warning level and ansi-strictness CCWARN += -Wall ; CCWARN += -W ; #CCWARN += -pedantic ; #CCWARN += -Wshadow ; #CCWARN += -ansi ; CCWARN += -std=c99 ; } # YACC # On some old systems yacc writes some K&R extern definitions to # the .c file that it generates. This has caused havoc on at least # one system. Define your yacc here. For the Suns in particular # /usr/lang/SC1.0/ansi/yacc was required. If you cannot find an ansi # compatible yacc, delete the 'extern char *malloc(), realloc() definitions # if generated at the top of your .c created from the .y file. # YACC = @YACC@ ; # LEX # We require the flex lexer # LEX = @LEX@ ; LEXLIB = @LEXLIB@ ; # Some compilers need to be told where to find the math libraries # -L$(MATH_LIB_DIRS) -lieee -lm ; MATH_LIBS = @MATH_LIBS@ ; # The interface and 1 file in the solver directory need to know where the # include files and library for X11 are. If your C compiler doesn't know # automatically where the X files are, or if they are in a non-standard # place, set the following variables to point at them. These should be # the same X files that Tk was built with on your system. # Most systems do not need these variables to be set. # # The include and library files for X11: X11_INCS = @X11_INCLUDES@ ; X11_LIBS = @X11_LIBRARIES@ -lX11 @X11_EXTRA_LIBS@ @X11_RUN_PATH@ ; # Library file(s) to link against for dynamic loading to work DL_LIBS = @DL_LIBS@ ; # FORTRAN options # your f77 compiler FORTRAN = @F77@ ; # Fortran compilation flags: # These are used for making the ASCEND libraries based on FORTRAN codes. # These should be set to get the best performance possible out of your # f77 compiler without optimizing away functions that are not obviously # called, as some compilers do by default. # F77FLAGS = -c -I4 -O ; # # F77LIBS is for the base f77 libraries. If you are linking no f77 # objects to ascend, it may be left undefined. # Set F77LIBS appropriate for your machine and desired loader behavior. # -L$(FOR_LIB_DIRS) -lg2c ; # F77_LIBS += @F77LIBS@ ; # # F77_OPTS are for miscellaneous options, such as -tmpdir= # F77_OPTS = ; # # All the flags to pass to F77 # FORTRANFLAGS = $(F77FLAGS) $(F77_OPTS) ; BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)linux ; } CCFLAGS += $(CCWARN) $(CCDEBUG) $(DEBUG_MALLOC) ; C++FLAGS = $(CCFLAGS) ; BUILD_DIR = $(BUILD_DIR_ROOT)$(BUILD_SUBDIR) ; #====================================================================== # Ascend base library names & paths #====================================================================== ASC_COMPILER_LIBROOT = libasc_compiler ; ASC_GENERAL_LIBROOT = libasc_general ; ASC_SOLVER_LIBROOT = libasc_solver ; ASC_UTILITIES_LIBROOT = libasc_utilities ; ASC_PACKAGES_LIBROOT = libasc_packages ; ASC_COMPILER_LIB = $(ASC_COMPILER_LIBROOT)$(SUFLIB) ; ASC_GENERAL_LIB = $(ASC_GENERAL_LIBROOT)$(SUFLIB) ; ASC_SOLVER_LIB = $(ASC_SOLVER_LIBROOT)$(SUFLIB) ; ASC_UTILITIES_LIB = $(ASC_UTILITIES_LIBROOT)$(SUFLIB) ; ASC_PACKAGES_LIB = $(ASC_PACKAGES_LIBROOT)$(SUFLIB) ; ASC_BASE_LIBS = $(ASC_COMPILER_LIB) $(ASC_GENERAL_LIB) $(ASC_PACKAGES_LIB) $(ASC_SOLVER_LIB) $(ASC_UTILITIES_LIB) ; # Path to base library sources & libs from top-level jam directory ASC_BASE_SOURCE_RELPATH = $(TOP)$(SLASH)base$(SLASH)generic ; ASC_BASE_LIBS_RELPATH = $(BUILD_DIR)$(SLASH) ; #====================================================================== # SOLVERS / INTEGRATORS # # If you are linking to MINOS or other external solvers, the solver # interface needs to know about it. # Set the comment flags as appropriate on the following definitions. # If the settings here do not match the libraries you link, you will # almost certainly get runtime errors if not link errors. #====================================================================== #------------------------------------------------------------------------------ # Slv is the original ASCEND nonlinear solver. It is not currently supported. # To build with slv: # - add -DSTATIC_SLV or -DDYNAMIC_SLV (unsupported) to SOLVER_DEFS # #SOLVER_DEFS += -DSTATIC_SLV ; #------------------------------------------------------------------------------ # OptSQP is an interface to the Larry Biegler OPT code. # It is not currently supported. # To build with optsqp: # - add -DSTATIC_OPTSQP or -DDYNAMIC_OPTSQP (unsupported) to SOLVER_DEFS # - add location of OPT library to FOR_LIBS # if $(UNIX) || $(OS) = LINUX { # SOLVER_DEFS += @HAVE_OPTSQP@ ; # FOR_LIBS += @OPTSQPLIB@ ; } else { #SOLVER_DEFS += -DSTATIC_OPTSQP ; #FOR_LIBS += ; } #------------------------------------------------------------------------------ # QRSlv is the current ASCEND nonlinear algebraic solver. # To build with slv: # - add -DSTATIC_SLV or -DDYNAMIC_SLV (unsupported) to SOLVER_DEFS # SOLVER_DEFS += -DSTATIC_QRSLV ; #------------------------------------------------------------------------------ # makeMPS is currently not supported. # To build with mps: # - add -DSTATIC_MPS or -DDYNAMIC_MPS (unsupported) to SOLVER_DEFS # #SOLVER_DEFS += -DSTATIC_MPS ; #------------------------------------------------------------------------------ # NGSlv is an experimental solver (Ken Tyner) that is not currently supported # To build with NGSlv: # - add -DSTATIC_NGSLV or -DDYNAMIC_NGSLV (unsupported) to SOLVER_DEFS # #SOLVER_DEFS += -DSTATIC_NGSLV ; #------------------------------------------------------------------------------ # CMSlv is the ASCEND conditional modeling solver (requires CONOPT). # To build with cmslv: # - add -DSTATIC_CMSLV or -DDYNAMIC_CMSLV (unsupported) to SOLVER_DEFS # #SOLVER_DEFS += -DSTATIC_CMSLV ; #------------------------------------------------------------------------------ # LRSlv is the ASCEND logical relation solver. # To build with lrslv: # - add -DSTATIC_LRSLV or -DDYNAMIC_LRSLV (unsupported) to SOLVER_DEFS # #SOLVER_DEFS += -DSTATIC_LRSLV ; #------------------------------------------------------------------------------ # MINOS is an interface to the MINOS solver. It is not currently functional. # To build with minos: # - add -DSTATIC_MINOS or -DDYNAMIC_MINOS (unsupported) to SOLVER_DEFS # - add location of MINOS library to FOR_LIBS if $(UNIX) || $(OS) = LINUX { # SOLVER_DEFS += @HAVE_MINOS@ ; # FOR_LIBS += @MINOSLIB@ ; } else { #SOLVER_DEFS += -DSTATIC_MINOS ; #FOR_LIBS += ; } #------------------------------------------------------------------------------ # CONOPT is an interface to the proprietary CONOPT solver. # To build with conopt: # - add -DSTATIC_CONOPT or -DDYNAMIC_CONOPT (unsupported) to SOLVER_DEFS # - add location of CONOPT library to FOR_LIBS if $(UNIX) || $(OS) = LINUX { # SOLVER_DEFS += @HAVE_CONOPT@ ; # FOR_LIBS += @CONOPTLIB@ ; } else { #SOLVER_DEFS += -DSTATIC_CONOPT ; #FOR_LIBS += ; } #------------------------------------------------------------------------------ # LSODE is an ODE solver. ASCEND is distributed with a standard lsode # implementation that can be used if you have FORTRAN and don't have an # optimized LSODE library. # To build with lsode: # - add -DSTATIC_LSOD or -DDYNAMIC_LSOD to SOLVER_DEFS # - if you are providing an optimized lsode library: # - add the location of the library to FOR_LIBS # - set BUILD_LSODE = FALSE to disable building of the standard lsode # if $(UNIX) || $(OS) = LINUX { SOLVER_DEFS += @HAVE_LSOD@ ; if ! @make_lsodlib@ { BUILD_LSODE = FALSE ; FOR_LIBS += @LSODLIB@ ; } } else { SOLVER_DEFS += -DSTATIC_LSOD ; FOR_LIBS += ; # uncomment the following if you are providing an external lsode library # BUILD_LSODE = FALSE ; } BUILD_LSODE ?= TRUE ; #====================================================================== # FORTRAN options - set to override configure defaults #====================================================================== # Your FORTRAN compiler #FORTRAN = g77 ; # Fortran compilation flags & options: # These are used for making the ASCEND libraries based on FORTRAN codes. # These should be set to get the best performance possible out of your # f77 compiler without optimizing away functions that are not obviously # called, as some compilers do by default. # #FORTRANFLAGS = -c -I4 -O -lg2c ; # F77LIBS is for the base f77 libraries. If you are linking no f77 # objects to ascend, it may be left undefined. # Set F77LIBS appropriate for your machine and desired loader behavior. # #F77_LIBS = ; #====================================================================== # FORTRAN Support Libraries # # Point BLASLIB and LPAKLIB to machine-specific BLAS and LINPACK # libraries (if you have them) to get the best speed out of ASCEND. # Otherwise, generic versions will be built if FORTRAN is available. #====================================================================== # Name & path to the blas library ASC_BLAS_LIBROOT = libblas ; ASC_BLAS_LIB = $(ASC_BLAS_LIBROOT)$(SUFLIB) ; BLASLIB_PATH = $(BUILD_DIR) ; BLASLIB = $(BLASLIB_PATH)$(SLASH)$(ASC_BLAS_LIB) ; # Name & path to the linpack library ASC_LINPACK_LIBROOT = liblpak ; ASC_LINPACK_LIB = $(ASC_LINPACK_LIBROOT)$(SUFLIB) ; LPAKLIB_PATH = $(BUILD_DIR) ; LPAKLIB = $(LPAKLIB_PATH)$(SLASH)$(ASC_LINPACK_LIB) ; # Name & path to the internal lsode library. if $(BUILD_LSODE) = TRUE { Echo Building internal LSODE library ; ASC_LSOD_LIBROOT = liblsode ; ASC_LSOD_LIB = $(ASC_LSOD_LIBROOT)$(SUFLIB) ; LSODLIB_PATH = $(BUILD_DIR) ; LSODLIB = $(LSODLIB_PATH)$(SLASH)$(ASC_LSOD_LIB) ; } FOR_LIBS += $(LSODLIB) $(LPAKLIB) $(BLASLIB) $(F77_LIBS) ; #====================================================================== # Ascend-specific jam instructions #====================================================================== #---------------------------------------------------------------------- # LEX_or_copy # # Generates a c source file using the lexer defined by $(LEX), # or by copying a specified file if $(LEX) is not defined. # The following parameters are used: # # 1 source file to generate # 2 lex/flex definition file # 3 pre-generated source file to copy if $(LEX) is empty # 4 header file associated with the source file, if any #---------------------------------------------------------------------- rule LEX_or_copy { if $(LEX) { Echo Generating $(1) from $(LEX) ; DEPENDS $(1) : $(2) ; Lex_with_options $(1) : $(2) ; } else { Echo Copying $(1) from $(4) ; File $(1) : $(3) ; } # make the header dependent if $(4) { INCLUDES $(1) : $(4) ; } Clean clean : $(1) ; } # run LEX using options specified in LEXOPTS actions Lex_with_options { $(LEX) $(LEXOPTS) -o$(1) $(2) }