1. Maker

Start python section to script/bin2hex.py[1 /1 ]
     1: #line 9 "./lpsrc/flx_maker.pak"
     2: # convert a binary file to hex
     3: import sys
     4: fn = sys.argv[1]
     5: f = open(fn)
     6: data = f.read()
     7: f.close()
     8: counter = 0
     9: for ch in data:
    10:   print ("%02x" % ord(ch)),
    11:   counter = counter + 1
    12:   if counter == 8:
    13:     print
    14:     counter = 0
    15: print
    16: 
End python section to script/bin2hex.py[1]
Start python section to script/fcount.py[1 /1 ]
     1: #line 26 "./lpsrc/flx_maker.pak"
     2: import glob
     3: import os
     4: import sys
     5: if '' not in sys.path: sys.path = ['']+sys.path
     6: import flxbuild
     7: from flxbuild.flxutil import *
     8: 
     9: try:
    10:   filename = sys.argv[1]
    11: except:
    12:   filename = "fcounts.stats"
    13: 
    14: try:
    15:   key = sys.argv[2]
    16: except:
    17:   key = "std"
    18: 
    19: try:
    20:   globspec = sys.argv[3]
    21: except:
    22:   globspec = "tut/examples/*.hpp"
    23: 
    24: print "function counter: STATS FILE",filename, "KEY", key, "GLOB",globspec
    25: dict = {}
    26: try:
    27:   execfile (filename)
    28: except:pass
    29: 
    30: files = glob.glob(globspec)
    31: 
    32: for file in files:
    33:   cmd = 'egrep "//PROC|//FUNCTION" ' + file + ' | wc -l'
    34:   output = xqt(cmd)[0][:-1]
    35:   x = int(output)
    36:   try:
    37:     d= dict[file]
    38:   except:
    39:     dict[file]={}
    40:     d = dict[file]
    41:   d[key]=x
    42: 
    43: f = open(filename,"w")
    44: f.write("dict="+repr(dict))
    45: f.close()
    46: 
End python section to script/fcount.py[1]
Start python section to script/pfcount.py[1 /1 ]
     1: #line 73 "./lpsrc/flx_maker.pak"
     2: import glob
     3: import os
     4: import sys
     5: try:
     6:   filename = sys.argv[1]
     7: except:
     8:   filename = "fcounts.stats"
     9: 
    10: only_nonopt = 0
    11: try:
    12:   x = sys.argv[2]
    13: except:
    14:   only_nonopt = 1
    15: 
    16: dict = {}
    17: try:
    18:   execfile (filename)
    19: except:pass
    20: 
    21: keys = {}
    22: i = 0
    23: for k in dict.keys():
    24:   i = max(i,len(k))
    25:   d = dict[k]
    26:   for key in d.keys():
    27:     keys[key]=None
    28: 
    29: keys = keys.keys()
    30: j=0
    31: for k in keys:
    32:   j = max(j,len(k))
    33: 
    34: print "Function counts for test programs"
    35: print "================================="
    36: print
    37: print ("%-"+str(i+2)+"s") % "File" + "    ",
    38: for t in keys:
    39:   print ("%"+str(j+2)+"s") % t,
    40: print
    41: print "--------"
    42: 
    43: skeys = dict.keys()
    44: skeys.sort()
    45: 
    46: for k in skeys:
    47:   d = dict[k]
    48:   x= ("%-"+str(i+2)+"s") % k + "..  "
    49:   discard = 0
    50:   for t in keys:
    51:     v = pkgdict.get(t,-1)
    52:     if v == -1:
    53:       v = ""
    54:     elif (v == 1 or v == 0) and t == "inline" and only_nonopt:
    55:       discard = 1
    56:       break
    57:     else:
    58:       v = str(v)
    59:     v = ("%"+str(j+2)+"s") % v
    60:     x = x+v
    61:   if not discard: print x
    62: 
End python section to script/pfcount.py[1]
Start python section to script/mk_expect[1 /1 ]
     1: #line 136 "./lpsrc/flx_maker.pak"
     2: import glob
     3: import sys
     4: for k in sys.argv[1:]:
     5:   files = glob.glob(k+'/*.output')
     6:   print '@head(1,"Expected outputs for '+k+'")'
     7:   for i in files:
     8:     j = i[:-7]+'.expect'
     9:     print '@head(2,"'+j+'")'
    10:     print '@select(tangler("'+j+'","data"))'
    11:     f = open(i,"r")
    12:     for l in f: print l,
    13:     f.close()
    14: 
    15: 
End python section to script/mk_expect[1]
Start python section to spkgs/tutorial.py[1 /1 ]
     1: #line 152 "./lpsrc/flx_maker.pak"
     2: pkg_requires = [
     3:   'flx_tutorial',
     4:   'flx_tut_macro',
     5:   'flx_tut_bind',
     6:   'flx_tut_migrate'
     7:   ]
     8: 
     9: iscr_source = [
    10:   'lpsrc/flx_tutorial',
    11:   'lpsrc/flx_tut_macro',
    12:   'lpsrc/flx_tut_bind',
    13:   'lpsrc/flx_tut_migrate',
    14:   ]
    15: 
End python section to spkgs/tutorial.py[1]
Start python section to spkgs/flx_maker.py[1 /1 ]
     1: #line 168 "./lpsrc/flx_maker.pak"
     2: iscr_source = ['lpsrc/flx_maker.pak']
     3: 
     4: weaver_directory = 'doc/flx/flx_maker/'
     5: 
End python section to spkgs/flx_maker.py[1]
Start python section to spkgs/ocs.py[1 /1 ]
     1: #line 174 "./lpsrc/flx_maker.pak"
     2: OCS_MODULES = [
     3:   'ocs_vartable',
     4:   'ocs_error',
     5:   'ocs_port',
     6:   'ocs_types',
     7:   'ocs_sym',
     8:   'ocs_env',
     9:   'ocs_char',
    10:   'ocs_numaux',
    11:   'ocs_complex',
    12:   'ocs_num',
    13:   'ocs_numstr',
    14:   'ocs_lex',
    15:   'ocs_misc',
    16:   'ocs_read',
    17:   'ocs_eval',
    18:   'ocs_list',
    19:   'ocs_compile',
    20:   'ocs_macro',
    21:   'ocs_prim',
    22:   'ocs_string',
    23:   'ocs_vector',
    24:   'ocs_print',
    25:   'ocs_io',
    26:   'ocs_contin',
    27:   'ocs_top',
    28: ]
    29: 
End python section to spkgs/ocs.py[1]
Start data section to umk[1 /1 ]
     1: #!/bin/sh
     2: python script/maker $*
     3: ec1=$?
     4: if [ $ec1 != 0 ]; then
     5:   exit $ec1
     6: fi
     7: 
End data section to umk[1]
Start data section to mk[1 /1 ]
     1: #!/bin/sh
     2: LOGFILE=mk_`date +"%Y-%m-%d-%H%M"`.log
     3: echo "Saving transcript to $LOGFILE" | tee -a $LOGFILE
     4: 
     5: exec 3>&1
     6: eval `exec 4>&1 >&3 3>&-
     7: {
     8:         (./umk $*) 4>&-; echo "ec1=$?;" >&4
     9: } 2>&1 | tee -a $LOGFILE
    10: echo "ec2=$?;" >&4
    11: `
    12: if [ $ec1 != 0 ]; then
    13:   exit $ec1
    14: fi
    15: 
End data section to mk[1]
Start data section to mk.bat[1 /1 ]
     1: python script\maker %1 %2 %3 %4 %5 %6 %7 %8 %9
End data section to mk.bat[1]
Start python section to mkplugins/man.py[1 /1 ]
     1: #line 234 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'man'
     4:   help = 'make the man pages'
     5: 
     6:   def runme(self):
     7:     print "GENERATING MAN PAGES"
     8:     mp = glob.glob('man/man1/*.1')
     9:     MAN_PAGES = []
    10:     for i in mp:
    11:       MAN_PAGES.append (i[9:])
    12:     try: os.mkdir("doc/htmlman")
    13:     except: pass
    14:     dtd = ('<!DOCTYPE HTML PUBLIC \\"-//W3C//DTD HTML 4.0 Transitional//EN\\"\\n'+
    15:       '  \\"http://www.w3.org/TR/REC-html40/loose.dtd\\">')
    16:     try:
    17:       for file in MAN_PAGES:
    18:         basename = os.path.splitext(file)[0]
    19:         vxqt(
    20:           "man2html man/man1/" + file +
    21:           '| sed -e "s%<A HREF=\\"[^<]*cgi-bin/man/man2html?1+\(.*\)\\">%<A HREF=\\"\\1_1.html\\">%"' +
    22:           '| sed -e "7d"' +
    23:           '| sed -e "1,3d"' +
    24:           '| sed -e "s%<html>%'+dtd+'\\n<html>%"' +
    25:           ' >' + "doc/htmlman/" + basename+'_1.html',
    26:         )
    27:     except:pass
    28: 
End python section to mkplugins/man.py[1]
Start python section to mkplugins/impldoc.py[1 /1 ]
     1: #line 262 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'impldoc'
     4:   help = 'make the ocaml compiler documentation'
     5: 
     6:   def runme(self):
     7:     print "GENERATING OCAMLDOCS"
     8:     erasedir('doc/impldoc')
     9:     os.mkdir('doc/impldoc')
    10:     try:
    11:       vxqt('ocamldoc -I src -d doc/impldoc src/*.mli -html')
    12:       vxqt('ocamldoc -I src -o doc/impldoc/flx_impl.tex src/*.mli -latex')
    13:       vxqt('(cd doc/impldoc; latex --interaction=batchmode flx_impl.tex && latex --interaction=batchmode flx_impl.tex && latex --interaction=batchmode flx_impl.tex)')
    14:     except:
    15:      pass # well ocamldoc is full of bugs ..
    16: 
End python section to mkplugins/impldoc.py[1]
Start python section to mkplugins/rtldoc.py[1 /1 ]
     1: #line 278 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'rtldoc'
     4:   help = 'make the runtime language documentation'
     5: 
     6:   def runme(self):
     7:     print "GENERATING RTLDOCS"
     8:     try:
     9:       vxqt("doxygen misc/doxconf.dox")
    10:     except:
    11:       pass
    12: 
End python section to mkplugins/rtldoc.py[1]
Start python section to mkplugins/copy_mli2ml.py[1 /1 ]
     1: #line 290 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'copy_mli2ml'
     4: 
     5:   def runme(self, MLIS):
     6:     for f in MLIS:
     7:       f = string.replace(f,"/",os.sep)
     8:       src = f+'.mli'
     9:       dst = f+'.ml'
    10:       if filetime(src) >= filetime (dst):
    11:         if not quiet: print("filecopy "+src+" -> "+dst)
    12:         filecopy(src,dst)
    13: 
End python section to mkplugins/copy_mli2ml.py[1]
Start python section to mkplugins/copy_hpp2rtl.py[1 /1 ]
     1: #line 303 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'copy_hpp2rtl'
     4: 
     5:   def runme(self, HPPS):
     6:     for f in HPPS:
     7:       dst = os.path.join('rtl', os.path.basename(f))
     8:       src = string.replace(f,"/",os.sep)
     9:       if filetime(src) >= filetime (dst):
    10:         if not quiet: print("filecopy "+src+" -> "+dst)
    11:         filecopy(src,dst)
    12: 
End python section to mkplugins/copy_hpp2rtl.py[1]
Start python section to mkplugins/build_ocaml_grammar.py[1 /1 ]
     1: #line 315 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'build_ocaml_grammar'
     4: 
     5:   def runme(self, pkg, LEXS, PARSES, force):
     6:     if not (LEXS or PARSES):
     7:       return force
     8: 
     9:     print "CAML BUILDING GRAMMAR", pkg
    10: 
    11:     # STEP 2: Generate lexers
    12:     for lex in LEXS:
    13:       file = string.replace(lex,'/',os.sep)
    14:       if not force:
    15:         if filetime(file+'.mll') >= filetime(file+'.ml'): force = 1
    16:       if force: vxqt(OCAMLLEX + file + '.mll')
    17: 
    18:     # STEP 3: Generate parsers
    19:     for parse in PARSES:
    20:       file = string.replace(parse,'/',os.sep)
    21:       if not force:
    22:         if filetime(file+'.mly') >= filetime(file+'.ml'): force = 1
    23:       if force:
    24:         vxqt(OCAMLYACC + ' -v '+ file + '.mly')
    25:         nxqt(ENV + ' ' + GREP + " conflict " + file + ".output")
    26: 
    27:     if LEXS or PARSES:
    28:       plugins['extract_grammar']()
    29: 
    30:     return force
End python section to mkplugins/build_ocaml_grammar.py[1]
Start python section to mkplugins/build_ocaml_modules.py[1 /1 ]
     1: #line 347 "./lpsrc/flx_maker.pak"
     2: #ocaml compilation
     3: class PLUGIN(Plugin):
     4:   name = 'build_ocaml_modules'
     5: 
     6:   def runme(self, pkg, INTERFACES, IMPLEMENTATIONS, INCLUDES, force):
     7:     if not (INTERFACES or IMPLEMENTATIONS):
     8:       return force
     9: 
    10:     print "CAML COMPILING", pkg
    11: 
    12:     # STEP 4: Compile ocaml interfaces
    13:     for interface in INTERFACES:
    14:       file = string.replace(interface,'/',os.sep)
    15:       if not force:
    16:         if filetime(file+'.mli') >= filetime(file+'.cmi'): force = 1
    17:       if force:
    18:         vxqt(OCAMLC + ' ' + INCLUDES + ' -c ' + file + '.mli')
    19: 
    20:     # STEP 5: Compile ocaml implementations
    21:     for implementation in IMPLEMENTATIONS:
    22:       file = string.replace(implementation,'/',os.sep)
    23:       if not force:
    24:         if filetime(file+'.ml') >= filetime(file + OCAML_OBJECT_EXTENSION):
    25:           force = 1
    26:       if force:
    27:         vxqt(OCAMLOPT + ' '+ INCLUDES + ' -c ' + file +'.ml')
    28: 
    29:     return force
End python section to mkplugins/build_ocaml_modules.py[1]
Start python section to mkplugins/build_ocaml_libraries.py[1 /1 ]
     1: #line 378 "./lpsrc/flx_maker.pak"
     2: #ocaml compilation
     3: class PLUGIN(Plugin):
     4:   name = 'build_ocaml_libraries'
     5: 
     6:   def runme(self, IMPLEMENTATIONS, lib, force):
     7:     if not IMPLEMENTATIONS:
     8:       return force
     9: 
    10:     print "CAML CREATING LIBRARY", lib
    11: 
    12:     # STEP 6: Build Ocaml Library
    13:     object_library_name = lib + OCAML_LIB_EXTENSION
    14:     linkstring = OCAMLOPT + " -a -o " + object_library_name + " "
    15:     library_filetime = filetime(object_library_name)
    16: 
    17:     force = 1
    18:     for implementation in IMPLEMENTATIONS:
    19:       linkstring = linkstring + implementation + OCAML_OBJECT_EXTENSION + " "
    20:     vxqt(linkstring)
    21: 
    22:     return force
End python section to mkplugins/build_ocaml_libraries.py[1]
Start python section to mkplugins/build_ocaml_exes.py[1 /1 ]
     1: #line 402 "./lpsrc/flx_maker.pak"
     2: #ocaml compilation
     3: class PLUGIN(Plugin):
     4:   name = 'build_ocaml_exes'
     5: 
     6:   def runme(self, EXES, OLIBRARIES, INCLUDES, force):
     7:     # finally, mainline *.cmx or cma files to link to executables
     8:     if not EXES:
     9:       return
    10: 
    11:     print "CAML LINKING EXECUTABLES"
    12:     x = ''
    13:     for library in OLIBRARIES:
    14:       x = x + ' ' + library + OCAML_LIB_EXTENSION
    15: 
    16:     for exe in EXES:
    17:       dst = os.path.join("bin", os.path.basename(exe))
    18:       vxqt(OCAMLOPT + INCLUDES + ' -o ' + dst + \
    19:           x + ' src/flx_version_hook.ml ' + exe + \
    20:           OCAML_OBJECT_EXTENSION)
End python section to mkplugins/build_ocaml_exes.py[1]
Start python section to mkplugins/build_ocamls.py[1 /1 ]
     1: #line 424 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'build_ocamls'
     4: 
     5:   def runme(self, pkg, pkgdict, force):
     6:     LEXS = pkgdict.get("caml_lexes", [])
     7:     PARSES = pkgdict.get("caml_parses", [])
     8: 
     9:     force = plugins['build_ocaml_grammar'].runme(pkg, LEXS, PARSES, force)
    10: 
    11:     INTERFACES = pkgdict.get("caml_interfaces", [])
    12:     IMPLEMENTATIONS = pkgdict.get("caml_implementations", [])
    13:     EXES = pkgdict.get("caml_exes", [])
    14:     INCLUDES = pkgdict.get("caml_include_paths", ['src'])
    15: 
    16:     # prepend -I to each include
    17:     if INCLUDES:
    18:       for i in range(len(INCLUDES)):
    19:         INCLUDES[i] = '-I ' + INCLUDES[i]
    20:     INCLUDES = string.join(INCLUDES)
    21: 
    22:     force = plugins['build_ocaml_modules'].runme(pkg, INTERFACES, IMPLEMENTATIONS + EXES, INCLUDES, force)
    23: 
    24:     lib = pkgdict.get('caml_provide_lib', 'src'+os.sep+pkg+"lib")
    25: 
    26:     force = plugins['build_ocaml_libraries'].runme(IMPLEMENTATIONS, lib, force)
    27: 
    28:     OLIBRARIES = pkgdict.get("caml_require_libs", [])
    29: 
    30:     plugins['build_ocaml_exes'].runme(EXES, OLIBRARIES, INCLUDES, force)
    31: 
    32:     return force
End python section to mkplugins/build_ocamls.py[1]
Start python section to mkplugins/build_host_tools.py[1 /1 ]
     1: #line 458 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'build_host_tools'
     4: 
     5:   def runme(self, pkg, pkgdict):
     6:     CCS = pkgdict.get("host_cc_ccs",[])
     7:     CPPS = pkgdict.get("host_cpp_cpps",[])
     8:     EXES = pkgdict.get("host_exes",[])
     9:     LIBS = pkgdict.get("host_exes_require_libs",[])
    10:     if len(CCS)+len(CPPS)+len(EXES)+len(LIBS)>0:
    11:       print "BUILDING HOST TOOLS"
    12:       pkglib = None
    13: 
    14:       if CCS:
    15:         print "HOST C COMPILING", pkg
    16:         pkglib = "lib"+pkg+"_host_static"
    17: 
    18:         HOST_C.build_static_rtl(vxqt, CCS, 'hostlib' + os.sep + pkglib,
    19:               include_paths=["rtl", "elk"],
    20:               macros=["FLX_STATIC_LINK"],
    21:               )
    22: 
    23:       if CPPS:
    24:         print "HOST C++ COMPILING", pkg
    25:         pkglib = "lib"+pkg+"_host_static"
    26: 
    27:         HOST_CXX.build_static_rtl(vxqt, CPPS, 'hostlib' + os.sep + pkglib,
    28:               include_paths=["rtl", "elk"],
    29:               macros=["FLX_STATIC_LINK"],
    30:               )
    31: 
    32:         for x in CCS+CPPS:
    33:           f = x + EXT_STATIC_OBJ
    34:           if verbose: print "Removing", f
    35:           deletefile(f) # delete the object files
    36: 
    37:       kwds = {\
    38:           'include_paths': ["rtl", "elk"],
    39:           'macros': ["FLX_STATIC_LINK"],
    40:           'CFLAGS': CFLAGS,
    41:           'LDFLAGS': SFLAGS,
    42:           }
    43: 
    44:       if pkglib:
    45:         kwds['lib_paths'] = ['hostlib']
    46:         kwds['libs'] = [pkglib]
    47: 
    48:       for src, bin in EXES:
    49:         apply(HOST_CXX.build_static_program, (vxqt, src, bin), kwds)
End python section to mkplugins/build_host_tools.py[1]
Start python section to mkplugins/build_testfile.py[1 /1 ]
     1: #line 509 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'build_test'
     4: 
     5:   def runme(self, testfile, log, quiet):
     6:     if log is None: log = Tee()
     7: 
     8:     optimise_c = optimise or "optimise_c" in options
     9:     mode = "std"
    10:     if optimise_c: mode = "Optimised"
    11: 
    12:     log.write('TRANSLATING %s\n' % testfile,quiet)
    13: 
    14:     basename = os.path.splitext(testfile)[0]
    15:     cppfilename = basename + ".cpp"
    16:     resfilename = basename + ".resh"
    17:     indir,infile = os.path.split(basename)
    18:     try:
    19:       flxg('-Ilib ' + FLXFLAGS + basename, log=log)
    20:     except MakeError, e:
    21:       log.write('TESTFILE -- ERROR! %s\n' % basename)
    22:       erasefile(basename+'.cpp')
    23:       erasefile(basename+'.hpp')
    24:       raise e
    25: 
    26:     cflags = vxqtq(os.path.join( "bin",
    27:       "flx_pkgconfig --path=config --field=cflags @"+resfilename),
    28:       log=log)
    29:     cflags = string.strip(cflags[0]) + " "
    30: 
    31:     #log.write('Compiling generated code of %s\n' % testfile)
    32:     try:
    33:       if SUPPORT_DYNAMIC_LOADING:
    34:         log.write("COMPILING GENERATED C++ TEST CODE: %s (dynamic)\n" % mode,quiet)
    35:         flush()
    36: 
    37:         dlibs = vxqtq(os.path.join("bin",
    38:           "flx_pkgconfig --path=config --field=provides_dlib --field=requires_dlibs @"+resfilename),
    39:           log=log)
    40:         dlibs = string.strip(dlibs[0]) + " "
    41: 
    42:         TARGET_CXX.build_shared_dll(
    43:             vxqt,
    44:             basename,
    45:             include_paths=["rtl"],
    46:             optimise=optimise_c,
    47:             debug=debug,
    48:             CFLAGS=CFLAGS+" "+cflags,
    49:             lib_paths=[SHLIB_DIR],
    50:             LDFLAGS=DFLAGS+dlibs,
    51:             log=log)
    52: 
    53:       if SUPPORT_STATIC_LINKAGE:
    54:         log.write("COMPILING GENERATED C++ TEST CODE: %s (static)\n" % mode,quiet)
    55:         flush()
    56: 
    57:         driver = vxqtq(os.path.join(
    58:           "bin",
    59:           "flx_pkgconfig -r --keeprightmost --path=config "
    60:           "--field=flx_requires_driver @"+resfilename),
    61:           log=log)
    62:         driver = string.strip(driver[0])
    63:         if driver == '': driver = 'flx_run'
    64: 
    65:         slibs = vxqtq(os.path.join(
    66:           "bin",
    67:           "flx_pkgconfig -r --keeprightmost --path=config "
    68:           "--field=provides_slib --field=requires_slibs "+driver+" @"+resfilename),
    69:           log=log)
    70:         slibs = string.strip(slibs[0])
    71:         #log.write("slibs=%s\n" % slibs)
    72: 
    73:         driver = driver + EXT_STATIC_OBJ
    74:         driver = os.path.join("rtl",driver)
    75:         #log.write('static driver =%s\n' % driver)
    76: 
    77:         TARGET_CXX.build_felix_static(
    78:           vxqt,
    79:           basename,
    80:           objects=[driver],
    81:           include_paths=["rtl"],
    82:           optimise=optimise_c,
    83:           debug=debug,
    84:           macros=["FLX_STATIC_LINK"],
    85:           CFLAGS=CFLAGS+" "+cflags,
    86:           lib_paths=["rtl"],
    87:           libs=[],
    88:           LDFLAGS=SFLAGS+slibs,
    89:           log=log)
    90: 
    91:       #log.write('TESTFILE -- OK! %s\n' % basename)
    92:     except MakeError, e:
    93:       log.write('TESTFILE -- ERROR! %s\n' % basename)
    94:       erasefile(basename+EXT_SHLIB)
    95:       erasefile(basename+EXT_EXE)
    96:       raise e
    97: 
    98:     return basename
    99: 
   100: 
End python section to mkplugins/build_testfile.py[1]
Start python section to mkplugins/diff_env.py[1 /1 ]
     1: #line 609 "./lpsrc/flx_maker.pak"
     2: if os.name == 'nt': # build system is Windows Python
     3:   DIFF = "FC /L /W"
     4:   GREP = "#grep"
     5: else:
     6:   #DIFF = "diff -a -b " # build system is Unix Python
     7:   # RF - trying out args that work on solaris (-a = not cool)
     8:   # could use that sys type stuff here?
     9:   DIFF = "diff -b" # build system is Unix Python
    10:   GREP = "grep"
    11: 
    12: 
End python section to mkplugins/diff_env.py[1]
Start python section to mkplugins/build.py[1 /1 ]
     1: #line 621 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'build'
     4:   help = 'build the sources'
     5: 
     6:   def __init__(self, *args, **kwds):
     7:     apply(Plugin.__init__, (self,) + args, kwds)
     8: 
     9:     if "extract" in options or "force_extract" in options:
    10:       if "build" not in phases: phases.append("build")
    11: 
    12:   def runme(self):
    13:     global phases
    14: 
    15:     if "build" not in phases: phases.append("build")
    16:     if "host" not in phases: phases.append("host")
    17:     if "target" not in phases: phases.append("target")
    18: 
    19: 
End python section to mkplugins/build.py[1]
Start python section to mkplugins/virgin.py[1 /1 ]
     1: #line 640 "./lpsrc/flx_maker.pak"
     2: #cleans everything
     3: class PLUGIN(Plugin):
     4:   name = 'virgin'
     5:   help = 'clean and remove all the sources'
     6: 
     7:   def runme(self):
     8:     for d in [ \
     9:         os.path.join("bagley", "data"),
    10:         os.path.join("bagley", "felix"),
    11:         "bagley",
    12:         "bin",
    13:         os.path.join("cpkgs", "build"),
    14:         os.path.join("cpkgs", "host"),
    15:         os.path.join("cpkgs", "target"),
    16:         "cpkgs",
    17:         os.path.join("demos", "faio"),
    18:         os.path.join("demos", "sdl"),
    19:         "demos",
    20:         "demux",
    21:         os.path.join("doc", "elkhound"),
    22:         os.path.join("doc", "flx"),
    23:         os.path.join("doc", "flxcc"),
    24:         os.path.join("doc", "gmp"),
    25:         os.path.join("doc", "grammar"),
    26:         os.path.join("doc", "gsl"),
    27:         os.path.join("doc", "htmlman"),
    28:         os.path.join("doc", "impldoc"),
    29:         os.path.join("doc", "mmap"),
    30:         os.path.join("doc", "opengl"),
    31:         os.path.join("doc", "refman"),
    32:         os.path.join("doc", "rtl"),
    33:         os.path.join("doc", "sdl"),
    34:         os.path.join("doc", "test"),
    35:         os.path.join("doc", "tutorial"),
    36:         "doc",
    37:         "elk",
    38:         "faio",
    39:         "flxbuild",
    40:         "hostlib",
    41:         "impldoc",
    42:         os.path.join("lib", "gsl"),
    43:         os.path.join("lib", "mpi"),
    44:         os.path.join("lib", "pari"),
    45:         os.path.join("lib", "GL"),
    46:         os.path.join("lib", "SDL"),
    47:         "lib",
    48:         os.path.join("man", "man1"),
    49:         "man",
    50:         "manifests",
    51:         os.path.join("meta", "godi"),
    52:         os.path.join("meta", "godiva"),
    53:         "meta",
    54:         os.path.join("misc", "vim"),
    55:         os.path.join("misc", "lua"),
    56:         os.path.join("misc", "jedit"),
    57:         "misc",
    58:         "mkplugin",
    59:         "oldebian",
    60:         "pkg",
    61:         os.path.join("pkg-stamps", "test", "regress"),
    62:         os.path.join("pkg-stamps", "test"),
    63:         os.path.join("pkg-stamps", "tut", "embedding"),
    64:         os.path.join("pkg-stamps", "tut", "macros"),
    65:         os.path.join("pkg-stamps", "tut", "migration"),
    66:         os.path.join("pkg-stamps", "tut", "tutorial"),
    67:         os.path.join("pkg-stamps", "tut"),
    68:         "pkg-stamps",
    69:         "pthread",
    70:         "rtl",
    71:         "script",
    72:         os.path.join("speed", "specs"),
    73:         os.path.join("speed", "src", "ada"),
    74:         os.path.join("speed", "src", "c"),
    75:         os.path.join("speed", "src", "felix"),
    76:         os.path.join("speed", "src", "haskell"),
    77:         os.path.join("speed", "src", "java"),
    78:         os.path.join("speed", "src", "ocaml"),
    79:         os.path.join("speed", "src", "pascal"),
    80:         os.path.join("speed", "src"),
    81:         os.path.join("speed", "xlators"),
    82:         "speed",
    83:         "spkgs",
    84:         "src",
    85:         os.path.join("src", "cil"),
    86:         os.path.join("test", "drivers"),
    87:         os.path.join("test", "faio"),
    88:         os.path.join("test", "gmp"),
    89:         os.path.join("test", "mmap"),
    90:         os.path.join("test", "pthread"),
    91:         os.path.join("test", "regress"),
    92:         os.path.join("test", "tre"),
    93:         "test",
    94:         "tmp",
    95:         os.path.join("tools", "lua"),
    96:         "tools",
    97:         "tre",
    98:         os.path.join("tut", "embedding"),
    99:         os.path.join("tut", "examples"),
   100:         os.path.join("tut", "macros"),
   101:         os.path.join("tut", "migration"),
   102:         os.path.join("tut", "sdl"),
   103:         os.path.join("tut", "tutorial"),
   104:         "tut",
   105:         "www",
   106:         ]:
   107:       for f in glob.glob(os.path.join(d, "*")):
   108:         print "Del",f
   109:         erasefile(f)
   110:       try:
   111:         if os.path.exists(d):
   112:           os.rmdir(d)
   113:           print "Rmdir",d
   114:       except:
   115:         print "FAILED Rmdir",d
   116:     for f in glob.glob(os.path.join(FLX_LPARCHIVE, "lpsrc", "*.cache")):
   117:       erasefile(f)
   118:     runISCR(os.path.join(FLX_LPARCHIVE, 'lpsrc', 'flx_config.pak'),1)
   119:     sys.exit(0)
   120: 
End python section to mkplugins/virgin.py[1]
Start python section to mkplugins/clean.py[1 /1 ]
     1: #line 760 "./lpsrc/flx_maker.pak"
     2: # cleans products, but not extracted sources
     3: class PLUGIN(Plugin):
     4:   name = 'clean'
     5:   help = 'remove generated C++ and binaries from test locations'
     6: 
     7:   def runme(self):
     8:     for d in glob.glob(os.path.join("pkg-stamps", "*")):
     9:       erasefile(d)
    10: 
    11:     for d in [
    12:       os.path.join("tut", "examples"),
    13:       os.path.join("bagley", "felix"),
    14:       "src","elk","demux","faio","lib","lpsrc","rtl","bin","test",
    15:       ]:
    16:       for e in ["*.hpp","*.so","*.dll","*.cpp","*.hpp",
    17:         "*.par","*.output","*.o","*.obj",
    18:         "*.exp","*.lib",'*.resh','*.par',
    19:         "*.cache","*.a","*.exp","*.exe",
    20:         "*.cmo","*.cma","*.cmi","*.cmx","*.cmxa",
    21:         ]:
    22:         for f in glob.glob(os.path.join(d, e)):
    23:           erasefile(f)
    24: 
    25:     for f in glob.glob(os.path.join("lib", "*.par")):
    26:       erasefile(f)
    27: 
    28:     for f in glob.glob(os.path.join(FLX_LPARCHIVE, "lpsrc", "*.cache")):
    29:       erasefile(f)
    30: 
End python section to mkplugins/clean.py[1]
Start python section to mkplugins/mkdoc.py[1 /1 ]
     1: #line 790 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'mkdoc'
     4: 
     5:   def __init__(self, *args, **kwds):
     6:     apply(Plugin.__init__, (self,) + args, kwds)
     7: 
     8:     self.already_generated = {}
     9: 
    10:   def runme(self, pkg, pkgdict):
    11:     mkdirs("pkg-stamps")
    12: 
    13:     weaver_directory = pkgdict.get("weaver_directory","")
    14:     iscr_source = pkgdict.get("iscr_source",[])
    15:     if iscr_source and weaver_directory:
    16:       print "GENERATING DOCUMENTATION",weaver_directory
    17: 
    18:       iscr_source = filter(lambda x: x not in self.already_generated, iscr_source)
    19: 
    20:       filecopy2dir(os.path.join('misc', 'plus.gif'),weaver_directory)
    21:       filecopy2dir(os.path.join('misc', 'minus.gif'),weaver_directory)
    22:       filecopy2dir(os.path.join('misc', 'dot.gif'),weaver_directory)
    23:       filecopy2dir(os.path.join('misc', 'interscript.css'),weaver_directory)
    24:       filecopy2dir(os.path.join('misc', 'user.css'),weaver_directory)
    25: 
    26:       for src in iscr_source:
    27:         srcdir = os.path.join(FLX_LPARCHIVE, src)
    28:         runISCR(
    29:             '--language=en --weaver=web --weaver=latex '
    30:             '--passes=2 --weaver-directory=%s %s' % (weaver_directory, srcdir))
    31: 
    32:         self.already_generated[src] = 1
    33: 
End python section to mkplugins/mkdoc.py[1]
Start python section to mkplugins/cflags.py[1 /1 ]
     1: #line 823 "./lpsrc/flx_maker.pak"
     2: # GLOBAL COMPILATION FLAGS
     3: 
     4: # C++ STUFFS
     5: CFLAGS = ""
     6: SFLAGS = ""
     7: DFLAGS = ""
     8: EXTRA_LIBS = []
     9: 
End python section to mkplugins/cflags.py[1]
Start python section to mkplugins/build_target_rtl_dynamic.py[1 /1 ]
     1: #line 832 "./lpsrc/flx_maker.pak"
     2: def build_target_rtl_dynamic(pkg, pkgdict):
     3:   CCS = pkgdict.get("cc_ccs",[])
     4:   CPPS = pkgdict.get("cpp_cpps",[])
     5: 
     6:   if not CCS and not CPPS:
     7:     return
     8: 
     9:   BUILD_MACRO = pkgdict.get("build_macro","ERROR!")
    10:   EXTRA_CFLAGS = pkgdict.get("cflags","")
    11:   EXTRA_DFLAGS = pkgdict.get("dflags","")
    12: 
    13:   flibs = pkgdict.get("lib_requires",[])
    14:   needs_libs = []
    15:   for i in flibs:
    16:     needs_libs.append(i+"_dynamic")
    17: 
    18:   lib = pkgdict.get("provides_lib","lib"+pkg)
    19: 
    20:   print " ++ "+pkg+" RTL (dynamic)"
    21: 
    22:   compile_kwds = {
    23:       'include_paths': ['rtl'],
    24:       'optimise': optimise,
    25:       'debug': debug,
    26:       'macros': ["BUILD_"+BUILD_MACRO],
    27:       'CFLAGS': CFLAGS+EXTRA_CFLAGS,
    28:       }
    29: 
    30:   link_kwds = {
    31:       'lib_paths': [SHLIB_DIR],
    32:       'libs': EXTRA_LIBS+needs_libs,
    33:       'LDFLAGS': DFLAGS+EXTRA_DFLAGS,
    34:       }
    35: 
    36:   if CCS:
    37:     # RF: THIS SHOULD BE TARGET_CC AND THE OUTPUT DIR SHOULD BE THAT OF
    38:     # THE TARGET.
    39:     objects = apply(TARGET_CC.compile_shared_rtl, (vxqt, CCS),
    40:         compile_kwds)
    41: 
    42:     apply(TARGET_CC.link_shared_rtl,
    43:       (vxqt, objects, TARGET_CC.options.SHLIB_DIR+os.sep+lib+'_dynamic'),
    44:       link_kwds)
    45: 
    46:     if EXT_DYLIB != EXT_SHLIB:
    47:       apply(TARGET_CC.link_shared_dll,
    48:         (vxqt, objects, TARGET_CC.options.SHLIB_DIR+os.sep+lib+'_dynamic'),
    49:         link_kwds)
    50: 
    51:   if CPPS:
    52:     # RF: THIS SHOULD BE TARGET_CXX AND THE OUTPUT DIR SHOULD BE THAT OF
    53:     # THE TARGET.
    54:     objects = apply(TARGET_CXX.compile_shared_rtl, (vxqt, CPPS),
    55:         compile_kwds)
    56: 
    57:     apply(TARGET_CXX.link_shared_rtl,
    58:       (vxqt, objects, TARGET_CXX.options.SHLIB_DIR+os.sep+lib+'_dynamic'),
    59:       link_kwds)
    60: 
    61:     if EXT_DYLIB != EXT_SHLIB:
    62:       apply(TARGET_CXX.link_shared_dll,
    63:         (vxqt, objects, TARGET_CXX.options.SHLIB_DIR+os.sep+lib+'_dynamic'),
    64:         link_kwds)
    65: 
    66:     for x in CCS + CPPS:
    67:       f = x + EXT_SHARED_OBJ
    68:       if verbose: print "Removing",f
    69:       deletefile(f) # delete the .o files
    70: 
End python section to mkplugins/build_target_rtl_dynamic.py[1]
Start python section to mkplugins/build_target_rtl_static.py[1 /1 ]
     1: #line 902 "./lpsrc/flx_maker.pak"
     2: def build_target_rtl_static(pkg, pkgdict):
     3:   CCS = pkgdict.get("cc_ccs",[])
     4:   CPPS = pkgdict.get("cpp_cpps",[])
     5: 
     6:   if not CCS and not CPPS:
     7:     return
     8: 
     9:   EXTRA_CFLAGS = pkgdict.get("cflags","")
    10:   lib = pkgdict.get("provides_lib","lib"+pkg)
    11: 
    12:   print " ++ "+pkg+" RTL (static)"
    13: 
    14:   kwds = {
    15:       'include_paths': ["rtl"],
    16:       'macros': ["FLX_STATIC_LINK"],
    17:       'optimise': optimise,
    18:       'debug': debug,
    19:       'CFLAGS': CFLAGS+EXTRA_CFLAGS,
    20:       }
    21: 
    22:   if CCS:
    23:     apply(TARGET_CC.build_static_rtl,
    24:         (vxqt, CCS, "rtl"+os.sep+lib+"_static"),
    25:         kwds)
    26: 
    27:   if CPPS:
    28:     apply(TARGET_CXX.build_static_rtl,
    29:         (vxqt, CPPS, "rtl"+os.sep+lib+"_static"),
    30:         kwds)
    31: 
    32:     for x in CCS + CPPS:
    33:       f = x + EXT_STATIC_OBJ
    34:       if verbose: print "Removing", f
    35:       deletefile(f) # delete the object files
    36: 
    37: 
End python section to mkplugins/build_target_rtl_static.py[1]
Start python section to mkplugins/build_felix_static_drivers.py[1 /1 ]
     1: #line 939 "./lpsrc/flx_maker.pak"
     2: def build_felix_static_drivers(pkg, pkgdict):
     3:   DRIVERS = pkgdict.get("drivers",[])
     4:   cflags = pkgdict.get("cflags","")
     5:   if len(DRIVERS)>0:
     6:     print "COMPILING DRIVERS (static)"
     7: 
     8:     for mode, src, bin, macros in DRIVERS:
     9:       if mode=='static':
    10:         if verbose: print 'static Compiling driver object', src
    11:         TARGET_CXX.compile_static_main(
    12:           vxqt,
    13:           [src],
    14:           include_paths=["rtl"],
    15:           macros=["FLX_STATIC_LINK"]+macros,
    16:           optimise=optimise,
    17:           debug=debug,
    18:           CFLAGS=CFLAGS+cflags)
    19: 
End python section to mkplugins/build_felix_static_drivers.py[1]
Start python section to mkplugins/build_felix_dynamic_drivers.py[1 /1 ]
     1: #line 958 "./lpsrc/flx_maker.pak"
     2: def build_felix_dynamic_drivers(pkg, pkgdict):
     3:   DRIVERS = pkgdict.get("drivers",[])
     4:   cflags = pkgdict.get("cflags","")
     5:   if len(DRIVERS)>0:
     6:     print "COMPILING DRIVERS (dynamic)"
     7:     dflags = pkgdict.get("dflags","")
     8:     LIBS = pkgdict.get("drivers_require_libs",[])
     9:     libs = []
    10:     for lib in LIBS:
    11:       libs.append(lib+"_dynamic")
    12: 
    13:     for mode, src, bin, macros in DRIVERS:
    14:       # this is a gross HACK! Don't make dynamic versions
    15:       # of drivers with extra macros, they're for static
    16:       # link of driver without async support
    17:       if mode=='dynamic':
    18:         if verbose: print 'dynamic Compiling driver object', src
    19: 
    20:         TARGET_CXX.build_shared_program(
    21:             vxqt,
    22:             src,
    23:             bin,
    24:             include_paths=["rtl"],
    25:             optimise=optimise,
    26:             debug=debug,
    27:             macros=macros,
    28:             CFLAGS=CFLAGS+cflags,
    29:             lib_paths=[SHLIB_DIR],
    30:             libs=libs,
    31:             LDFLAGS=DFLAGS+dflags)
    32: 
    33:         #deletefile(src + EXT_SHARED_OBJ)
    34: 
End python section to mkplugins/build_felix_dynamic_drivers.py[1]
Start python section to mkplugins/build_target_cpp_tools.py[1 /1 ]
     1: #line 992 "./lpsrc/flx_maker.pak"
     2: def build_target_cpp_tools(pkg, pkgdict):
     3:   EXES = pkgdict.get("exes",[])
     4:   esflags = pkgdict.get("exes_require_linkflags","")
     5:   if len(EXES)>0:
     6:     print "BUILDING C++ TARGET TOOLS"
     7:     LIBS = pkgdict.get("exes_require_libs",[])
     8:     libs = []
     9:     for lib in LIBS: libs.append(lib+"_static")
    10:     for src,bin in EXES:
    11:       dir = os.path.dirname(src)
    12:       TARGET_CXX.build_static_main(
    13:         vxqt,
    14:         src,
    15:         dir,
    16:         bin,
    17:         include_paths=["rtl"],
    18:         macros=["FLX_STATIC_LINK"],
    19:         CFLAGS=CFLAGS,
    20:         lib_paths=[dir],
    21:         libs=libs,
    22:         LDFLAGS=SFLAGS+esflags)
    23: 
    24:       deletefile(src + EXT_STATIC_OBJ)
    25: 
End python section to mkplugins/build_target_cpp_tools.py[1]
Start python section to mkplugins/build_target_felix_tools.py[1 /1 ]
     1: #line 1017 "./lpsrc/flx_maker.pak"
     2: # TARGET TOOLS : FELIX
     3: def build_target_felix_tools(pkg, pkgdict):
     4:   FLXS = pkgdict.get("felix_tools",[])
     5:   if len(FLXS)>0:
     6:     print "BUILDING FELIX TARGET TOOLS"
     7:     LIBS = pkgdict.get("exes_require_libs",[])
     8:     libs = []
     9:     for lib in LIBS: libs.append(lib+"_static")
    10:     fsflags = pkgdict.get("felix_requires_linkflags","")
    11:     for src,exe in FLXS:
    12:       flxg("-Ilib " + src)
    13:       TARGET_CXX.build_felix_static(
    14:         vxqt,
    15:         src,
    16:         exe,
    17:         objects=['rtl' + os.sep + 'flx_run' + EXT_STATIC_OBJ],
    18:         include_paths=['rtl'],
    19:         macros=["FLX_STATIC_LINK"],
    20:         CFLAGS=CFLAGS,
    21:         lib_paths=['rtl'],
    22:         libs=libs,
    23:         LDFLAGS=SFLAGS+fsflags)
    24: 
End python section to mkplugins/build_target_felix_tools.py[1]
Start python section to mkplugins/performance.py[1 /1 ]
     1: #line 1041 "./lpsrc/flx_maker.pak"
     2: SPECIAL_TESTS = [
     3:   (os.path.join('bin', 'drivers', 'flx_run'), os.path.join('test', 'drivers', 'flx_run_lib1.flx'),''),
     4:   (os.path.join('test', 'drivers', 'flx_perf_drv1'), os.path.join('test', 'drivers', 'flx_perf_lib1.flx'),'1000'),
     5: ]
     6: 
     7: class PLUGIN(Plugin):
     8:   name = 'performance'
     9:   help = 'make performance tests'
    10: 
    11:   def runme(self):
    12:     for driver,testfile,moreargs in SPECIAL_TESTS:
    13:       test_basename = os.path.splitext(testfile)[0]
    14:       drv_basename = os.path.splitext(driver)[0]
    15:       if SUPPORT_DYNAMIC_LOADING:
    16:         testscript = "time "+drv_basename+ " "+test_basename+EXT_SHLIB+" " + moreargs
    17:         print '(dynamic link) Executing ',testscript
    18:         try:
    19:           exqt(testscript)
    20:           #print 'TESTFILE -- OK!',testscript
    21:         except MakeError, e:
    22:           print 'TESTFILE -- ERROR!',testscript
    23:           raise e
    24: 
    25:       if SUPPORT_STATIC_LINKAGE:
    26:         testscript = "time "+test_basename+EXT_EXE+" " + moreargs
    27:         print '(static link) Executing ',testscript
    28:         try:
    29:           exqt(testscript)
    30:           #print 'TESTFILE -- OK!',testscript
    31:         except MakeError, e:
    32:           print 'TESTFILE -- ERROR!',testscript
    33:           raise e
    34: 
End python section to mkplugins/performance.py[1]
Start python section to mkplugins/ocaml_env.py[1 /1 ]
     1: #line 1075 "./lpsrc/flx_maker.pak"
     2: if not globals().get("ocaml_env",None):
     3:   ocaml_env = 1
     4: 
     5:   BYTECODE = not NATIVE_CODE_COMPILER or "bytecode" in options
     6:   if BYTECODE:
     7:     if "profile" in options:
     8:       OCAMLOPT = OCAMLCP
     9:       OCAMLC = OCAMLCP
    10:     else: OCAMLOPT = OCAMLB
    11:   else:
    12:     OCAMLOPT = OCAMLC
    13:     if "profile" in options:
    14:       OCAMLOPT = OCAMLOPT+' -p '
    15: 
    16:   if debug or "debug" in options:
    17:     if NATIVE_CODE_COMPILER:
    18:       if OCAMLC == OCAMLOPT:
    19:         #OCAMLC = OCAMLC + ' -ccopt -g '
    20:         OCAMLC = OCAMLC + ' '
    21:       else:
    22:         #OCAMLC = OCAMLC + ' -g '
    23:         OCAMLC = OCAMLC + ' '
    24:       #OCAMLOPT = OCAMLOPT + ' -ccopt -g '
    25:       OCAMLOPT = OCAMLOPT + ' '
    26:     else:
    27:       #OCAMLOPT = OCAMLOPT + ' -g '
    28:       OCAMLOPT = OCAMLOPT + ' '
    29: 
    30:   if "optimise_felix" in options:
    31:     OCAMLOPT = OCAMLOPT + " -unsafe -noassert -inline 5 "
    32: 
    33:   if BYTECODE == 0:
    34:     OCAML_OBJECT_EXTENSION = '.cmx'
    35:     OCAML_LIB_EXTENSION = '.cmxa'
    36:   else:
    37:     OCAML_OBJECT_EXTENSION = '.cmo'
    38:     OCAML_LIB_EXTENSION = '.cma'
    39: 
End python section to mkplugins/ocaml_env.py[1]
Start python section to mkplugins/link_model_env.py[1 /1 ]
     1: #line 1114 "./lpsrc/flx_maker.pak"
     2: if not globals().get("link_model_env",None):
     3:   link_model_env = 1
     4: 
     5:   CCOBJ_STATIC_LIB = CCOBJ_STATIC_MAIN + "-DFLX_STATIC_LINK "
     6:   CCOBJ_STATIC_MAIN = CCOBJ_STATIC_MAIN + "-DFLX_STATIC_LINK "
     7: 
     8:   CCMACS=""
     9:   for i in macros:
    10:     CCMACS=CCMACS+'-D'+i+" "
    11: 
    12:   if CCMACS:
    13:     CCOBJ_STATIC_RTL = CCOBJ_STATIC_RTL + CCMACS
    14:     CCOBJ_STATIC_MAIN = CCOBJ_STATIC_MAIN + CCMACS
    15:     CCOBJ_STATIC_FLX = CCOBJ_STATIC_FLX + CCMACS
    16: 
    17:     CCOBJ_DYNAMIC_RTL = CCOBJ_DYNAMIC_MAIN + CCMACS
    18:     CCOBJ_DYNAMIC_MAIN = CCOBJ_DYNAMIC_MAIN + CCMACS
    19:     CCOBJ_DYNAMIC_FLX = CCOBJ_DYNAMIC_FLX + CCMACS
    20: 
    21: 
End python section to mkplugins/link_model_env.py[1]
Start python section to mkplugins/run_failure_tests.py[1 /1 ]
     1: #line 1135 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'run_failure_tests'
     4:   help = 'run tests meant to fail'
     5: 
     6:   def runme(self,pkg, pkgdict, quiet, check_stamp):
     7:     bad_tests = pkgdict.get("failure_tests",[])
     8:     bad_tests.sort()
     9: 
    10:     failed = 0
    11: 
    12:     for testfile in bad_tests:
    13:       log = Tee()
    14:       log.write("**** FAILURE TESTING PACKAGE %s : %s ****\n" % (pkg, testfile))
    15: 
    16:       #log.write('Running Felix code generator on %s\n' % testfile)
    17:       basename = os.path.splitext(testfile)[0]
    18:       cppfilename = basename + ".cpp"
    19: 
    20:       try:
    21:         vxqtq(os.path.join(
    22:           'bin',
    23:           'flxg -e -Ilib ' + basename), log=log)
    24:         #log.write('TESTFILE -- failed as expected %s\n' % basename)
    25:         self.successes.append((pkg, testfile, log.getvalue()))
    26:       except MakeError, e:
    27:         failed = 1
    28: 
    29:         log.write('TESTFILE -- SUCCEEDED, SHOULD HAVE FAILED! %s\n' % basename)
    30: 
    31:         self.failures.append((pkg, testfile, log.getvalue()))
    32: 
    33:       erasefile(basename+'.cpp')
    34:       erasefile(basename+'.hpp')
    35: 
    36:     return not failed
    37: 
    38: 
End python section to mkplugins/run_failure_tests.py[1]
Start python section to mkplugins/run_static_unit_tests.py[1 /1 ]
     1: #line 1173 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(TestPlugin):
     3:   name = 'run_static_unit_tests'
     4:   help = 'run static unit tests'
     5: 
     6:   def runme(self, pkg, pkgdict, quiet, check_stamp):
     7:     static_unit_tests = pkgdict.get("static_unit_tests",[])
     8:     static_unit_tests.sort()
     9: 
    10:     return self.run_tests(pkg, pkgdict, static_unit_tests, 1, 1, 0, check_stamp,
    11:       "*** STATIC UNIT TESTING %s : %%s ****\n" % pkg, quiet)
    12: 
    13: 
End python section to mkplugins/run_static_unit_tests.py[1]
Start python section to mkplugins/run_dynamic_unit_tests.py[1 /1 ]
     1: #line 1186 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(TestPlugin):
     3:   name = 'run_dynamic_unit_tests'
     4:   help = 'run dynamic unit tests'
     5: 
     6:   def runme(self, pkg, pkgdict, quiet, check_stamp):
     7:     dynamic_unit_tests = pkgdict.get("dynamic_unit_tests",[])
     8:     dynamic_unit_tests.sort()
     9: 
    10:     return self.run_tests(pkg, pkgdict, dynamic_unit_tests, 1, 0, 1, check_stamp,
    11:       "*** DYNAMIC UNIT TESTING %s : %%s ****\n" % pkg, quiet)
    12: 
    13: 
End python section to mkplugins/run_dynamic_unit_tests.py[1]
Start python section to mkplugins/run_unit_tests.py[1 /1 ]
     1: #line 1199 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(TestPlugin):
     3:   name = 'run_unit_tests'
     4:   help = 'run unit tests'
     5: 
     6:   def runme(self,pkg, pkgdict, quiet, check_stamp):
     7:     unit_tests = pkgdict.get("unit_tests",[])
     8:     unit_tests.sort()
     9: 
    10:     return self.run_tests(pkg, pkgdict, unit_tests, 1, 1, 1, check_stamp,
    11:       "*** UNIT TESTING %s : %%s ****\n" % pkg, quiet)
    12: 
    13: 
End python section to mkplugins/run_unit_tests.py[1]
Start python section to mkplugins/run_completion_tests.py[1 /1 ]
     1: #line 1212 "./lpsrc/flx_maker.pak"
     2: # these tests are units tests with non-deterministic results
     3: class PLUGIN(TestPlugin):
     4:   name = 'run_completion_tests'
     5:   help = 'run tests that just need to finish'
     6: 
     7:   def runme(self,pkg, pkgdict, quiet, check_stamp):
     8:     completion_tests = pkgdict.get("completion_tests",[])
     9:     completion_tests.sort()
    10: 
    11:     return self.run_tests(pkg, pkgdict, completion_tests, 0, 1, 1, check_stamp,
    12:       "*** COMPLETION (nondet) TESTING %s : %%s ****\n" % pkg, quiet)
    13: 
    14: 
End python section to mkplugins/run_completion_tests.py[1]
Start python section to mkplugins/run_known_failed_tests.py[1 /1 ]
     1: #line 1226 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'run_known_failed_tests'
     4:   help = 'mark tests failed that are known to fail without running'
     5: 
     6:   def __init__(self):
     7:     Plugin.__init__(self)
     8:     self.dummy = 1
     9: 
    10:   def runme(self,pkg, pkgdict, quiet, check_stamp):
    11:     bad_tests = pkgdict.get("known_failed_tests",[])
    12:     bad_tests.sort()
    13: 
    14:     for testfile in bad_tests:
    15:       log = Tee()
    16:       log.write("**** KNOWN FAILED TESTING PACKAGE %s : %s ****\n" % (pkg, testfile))
    17: 
    18:       # don't even bother to compile
    19:       self.failures.append((pkg, testfile, ""))
    20: 
    21:     return 1 # don't report any failure!
    22: 
End python section to mkplugins/run_known_failed_tests.py[1]
Start python section to mkplugins/run_demos.py[1 /1 ]
     1: #line 1248 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(TestPlugin):
     3:   name = 'run_demos'
     4:   help = 'run demonstrations'
     5: 
     6:   def runme(self,pkg, pkgdict, quiet=0, check_stamp=0):
     7:     demos = pkgdict.get("demos",[])
     8:     demos.sort()
     9: 
    10:     return self.run_tests(pkg, pkgdict, demos, 0, 1, 1, check_stamp,
    11:       "*** DEMO PACKAGE %s : %%s ****\n" % pkg, quiet)
    12: 
    13: 
End python section to mkplugins/run_demos.py[1]
Start python section to mkplugins/xqt.py[1 /1 ]
     1: #line 1261 "./lpsrc/flx_maker.pak"
     2: if os.name=="nt":
     3:   ENV="set PATH=bin;%PATH%&&"
     4: else:
     5:   if CYGWIN or WIN32:
     6:     ENV = 'env PATH=bin:"$PATH" PYTHONPATH=.:"$PYTHONPATH" '
     7:   elif MACOSX:
     8:     ENV = 'PATH=bin:"$PATH" DYLD_LIBRARY_PATH=rtl:"$DYLD_LIBRARY_PATH" '
     9:   else:
    10:     ENV = 'PATH=bin:"$PATH" LD_LIBRARY_PATH=rtl:"$LD_LIBRARY_PATH" '
    11: 
    12: 
    13: def vxqt(x, **kwds):
    14:   kwds['verbose'] = kwds.get('verbose', verbose)
    15:   kwds['quiet'] = kwds.get('quiet', quiet)
    16:   return apply(xqt, (x,), kwds)
    17: 
    18: 
    19: def vxqtq(x, **kwds):
    20:   kwds['verbose'] = kwds.get('verbose', verbose)
    21:   return apply(xqtq, (x,), kwds)
    22: 
    23: 
    24: def exqt(x, **kwds):
    25:   return apply(vxqt, (ENV+x,), kwds)
    26: 
    27: 
    28: def flxg(x, **kwds):
    29:   x = os.path.join('bin', 'flxg ' + x)
    30:   return apply(exqt, (x,), kwds)
    31: 
    32: 
    33: #interscript command (now built in part of Felix package)
    34: def runISCR(a,force=0):
    35:   x = string.split(a, ' ')
    36:   z = []
    37:   for i in x:
    38:     z.append('"' + i + '"')
    39:   a = string.join(z, ' ')
    40: 
    41:   if force:
    42:     exqt(ISCR + "--nocache " + a)
    43:   else:
    44:     exqt(ISCR + '--break-on-error ' + a)
    45: 
    46: 
End python section to mkplugins/xqt.py[1]
Start python section to mkplugins/manifest.py[1 /1 ]
     1: #line 1307 "./lpsrc/flx_maker.pak"
     2: manifest_src_re = re.compile(r"CREATING .* NAMED FILE SOURCE (.*) \[")
     3: 
     4: def make_manifest(pkg):
     5:   base = os.path.basename(os.path.splitext(pkg)[0])
     6:   print "Make Manifest of",base
     7:   fname = os.path.join("manifests", base+".log")
     8:   runISCR("--nocache --trace=sources --trace=changes --new-logfile="+fname+" "+pkg)
     9:   deps = []
    10:   f = open(fname)
    11:   for line in f.readlines():
    12:     m = manifest_src_re.match(line)
    13:     if m:
    14:       g = m.group(1)
    15:       print "Source File: "+g
    16:       deps = append_unique(deps,os.path.join(FLX_LPARCHIVE, "lpsrc", g))
    17:   f.close()
    18:   f = open(os.path.join("manifests", base+".deps"),"w")
    19:   for x in deps: f.write(x+"\n")
    20:   f.close()
    21: 
    22: def get_deps(base):
    23:   f = open(os.path.join("manifests", base+".deps"))
    24:   data = f.read()
    25:   f.close()
    26:   files = string.split(string.strip(data),"\n")
    27:   return files
    28: 
    29: def mk_manifests():
    30:   mkdirs("manifests")
    31:   paks = glob.glob(os.path.join(FLX_LPARCHIVE, "lpsrc", "*.pak"))
    32:   for pkg in paks:
    33:     base = os.path.basename(os.path.splitext(pkg)[0])
    34:     fbase = os.path.join("manifests", base)
    35: 
    36:     if not os.path.exists(fbase + '.log') or not os.path.exists(fbase + '.deps'):
    37:       print "New pak", pkg, "BUILDING MANIFEST"
    38:       make_manifest(pkg)
    39:     else:
    40:       manifest_time = filetime(fbase + '.log')
    41: 
    42:       files = get_deps(base)
    43:       src_time = newest_filetime(files)
    44:       if src_time > manifest_time:
    45:         print "Changed pak", pkg, "REBUILDING MANIFEST"
    46:         make_manifest(pkg)
    47: 
    48: mk_manifests()
    49: 
    50: def get_latest_src_time(pkgdict):
    51:   output_iscrs = []
    52:   for iscr in pkgdict.get("iscr_source",[]):
    53:     base = os.path.basename(os.path.splitext(iscr)[0])
    54:     iscrs = get_deps(base)
    55:     for i in iscrs:
    56:       if not i in output_iscrs: output_iscrs.append(i)
    57: 
    58:   return newest_filetime(output_iscrs)
    59: 
    60: class PLUGIN(Plugin):
    61:   name = 'cal_pkgs'
    62:   priority = 10
    63: 
    64:   def runme(self):
    65:     global pkgd
    66:     global host_packages,target_packages,run_packages,doc_packages
    67:     global host_selected_pkgs,target_selected_pkgs,run_selected_pkgs,doc_selected_pkgs
    68: 
    69:     for pkg in pkgd.keys():
    70:       pkgdict = pkgd[pkg]
    71: 
    72:       latest_src_time = get_latest_src_time(pkgdict)
    73:       if latest_src_time == 0:
    74:         print "Pak %-20s (virtual)" % pkg
    75:       else:
    76:         src_time_s = fmtime(latest_src_time)
    77:         print "Pak %-20s changed: %s" % (pkg,src_time_s)
    78: 
    79:       host_stamp=os.path.join("pkg-stamps", pkg+".host")
    80:       latest_host_build_time = filetime(host_stamp)
    81:       if latest_host_build_time == 0:
    82:         print "  ** Host UNBUILT"
    83:         if pkg not in host_packages: host_packages.append(pkg)
    84:       else:
    85:         if latest_host_build_time < latest_src_time:
    86:           print "  ** Host build:",fmtime(latest_host_build_time)
    87:           print "  ** REQUIRES REBUILD due to changed sources"
    88:           if pkg not in host_packages: host_packages.append(pkg)
    89: 
    90:       target_stamp=os.path.join("pkg-stamps", pkg+".target")
    91:       latest_target_build_time = filetime(target_stamp)
    92:       if latest_target_build_time == 0:
    93:         print "  ** Target UNBUILT"
    94:         if pkg not in target_packages: target_packages.append(pkg)
    95:       else:
    96:         if latest_target_build_time < latest_src_time:
    97:           print "  ** Target build:",fmtime(latest_target_build_time)
    98:           print "  ** REQUIRES REBUILD due to changed sources"
    99:           if pkg not in target_packages: target_packages.append(pkg)
   100: 
   101:       run_stamp=os.path.join("pkg-stamps", pkg+".run")
   102:       latest_run_build_time = filetime(run_stamp)
   103:       if latest_run_build_time == 0:
   104:         print "  ** Run UNBUILT"
   105:         if pkg not in run_packages: run_packages.append(pkg)
   106:       else:
   107:         if latest_run_build_time < latest_src_time:
   108:           print "  ** Run build:",fmtime(latest_run_build_time)
   109:           print "  ** REQUIRES REBUILD due to changed sources"
   110:           if pkg not in run_packages: run_packages.append(pkg)
   111: 
   112:       doc_stamp=os.path.join("pkg-stamps", pkg+".doc")
   113:       latest_doc_build_time = filetime(doc_stamp)
   114:       if latest_doc_build_time == 0:
   115:         print "  ** Doc UNBUILT"
   116:         if pkg not in doc_packages: doc_packages.append(pkg)
   117:       else:
   118:         if latest_doc_build_time < latest_src_time:
   119:           print "  ** Doc build:",fmtime(latest_doc_build_time)
   120:           print "  ** REQUIRES REBUILD due to changed sources"
   121:           if pkg not in doc_packages: doc_packages.append(pkg)
   122: 
   123: 
   124:     # doesn't work so well if both deps and reqs specified!
   125:     # would work better, if reqs was already reduced to
   126:     # what actually needed o be rebuilt
   127: 
   128:     if "deps" in options:
   129:       host_packages = closure(pkgdeps,host_packages)
   130:       target_packages = closure(pkgdeps,target_packages)
   131:       run_packages = closure(pkgdeps,run_packages)
   132:       doc_packages = closure(pkgdeps,doc_packages)
   133: 
   134:     if "reqs" in options:
   135:       host_packages = closure(pkgreqs,host_packages)
   136:       target_packages = closure(pkgreqs,target_packages)
   137:       run_packages = closure(pkgreqs,run_packages)
   138:       doc_packages = closure(pkgreqs,doc_packages)
   139: 
   140:     host_selected_pkgs = filter(lambda x: x in host_packages,pkgs)
   141:     target_selected_pkgs = filter(lambda x: x in target_packages,pkgs)
   142:     run_selected_pkgs = filter(lambda x: x in run_packages,pkgs)
   143:     doc_selected_pkgs = filter(lambda x: x in doc_packages,pkgs)
   144: 
   145:     if "all" in options:
   146:       if not quiet: print "SELECTING ALL PACKAGES"
   147:       host_selected_pkgs = pkgs
   148:       target_selected_pkgs = pkgs
   149:       run_selected_pkgs = pkgs
   150:       doc_selected_pkgs = pkgs
   151: 
   152:     if not quiet:
   153:       #print "AVAILABLE SOURCES",paks
   154:       print "Host SELECTED PACKAGES ARE ",host_selected_pkgs
   155:       print "Target SELECTED PACKAGES ARE ",target_selected_pkgs
   156:       print "Run SELECTED PACKAGES ARE ",run_selected_pkgs
   157:       print "Doc SELECTED PACKAGES ARE ",doc_selected_pkgs
   158:       print "SELECTED PHASES ARE   ",phases
   159:       print "Build model  ",build_model
   160:       print "Host model   ",host_model
   161:       print "Target model ",target_model
   162:       print "Run model    ",run_model
   163: 
End python section to mkplugins/manifest.py[1]
Start python section to mkplugins/make.py[1 /1 ]
     1: #line 1470 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'make'
     4:   help = 'check if any packages need rebuilding'
     5:   priority = 50
     6: 
     7:   def runme(self):
     8:     global host_selected_pkgs,target_selected_pkgs,run_selected_pkgs
     9:     global pkgd,phases,quiet
    10:     mkdirs("pkg-stamps")
    11:     check_stamp = "force" not in options
    12: 
    13:     if "host" in phases:
    14:       ocaml_sequencer = "force" in options
    15:       for pkg in host_selected_pkgs:
    16:         pkgdict = pkgd[pkg]
    17:         print "***** Host MAKING PACKAGE "+pkg+" ************"
    18: 
    19:         stamp=os.path.join("pkg-stamps", pkg+".host")
    20:         erasefile(stamp)
    21:         srcs = pkgdict.get("iscr_source",[])
    22:         for src in srcs:
    23:           src = unix2native(src)
    24:           if not quiet: print "REExtracting",pkg,"from",src
    25:           runISCR(os.path.join(FLX_LPARCHIVE, src))
    26: 
    27:         MLIS = pkgdict.get("caml_raw_interfaces",[])
    28:         HPPS = pkgdict.get("rtl_interfaces",[])
    29: 
    30:         plugins['copy_mli2ml'](MLIS)
    31:         plugins['copy_hpp2rtl'](HPPS)
    32: 
    33:         ocaml_sequencer = plugins['build_ocamls'](pkg, pkgdict, ocaml_sequencer)
    34: 
    35:         plugins['build_host_tools'](pkg, pkgdict)
    36: 
    37:         enstamp(stamp)
    38: 
    39:     if "target" in phases:
    40:       for pkg in target_selected_pkgs:
    41:         pkgdict = pkgd[pkg]
    42:         print "***** Target MAKING PACKAGE "+pkg+" ************"
    43: 
    44:         stamp=os.path.join("pkg-stamps", pkg+".target")
    45:         erasefile(stamp)
    46:         if SUPPORT_DYNAMIC_LOADING:
    47:           build_target_rtl_dynamic(pkg, pkgdict)
    48: 
    49:         if SUPPORT_STATIC_LINKAGE:
    50:           build_target_rtl_static(pkg, pkgdict)
    51: 
    52:         if SUPPORT_DYNAMIC_LOADING:
    53:           build_felix_dynamic_drivers(pkg, pkgdict)
    54: 
    55:         if SUPPORT_STATIC_LINKAGE:
    56:           build_felix_static_drivers(pkg, pkgdict)
    57: 
    58:         build_target_cpp_tools(pkg, pkgdict)
    59:         build_target_felix_tools(pkg, pkgdict)
    60: 
    61:         # only stamp if we've passed the tests
    62:         if plugins['run_failure_tests'](pkg, pkgdict, quiet, check_stamp):
    63:           enstamp(stamp)
    64: 
    65:     if "run" in phases:
    66:       for pkg in run_selected_pkgs:
    67:         pkgdict = pkgd[pkg]
    68:         print "***** Run MAKING PACKAGE "+pkg+" ************"
    69: 
    70:         stamp=os.path.join("pkg-stamps", pkg+".run")
    71:         erasefile(stamp)
    72: 
    73:         # only stamp if we've passed the tests
    74:         if \
    75:                     plugins['run_failure_tests'](pkg, pkgdict, quiet, check_stamp) \
    76:                 and plugins['run_unit_tests'](pkg, pkgdict, quiet, check_stamp) \
    77:                 and plugins['run_static_unit_tests'](pkg, pkgdict, quiet, check_stamp) \
    78:                 and plugins['run_dynamic_unit_tests'](pkg, pkgdict, quiet, check_stamp) \
    79:                 and plugins['run_completion_tests'](pkg, pkgdict, quiet, check_stamp) \
    80:                 and plugins['run_known_failed_tests'](pkg, pkgdict, quiet, check_stamp):
    81:           enstamp(stamp)
    82: 
    83: 
End python section to mkplugins/make.py[1]
Start python section to flxbuild/pluginutil.py[1 /1 ]
     1: #line 1553 "./lpsrc/flx_maker.pak"
     2: class Plugin:
     3:   name = None
     4:   help = ''
     5:   priority = None
     6: 
     7:   def __init__(self):
     8:     self.failures = []
     9:     self.successes = []
    10:     self.dummy = 0
    11:     self.used = 0
    12: 
    13:   def __call__(self,*args,**kwds):
    14:     self.used = 1
    15:     return apply(self.runme,args,kwds)
    16: 
    17: 
    18: class TestPlugin(Plugin):
    19:   def run_tests(self, pkg, pkgdict, testfiles, deterministic, static, dynamic, check_stamp,
    20:           title, quiet):
    21:     if not testfiles:
    22:       return 1
    23: 
    24:     tests_failed = 0
    25: 
    26:     # determine the latest time that this package, and all the recurcively dependent
    27:     # packages where last built
    28:     latest_src_time = get_latest_src_time(pkgdict)
    29: 
    30:     for p in pkgreqs.get(pkg, []):
    31:       latest_src_time = max(latest_src_time, get_latest_src_time(pkgd[p]))
    32: 
    33:     for testfile in testfiles:
    34:       failed = 0
    35:       if find_test(self.successes, pkg,testfile): continue
    36:       if find_test(self.failures, pkg,testfile): continue
    37: 
    38:       stamp = os.path.join("pkg-stamps", testfile + '.test')
    39: 
    40:       # run the tests
    41:       stamptime = filetime(stamp)
    42:       if check_stamp and latest_src_time < stamptime:
    43:         self.successes.append((pkg, testfile, "Stamped ok previously on "+fmtime(stamptime)))
    44:       else:
    45:         log = Tee()
    46:         log.write(title % testfile)
    47:         if not quiet:
    48:           if stamptime == 0:
    49:             log.write("+++UNTRIED or FAILED\n")
    50:           elif not check_stamp:
    51:             log.write("+++FORCED\n")
    52:           else:
    53:             log.write("+++OUT OF DATE, source changed since "+fmtime(stamptime)+"\n")
    54: 
    55:         # build the felix code
    56:         try:
    57:           basename = plugins['build_test'](testfile, log, quiet)
    58:         except MakeError, e:
    59:           failed = 1
    60:           log.write('TESTFILE -- ERROR! %s (compiler)\n' % testfile)
    61:         else:
    62:           path = os.path.join(os.curdir, basename)
    63: 
    64:           # run the dynamic tests
    65:           if dynamic and SUPPORT_DYNAMIC_LOADING:
    66:             resfilename = basename + ".resh"
    67: 
    68:             try:
    69:               driver = vxqtq(os.path.join("bin", "flx_pkgconfig") +
    70:                 " --path=config --field=flx_requires_driver --rec @" + resfilename,
    71:                 log=log)
    72: 
    73:               driver = string.strip(driver[0])
    74:               if driver =='': driver = "flx_run"
    75:               driver = os.path.join("bin", driver)
    76:               #log.write("Driver: %s\n" % driver)
    77:               testscript = driver + ' ' + path + EXT_SHLIB
    78: 
    79:               self.run_test(log, testscript, basename, deterministic, quiet,check_stamp)
    80:             except MakeError, e:
    81:               failed = 1
    82:               log.write('TESTFILE -- ERROR! %s (dynamic)\n' % testscript)
    83: 
    84:           # run the static tests
    85:           if static and SUPPORT_STATIC_LINKAGE:
    86:             testscript = path + EXT_EXE
    87: 
    88:             try:
    89:               self.run_test(log, testscript, basename, deterministic, quiet, check_stamp)
    90:             except MakeError, e:
    91:               failed = 1
    92:               log.write('TESTFILE -- ERROR! %s (static)\n' % testscript)
    93: 
    94:         if not failed:
    95:           enstamp(stamp)
    96:           self.successes.append((pkg, testfile, log.getvalue()))
    97:         else:
    98:           erasefile(stamp)
    99: 
   100:       ####
   101: 
   102:       if failed:
   103:         tests_failed = tests_failed + 1
   104:         self.failures.append((pkg, testfile, log.getvalue()))
   105:         if 'stop' in options: raise MakeError
   106: 
   107:     return tests_failed == 0
   108: 
   109: 
   110:   def run_test(self, log, testscript, basename, deterministic, quiet,check_stamp):
   111:     log.write('EXECUTING TEST CODE %s\n' % testscript, quiet)
   112:     flush()
   113: 
   114:     # FIXME
   115:     argfiles = glob.glob(basename + '*.args')
   116: 
   117:     if not argfiles:
   118:       output = vxqt(ENV + testscript, verbose=1, log=log)
   119: 
   120:       f = open(basename + '.output', 'w')
   121:       try:
   122:         f.write(string.join(output, ""))
   123:       finally:
   124:         f.close()
   125: 
   126:       if deterministic:
   127:         output = vxqt('%s %s.expect %s.output' % (DIFF, basename, basename),
   128:             verbose=1, log=log)
   129: 
   130:     else:
   131:       for argcount, argfile in zip(range(len(argfiles)), argfiles):
   132:         # read the arguments fromm the file
   133:         f = open(argfile)
   134:         try:
   135:           args = string.strip(f.read())
   136:         finally:
   137:           f.close()
   138: 
   139:         output = vxqt(ENV + testscript + ' ' + args, verbose=1, log=log)
   140: 
   141:         f = open('%s-%s.argoutput' % (basename, argcount), 'w')
   142:         try:
   143:           f.write(string.join(output, ""))
   144:         finally:
   145:           f.close()
   146: 
   147:         if deterministic:
   148:            output = vxqtq('%s %s-%s.argexpect %s-%s.argoutput' % \
   149:                    (DIFF, basename, argcount, basename, argcount),
   150:                    verbose=1, log=log)
   151: 
   152: 
End python section to flxbuild/pluginutil.py[1]
Start python section to mkplugins/help.py[1 /1 ]
     1: #line 1705 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'help'
     4:   help = 'print this help message'
     5: 
     6:   def runme(self):
     7:     items = []
     8:     max_len = 0
     9:     for name, plugin in plugins.items():
    10:       if plugin.help:
    11:         max_len = max(max_len, len(name))
    12:         items.append((name, plugin.help))
    13: 
    14:     items.sort()
    15: 
    16:     for name, help in items:
    17:       print '%s %s' % (string.ljust(name, max_len), help)
    18: 
    19:     sys.exit(0)
    20: 
End python section to mkplugins/help.py[1]
Start python section to mkplugins/test.py[1 /1 ]
     1: #line 1725 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'test'
     4:   help = 'regression and tutorial combined'
     5: 
     6:   def __init__(self, *args, **kwds):
     7:     apply(Plugin.__init__, (self,) + args, kwds)
     8: 
     9:     if "test" in options:
    10:       if "run" not in phases: phases.append("run")
    11: 
    12:   def runme(self):
    13:     global quiet,force
    14:     check_stamp = "force"  not in options
    15:     if check_stamp:
    16:       print "##### TEST SELECTED PACKAGES ##################"
    17:     else:
    18:       print "##### TEST ALL PACKAGES ##################"
    19:     for pkg in pkgs:
    20:       pkgdict = pkgd[pkg]
    21:       print "***** TEST PACKAGE "+pkg+" ************"
    22:       plugins['run_failure_tests'](pkg, pkgdict, quiet, check_stamp)
    23:       plugins['run_unit_tests'](pkg, pkgdict, quiet, check_stamp)
    24:       plugins['run_static_unit_tests'](pkg, pkgdict, quiet, check_stamp)
    25:       plugins['run_dynamic_unit_tests'](pkg, pkgdict, quiet, check_stamp)
    26:       plugins['run_completion_tests'](pkg, pkgdict, quiet, check_stamp)
    27:       plugins['run_known_failed_tests'](pkg, pkgdict, quiet, check_stamp)
    28: 
End python section to mkplugins/test.py[1]
Start python section to mkplugins/doc.py[1 /1 ]
     1: #line 1753 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'doc'
     4:   help = 'build all user documentation'
     5: 
     6:   def runme(self):
     7:     global doc_selected_pkgs
     8:     global quiet,force
     9:     check_stamp = "force"  not in options
    10:     if check_stamp:
    11:       plugins['cal_pkgs']()
    12:       print "##### DOCUMENT SELECTED PACKAGES ##################"
    13:     else:
    14:       print "##### DOCUMENT ALL PACKAGES ##################"
    15:       doc_selected_pkgs = pkgs
    16: 
    17:     for pkg in doc_selected_pkgs:
    18:       pkgdict = pkgd[pkg]
    19:       print "***** DOCUMENT PACKAGE "+pkg+" ************"
    20: 
    21:       stamp=os.path.join("pkg-stamps", pkg+".doc")
    22:       erasefile(stamp)
    23: 
    24:       plugins['mkdoc'](pkg, pkgdict)
    25: 
    26:       enstamp(stamp)
    27: 
    28:     print "***** OCAMLDOC COMPILER [HACK!] ************"
    29:     plugins['impldoc']()
    30: 
    31:     print "***** DOXGEN RTL [HACK!] ************"
    32:     plugins['rtldoc']()
    33: 
End python section to mkplugins/doc.py[1]
Start python section to mkplugins/demo.py[1 /1 ]
     1: #line 1786 "./lpsrc/flx_maker.pak"
     2: class PLUGIN(Plugin):
     3:   name = 'demo'
     4:   help = 'build and run the demos'
     5: 
     6:   def runme(self):
     7:     print "##### DEMONSTRATE ALL PACKAGES ##################"
     8:     for pkg in pkgs:
     9:       pkgdict = pkgd[pkg]
    10:       print "***** DEMO PACKAGE "+pkg+" ************"
    11:       plugins['run_demos'](pkg, pkgdict)
    12: 
End python section to mkplugins/demo.py[1]
Start python section to script/maker[1 /1 ]
     1: #!/usr/bin/env python
     2: #line 1800 "./lpsrc/flx_maker.pak"
     3: ###############################################################
     4: # FELIX MAKE SCRIPT
     5: ###############################################################
     6: FLX_MAKER_CVS_ID='$Id: flx_maker.pak 1374 2007-04-13 18:40:51Z skaller $'
     7: import os
     8: import os.path
     9: import getopt
    10: import glob
    11: import stat
    12: import string
    13: import sys
    14: import re
    15: import traceback
    16: import time
    17: this = globals()
    18: 
    19: if '' not in sys.path: sys.path=['']+sys.path
    20: import flxbuild
    21: from flxbuild.flxutil import *
    22: 
    23: execfile(os.path.join("flxbuild", "pluginutil.py"))
    24: 
    25: # ------------------------------------------------
    26: # PROCESS COMMAND LINE OPTIONS
    27: # ------------------------------------------------
    28: 
    29: all_phases = ["build","host","target","run"]
    30: phases = []
    31: options = sys.argv[1:]
    32: try:
    33:   opts, args = getopt.getopt(sys.argv[1:], 'hvqD:Og', [ \
    34:       'help', 'verbose', 'quiet', 'phase=', 'pkg=', 'model=', 'lparchive=',
    35:       'optimise', 'optimize', 'no-optimise', 'no-optimize', 'no-debug'])
    36: except getopt.error, e:
    37:   sys.stderr.write(str(e) + '\n')
    38:   sys.exit(1)
    39: 
    40: quiet = 0
    41: verbose = 1
    42: optimise = 1
    43: debug = 1
    44: packages = []
    45: models = []
    46: macros = []
    47: lparchive = None
    48: help_string = """\
    49: usage: mk [options] [plugins]
    50: 
    51: flags:
    52:   -h, --help      print this help message
    53:   -v, --verbose   print out extra debugging info
    54:   -q, --quiet     do not print out extra debugging info
    55:   -O, --optimise  generate optimised code
    56:   --no-optimise   turn off optimised code generation
    57:   -g, --debug     generate debugging information
    58:   --no-debug      turn off debugging information generation
    59:   -Dmacro[=defn]  define a macro
    60:   --phase         run only this phase of the build %s
    61:   --pkg           build only these packages
    62:   --model         build only these models
    63:   --lparchive     use an alternative lpsrc directory
    64: 
    65: plugins:
    66:   run a custom plugin. run "mk help" to get a list of plugins to run
    67:   """
    68: 
    69: for o, a in opts:
    70:   if o in ['-h', '--help']:
    71:     print help_string % (all_phases)
    72:     sys.exit(0)
    73:   elif o in ['-v', '--verbose']:
    74:     verbose = verbose + 1
    75:   elif o in ['-q', '--quiet']:
    76:     quiet=1
    77:     verbose = 0
    78:   elif o in ['-O', '--optimise', '--optimize']:
    79:     optimise = 1
    80:   elif o in ['--no-optimise', '--no-optimize']:
    81:     optimise = 0
    82:   elif o in ['-g']:
    83:     debug = 1
    84:   elif o in ['--no-debug']:
    85:     debug = 0
    86:   elif o in ['-D']:
    87:     macros.append(a)
    88:   elif o in ['--phase']:
    89:     if a == '*':
    90:       phases = all_phases
    91:     elif a not in all_phases:
    92:       sys.stderr.write('unknown phase: %s\n' % phase)
    93:       sys.exit(1)
    94:     elif a not in phases:
    95:       phases.append(a)
    96:   elif o in ['--pkg']:
    97:     packages.append(a)
    98:   elif o in ['--model']:
    99:     if a not in models:
   100:       models.append(a)
   101:   elif o in ['--lparchive']:
   102:     lparchive = a
   103:   else:
   104:     sys.stderr.write('unknown option: %s %s\n' % (o, a))
   105:     sys.exit(1)
   106: 
   107: host_packages = list(packages)
   108: target_packages = list(packages)
   109: run_packages = list(packages)
   110: doc_packages = list(packages)
   111: 
   112: if not quiet: print "USER SELECTED PACKAGES",packages
   113: 
   114: # ------------------------------------------------
   115: # Load the initial config
   116: # ------------------------------------------------
   117: 
   118: try:
   119:   execfile(os.path.join("config", "config.py"))
   120: except:
   121:   xt,xv,tb = sys.exc_info()
   122:   print "ERROR IN config/config.py"
   123:   traceback.print_exception(xt,xv,tb)
   124:   print "You must either"
   125:   print "(a) edit config/config.py and fix the error, or,"
   126:   print "(b) i) delete it, and,"
   127:   print "    ii) run 'python script/make_config.py'"
   128:   print "       again to reset it:"
   129:   print "       this is done automatically by 'make boot'"
   130:   sys.exit(1)
   131: 
   132: execfile(os.path.join("cpkgs", "build", "interscript.py"))
   133: execfile(os.path.join("mkplugins", "xqt.py"))
   134: 
   135: FLXFLAGS = ""
   136: 
   137: if lparchive is not None:
   138:   FLX_LPARCHIVE = lparchive
   139: 
   140: # if the user didn't say which phases to run
   141: # then run all the phases that use the host model
   142: # On building on Linux for MinGW, the build model
   143: # is linux, and the host model is mingw, the target
   144: # is win32. We'd be running all MinGW phases.
   145: # note a phase is named for the targetted product
   146: # NOT the machine that generates it. Thus host
   147: # phase mingw means 'compile on Linux for MingW'
   148: 
   149: if not phases and not models:
   150:   models = [host_model]
   151: 
   152: for model in models:
   153:   if model == build_model:
   154:     if "build" not in phases: phases.append("build")
   155: 
   156: for model in models:
   157:   if model == host_model:
   158:     if "host" not in phases: phases.append("host")
   159: 
   160: for model in models:
   161:   if model == target_model:
   162:     if "target" not in phases: phases.append("target")
   163: 
   164: for model in models:
   165:   if model == run_model:
   166:     if "run" not in phases: phases.append("run")
   167: 
   168: if verbose and options:
   169:   print "OPTIONS: ", options
   170: 
   171: if not phases:
   172:   phases = all_phases
   173: 
   174: print "Using LP Archive from ",
   175: if FLX_LPARCHIVE == os.curdir:
   176:   print "Current Directory"
   177: else:
   178:   print FLX_LPARCHIVE
   179: 
   180: paks = glob.glob(os.path.join(FLX_LPARCHIVE, "lpsrc", "*.pak"))
   181: 
   182: if "force_extract" in options:
   183:   print "FORCE EXTRACTING SOURCES: remove caches"
   184:   for p in paks:
   185:     cache = p + ".cache"
   186:     if os.path.exists(cache):
   187:       os.remove(cache)
   188: 
   189: if "extract" in options or "force_extract" in options:
   190:   for p in paks:
   191:     print "EXTRACTING",p,"from",FLX_LPARCHIVE
   192:     runISCR(p)
   193:   # this is a hack
   194:   filecopy(
   195:     os.path.join('misc', 'interscript.css'),
   196:     os.path.join('speed', 'interscript.css'))
   197: 
   198:   print "EXTRACTION COMPLETE"
   199:   sys.exit(0)
   200: 
   201: 
   202: raw_pkgs = glob.glob(os.path.join("spkgs", "*.py"))
   203: unsorted_pkgs = []
   204: pkgd = {}
   205: pkgs = []
   206: pkgreqs = {}
   207: 
   208: for i in raw_pkgs:
   209:   pkg = os.path.basename(os.path.splitext(i)[0])
   210:   unsorted_pkgs.append(pkg)
   211: 
   212:   class X:
   213:     execfile(os.path.join("spkgs", pkg+".py"))
   214:   d = {}
   215:   for k in X.__dict__.keys():
   216:     if k[0] != '_':
   217:       v = X.__dict__[k]
   218:       d[k]=v
   219:   pkgd[pkg]=d
   220: 
   221: def addpkg_r(pkg):
   222:   if pkg not in pkgs:
   223:     if pkg not in pkgd.keys():
   224:       print "Unknown package",pkg
   225:       print "Please extract!"
   226:       sys.exit(1)
   227:     else:
   228:       reqs = pkgd[pkg].get('pkg_requires',[])
   229:       pkgreqs[pkg]=reqs
   230:       for i in reqs:
   231:         addpkg_r(i)
   232:       pkgs.append(pkg)
   233: 
   234: for pkg in unsorted_pkgs:
   235:   addpkg_r(pkg)
   236: 
   237: # make sure we delete the pkg so that we don't leak
   238: # references to them
   239: del pkg
   240: 
   241: # invert the requirements in order to determine the dependencies
   242: pkgdeps = invert(pkgreqs)
   243: 
   244: # PRINT PACKAGE DEPENDENCY INFORMATION
   245: if "help" in options:
   246:   print "REQS: "
   247:   ks=pkgreqs.keys()
   248:   ks.sort()
   249:   length = 0
   250:   for k in ks:
   251:     length = max(len(k), length)
   252:   for k in ks:
   253:     print "  ",string.ljust(k,length),pkgreqs[k]
   254: 
   255:   print
   256:   print "DEPS: "
   257:   ks = pkgdeps.keys()
   258:   ks.sort()
   259:   length = 0
   260:   for k in ks:
   261:     length = max(len(k), length)
   262:   for k in ks:
   263:     print "  ",string.ljust(k,length),pkgdeps[k]
   264: 
   265: # -------------------------------------------------
   266: # LOAD PLUGINS
   267: 
   268: plugins = {}
   269: schedule_table = []
   270: scheduled_plugins = []
   271: unscheduled_plugins = []
   272: 
   273: def schedule(plugin):
   274:   if plugin.priority is None:
   275:     unscheduled_plugins.append(plugin)
   276:   else:
   277:     print "Scheduling",plugin.name," priority",plugin.priority
   278:     schedule_table.append((plugin.priority, plugin))
   279:     scheduled_plugins.append(plugin)
   280: 
   281: for f in glob.glob(os.path.join("mkplugins", "*.py")):
   282:   base = os.path.basename(os.path.splitext(f)[0])
   283: 
   284:   try:
   285:     execfile(f)
   286:     if globals().has_key("PLUGIN"):
   287:       plugin = PLUGIN()
   288:       schedule(plugin)
   289:       plugins[plugin.name] = plugin
   290:       del PLUGIN
   291:   except:
   292:     print "Failed to install plugin",f
   293:     raise
   294: 
   295: # END IMPLEMENTOR CONFIGURABLE SECTION
   296: # -------------------------------------------------
   297: 
   298: # ----------- Here begins the actual build procedure ---------------------
   299: 
   300: def enstamp(stamp):
   301:   mkdirs(os.path.split(stamp)[0])
   302:   f = open(stamp,"w")
   303:   t = fmtime(time.time())
   304:   f.write(t+"\n")
   305:   f.close()
   306:   if not quiet:
   307:     print 'Writing Stamp File:', stamp
   308: 
   309: def find_test(tl,a,b):
   310:   for x,y,z in tl:
   311:     if x == a and y == b: return 1
   312:   return 0
   313: 
   314: # EXECUTE USER SELECTED PLUGINS IN COMMAND LINE ORDER
   315: for k in options:
   316:   if k in plugins:
   317:     plugins[k]()
   318:   # FIXME: commented out to allow arbitrary options
   319:   #else:
   320:   #  print "unknown option:", k
   321:   #  raise MakeError
   322: 
   323: # execute scheduled operations in priority order
   324: schedule_table.sort()
   325: for pri,f in schedule_table:
   326:   f()
   327: 
   328: 
   329: if os.name != 'nt': # requires posix
   330:   if "test" in options or "tutorial" in options or "fcount" in options:
   331:     tkind = "std"
   332:     if "inline" in options: tkind="inline"
   333:     elif "noinline" in options: tkind="noinline"
   334:     stats = 'python script/fcount.py misc/fcounts.stats '+tkind+' "tut/examples/*.hpp"'
   335:     exqt(stats)
   336:     stats = 'python script/fcount.py misc/fcounts.stats '+tkind+' "test/*.hpp"'
   337:     exqt(stats)
   338: 
   339:   if "pfcount" in options:
   340:     stats = 'python script/pfcount.py misc/fcounts.stats'
   341:     exqt(stats)
   342: 
   343:   if "pfcount_all" in options:
   344:     stats = 'python script/pfcount.py misc/fcounts.stats all'
   345:     exqt(stats)
   346: 
   347: print
   348: 
   349: # print out all the failed plugins
   350: failure_log = Tee()
   351: 
   352: failure_log.write("----- PLUGIN STATUS -----\n")
   353: failed = 0
   354: fatal = 0
   355: for plugin in scheduled_plugins + unscheduled_plugins:
   356:   nfail = len(plugin.failures)
   357:   npass = len(plugin.successes)
   358:   failed = failed or nfail>0
   359:   fatal = fatal or (nfail>0 and not plugin.dummy)
   360: 
   361:   if nfail:
   362:     failure_log.write('PLUGIN **FAILED**: %s, %d/%d failures\n' % (plugin.name, nfail,npass+nfail))
   363:     if plugin.dummy:
   364:       failure_log.write("  [Expected failure, doesn't break build]\n")
   365:   else:
   366:     if plugin.used:
   367:       failure_log.write('PLUGIN PASSED    : %s, %d pass\n' % (plugin.name,npass))
   368:     else:
   369:       failure_log.write('PLUGIN UNUSED    : %s\n' % plugin.name)
   370: 
   371: 
   372: if failed:
   373:   print '^^^^^^^^^^ FAILURES by group ^^^^^^^^^^^^^'
   374: 
   375:   kats = {}
   376:   for plugin in scheduled_plugins + unscheduled_plugins:
   377:     if not plugin.failures:
   378:       continue
   379: 
   380:     print '- %s: %s' % (len(plugin.failures), plugin.name)
   381: 
   382:     lookup = {}
   383: 
   384:     for pkg, file, failure in plugin.failures:
   385:       files = lookup.get(pkg, [])
   386:       files.append(file)
   387:       lookup[pkg] = files
   388: 
   389:     lookup = lookup.items()
   390:     lookup.sort()
   391: 
   392:     for pkg, files in lookup:
   393:       files.sort()
   394: 
   395:       print '  - %s: %s' % (len(files), pkg)
   396:       lastfile = ""
   397:       for file in files:
   398:         if file == lastfile: continue
   399:         lastfile = file
   400:         # grab the first line of the file to see if it
   401:         # has a #line number to print out as well, so we can
   402:         # localize the error to the interscript file location
   403: 
   404:         emitted = 0
   405:         f = open(file)
   406:         eat = 1
   407:         while eat == 1:
   408:           try:
   409:             line = f.readline()
   410:           except:
   411:             eat = 0
   412:           if emitted == 0: fstring = file
   413:           else: fstring = ""
   414:           if emitted == 0 and line[0:5] == '#line':
   415:             comment = line
   416:           elif line [0:8] == "//Check ":
   417:             kat = string.strip(line[8:])
   418:             l = kats.get(kat,[])
   419:             l.append(file)
   420:             kats[kat]=l
   421:             comment = kat
   422:           else:
   423:             if emitted == 0:
   424:               comment = line
   425:             else:
   426:               comment = ""
   427:             eat = 0
   428:           if line != "":
   429:             print '      %-35s %s' % (fstring, string.strip(comment))
   430:             emitted = 1
   431:         if emitted == 0:
   432:           print '      %s' % file
   433:         f.close()
   434: 
   435:   print '^^^^^^^^^^ FAILURES by category ^^^^^^^^^^'
   436:   keys = kats.keys()
   437:   keys.sort()
   438:   for kat in keys:
   439:     print kat+":"
   440:     files = kats[kat]
   441:     for file in files:
   442:       print "  ",file
   443: 
   444: f = open('errors.log', 'w')
   445: try:
   446:   f.write(failure_log.getvalue())
   447: finally:
   448:   f.close()
   449: 
   450: if fatal:
   451:   print "********* BUILD FAILED ********************"
   452:   sys.exit(1)
   453: 
   454: print "*********** RUN COMPLETE: NO UNEXPECTED FAILURES DETECTED *******"
   455: 
End python section to script/maker[1]