james woodyatt avatar james woodyatt committed 72e057c

Use the https://bitbucket.org/jhw/conjury subrepository instead of
the internal 'project' library of OMake scriptology.

Comments (0)

Files changed (16)

-7d6556f586ef4a63053a8762d280759e34011cfd Conjury
+4c316f071fba5565bbbcf8c480f127551038a0b8 Conjury
 #   beep    The BEEP Core and TCP transport profile
 
 ### Verbose warnings
-CC.OBJFLAGS+=-Wall
-CXX.OBJFLAGS+=-Wall
-OCAMLC.OPTIONS+=-w Ae -principal
-OCAMLOPT.OPTIONS+=-w Ae -principal
+#CC.OBJFLAGS+=-Wall
+#CXX.OBJFLAGS+=-Wall
+#OCAMLC.OPTIONS+=-w Ae -principal
+#OCAMLOPT.OPTIONS+=-w Ae -principal
+OCAMLC.OPTIONS+=-principal
+OCAMLOPT.OPTIONS+=-principal
 
 ### The findlib package
 PKG.=
 DefineCommandVars()
 
 ### Open the project library
-open project/System
+open Conjury/System
 
 ### Define the project root directory
-public.ROOT= $(dir .)
+public.SRCROOT= $(dir .)
 
 ### Emphemeral targets
 .PHONY: clean test documents install remove
     
     ### Create source description
     src.=
-        MLFILES= $(add-wrapper cf_, .ml, $(modules))
-        MLIFILES= $(add-wrapper cf_, .mli, $(modules))
+        MODULES= $(addprefix cf_, $(modules))
         CFILES= $(add-wrapper cf_, _p.c, $(primitives))
         PACKAGES= unix
     
     
     ### Create source description
     src.=
-        MLFILES= t/t_cf.ml
+        MODULES= t/t_cf
         LIBREFS= $(OCaml_library_referral.new $(component), cf, mixed)
         PACKAGES= unix
     
     First, change to the root directory of the project.  Then, adjust the
     environment variables in your shell.
     
-    $ eval `setup.sh`
+    $ eval $(Conjury/environ.sh)
     
     Next, build the Oni libraries and test programs
     
     $ sudo omake remove
 
 Note: you build the debug version instead of the release version by passing the
-      '-d -c debug' options to the setup.sh script.
+      '-d -c debug' options to the environ.sh script.
 
 
 -- james woodyatt <jhw@conjury.org>
     
     ### Create source description
     src.=
-        MLFILES= $(add-wrapper iom_, .ml, $(modules))
-        MLIFILES= $(add-wrapper iom_, .mli, $(modules))
+        MODULES= $(addprefix iom_, $(modules))
         PACKAGES= unix
         COMPONENTS= $(M.cf) $(M.nx)
     
     
     ### Create source description
     src.=
-        MLFILES= t/t_iom.ml
+        MODULES= t/t_iom
         LIBREFS[]=
             $(OCaml_library_referral.new $(M.cf), cf, mixed)
             $(OCaml_library_referral.new $(M.nx), nx, mixed)
     
     ### Create source description
     src.=
-        MLFILES= $(add-wrapper nx_, .ml, $(modules))
-        MLIFILES= $(add-wrapper nx_, .mli, $(modules))
+        MODULES= $(addprefix nx_, $(modules))
         CFILES= $(add-wrapper nx_, _p.c, $(primitives))
         PACKAGES= unix
         COMPONENTS= $(M.cf)
     
     ### Create source description
     src.=
-        MLFILES= t/t_nx.ml
+        MODULES= t/t_nx
         LIBREFS[]=
             $(OCaml_library_referral.new $(M.cf), cf, mixed)
             $(OCaml_library_referral.new $(M.nx), nx, mixed)

project/Compiler.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open library modules
-open project/Stage
-
-### Abstract base class for compiler command drivers
-Compiler.=
-    class Compiler
-    
-    ###
-    # Abstract members:
-    #   this.DRIVER
-    #   this.add-component(component)
-    #   protected.scanner-digests(files)
-    #   protected.scanner-options(input, output)
-    #   protected.composer-options(input, output)
-    
-    ### Variables
-    OPTIONS=
-    DEPEND=
-    
-    ### Add a component to search paths (no operation in base class)
-    protected.add-component(c)=
-        return $(this)
-    
-    ### Rule to scan input file for dependencies
-    protected.scanner-rule(i, o)=
-        private.id=$(file $o).scan
-        private.command=$(this.DRIVER) $(OPTIONS)
-        .SCANNER: $(id): $(DEPEND) $i :value: $(this.scanner-digests $&)
-            $(command) $(this.scanner-options $i, $o)
-        return $(id)
-    
-    ### Rule to compose output file
-    protected.composer-rule(i, o)=
-        private.command=$(this.DRIVER) $(OPTIONS)
-        
-        $o: $i $(this.DEPEND)
-            $(command) $(this.composer-options $i, $o)
-    
-    ### Rule to compose output file with scanner
-    protected.scanning-composer-rule(i, o, s)=
-        private.command=$(this.DRIVER) $(OPTIONS)
-        
-        $o: $i $(this.DEPEND) :scanner: $s
-            $(command) $(this.composer-options $i, $o)
-
-# End $File$

project/Component.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open library modules
-open project/Stage
-
-### The base class for components
-Component.=
-    class Component
-    
-    ### Member variables
-    USING[]=
-    
-    ### Convert a relative name into an absolute name
-    private.mkname(name)=
-        if $(defined this.ABSNAME)
-            value $(ABSNAME)/$(name)
-        else
-            value $(name)
-    
-    ### Convert a relative name into a relative path
-    private.mkpath(name)=
-        return $(concat $"/", $(addsuffix .component, $(split $"/", $(name))))
-    
-    ### Return the stage
-    protected.stage()=
-        if $(defined this.STAGE)
-            value $(this.STAGE)
-        else
-            value $(Stage)
-    
-    ### Exception
-    protected.throw(message)=
-        private.m=$(string $(message))
-        x.=
-            message=$"$m [ABSNAME=$(this.ABSNAME)]"
-        raise $x
-    
-    ### Assert that $c is an instance of Component in context $m
-    assert(c, m)=
-        if $(not $(c.instanceof Component))
-            throw($m)
-        return $c
-    
-    ### Construct a component object by referencing its name
-    ref(name)=
-        private.s=$(this.stage)
-        s.DIR=$(dir $(s.DIR)/$(mkpath $(name)))
-        this.ABSNAME=$(mkname $(name))
-        this.STAGE=$s
-        return $(this)
-    
-    ### Map a sequence of checkpoint names to their timestamp files
-    ck(checkpoints)=
-        return $(this.STAGE.ck $(checkpoints))
-    
-    ### Constructor
-    new(name)=
-        private.s=$(this.stage)
-        this.STAGE=$(s.push $(mkpath $(name)))
-        this.ABSNAME=$(mkname $(name))
-        STAGE.clean()
-        foreach(c, $(CONFIGURATIONS))
-            STAGE.push($c)
-        return $(this)
-
-# End $File$

project/Environment.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Set the TOP directory
-TOP=$(dir .)
-
-### Default sort order
-.ORDER: .BUILDORDER
-
-### Standard phony targets
-.PHONY: clean
-
-### Scanner mode
-NOSCANNER=/.PHONY/__Scanner_dummy
-
-.SCANNER: $(NOSCANNER)
-    @
-
-### Private functions
-private.=
-    
-    ### The stage directory
-    stage=$(dir $(TOP)/stage)
-    
-    ### Decode parameters passed in OMAKEFLAGS
-    dequote(var)=
-        match $(getvar $(var))
-        case $'"\(.*\)"'
-            value $1
-        default
-            value $(getvar $(var))
-    
-    ### Unpack a directory
-    dir-unpack(var, subdir)=
-        var=$(uppercase $(var))
-        if $(defined $(var))
-            value $(dir $(dequote $(var)))
-        else
-            value $(dir $(stage)/$(lowercase $(subdir)))
-
-### Acquire the root
-OBJROOT=$(dir-unpack OBJROOT, obj)
-FINROOT=$(dir-unpack FINROOT, fin)
-AUXROOT=$(dir-unpack AUXROOT, aux)
-TOOLSDIR=$(dir-unpack TOOLSDIR, tools)
-
-### Set the configurations sequence
-CONFIGURATIONS=
-    if $(defined CONFIGURATIONS)
-        value $(set $(split $(dequote CONFIGURATIONS)))
-    else
-        x.message="No CONFIGURATIONS provided in environment!"
-        raise $x
-
-### Set the products sequence
-PRODUCTS=
-    if $(defined PRODUCTS)
-        value $(set $(split $(dequote PRODUCTS)))
-    else
-        value $(EMPTY)
-
-# End $File$

project/Stage.om

-###############################################################################
-#
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open library modules
-open project/Environment
-
-### Base class for staging
-Stage.=
-    class Stage
-    
-    ### Initialize the stage from the object root
-    DIR=$(OBJROOT)
-    
-    ### Push a subdirectory onto STAGE with rules for creating/removing
-    push(subdir) =
-        match $(subdir)
-        case $"^/.*"
-            eprintln(*** Stage.push: absolute path invalid! $(subdir))
-            exit(-1)
-        this.DIR=$(dir $(DIR)/$(subdir))
-        
-        $(DIR):
-            mkdir -p $@
-        
-        return $(this)
-    
-    ### Emit a localized clean rule
-    clean() =
-        clean::
-            rm -rf $(DIR)
-    
-    ### Returns the name of the file in the staging area
-    name(files) =
-        value $(file $(addprefix $(DIR)/, $(basename $(files))))
-    
-    ### Return the name of a checkpoint file in the staging area
-    ck(names) =
-        value $(file $(add-wrapper $(DIR)/, .ck, $(basename $(names))))
-    
-    ### Copy a list of files into the stage directory
-    ln-or-cp(src) =
-        foreach(f, $(src))
-            $(name $f): $(DIR) $f
-                rm -f $@
-                ln-or-cp $f $@
-        value $(name $(src))
-    
-    ### Copy a list of files into the stage directory
-    cp(src) =
-        foreach(f, $(src))
-            $(name $f): $(DIR) $f
-                rm -f $@
-                cp $f $@
-        value $(name $(src))
-    
-    ### Copy a list of files into the stage directory
-    install(src, rwx) =
-        foreach(f, $(src))
-            $(name $f): $(DIR) $f
-                rm -f $@
-                cp $f $@
-                chmod $(rwx) $@
-        value $(name $(src))
-    
-    ### Create a checkpoint file for a list of dependencies
-    checkpoint(ckname, depends) =
-        f=$(ck $(ckname))
-        $f: $(depends) $(DIR)
-            date > $@
-        return $f
-    
-### Assert that $c is an instance of Stage in context $m
-AssertStage(s, m)=
-    if $(not $(s.instanceof Stage))
-        x.=
-            message= $"Stage object required [$m]"
-        raise $x
-    return $s
-
-### End $File$

project/System.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open all the library modules
-open project/Environment
-open project/Stage
-open project/Component
-open project/Unit
-open project/Compiler
-
-open project/lang/C
-open project/lang/OCaml
-
-# End $File$

project/Unit.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open library modules
-open project/Component
-
-### The base class for composition units
-Unit.=
-    class Unit
-    
-    ### Exception
-    protected.throw(message)=
-        exception.=
-            message=$"$(message) [NAME=$(this.NAME)]"
-        raise $(exception)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        if $(not $(src.NAME))
-            x.=
-                message= $"Unit.source is anonymous in $(context)"
-            raise $x
-        this.NAME=$(src.NAME)
-        this.COMPONENTS[]=
-        if $(src.object-mem COMPONENTS)
-            private.cs=$(src.COMPONENTS)
-            foreach(c, $(cs))
-                Component.assert($c, $(context))
-            this.COMPONENTS=$(cs)
-            export
-        return $(this)
-
-# End $File$

project/lang/C.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open library modules
-open project/Environment
-open project/Compiler
-open project/Stage
-open project/Component
-open project/Unit
-
-### The base class for C language compilers
-C_compiler.=
-    class C_compiler
-    extends $(Compiler)
-    
-    ### Variables
-    CPPFLAGS=
-    OBJFLAGS=
-    LDFLAGS=
-    EXTENSION=.o
-    INCLUDE[]=
-        $(TOOLSDIR)/include
-    LDSEARCH[]=
-        $(TOOLSDIR)/lib
-    
-    ### Add a component to search paths
-    add-component(c)=
-        s=$(c.stage)
-        INCLUDE+= $(dir $(s.DIR)/include)
-        LDSEARCH+= $(dir $(s.DIR)/lib)
-        return $(this)
-    
-    ### Include search options
-    protected.include-search()=
-        return $(addprefix -I, $(INCLUDE))
-    
-    ### Linker search options
-    protected.library-search()=
-        return $(addprefix -L, $(LDSEARCH))
-    
-    ### Search for digests
-    protected.scanner-digests(files)=
-        return $(digest-in-path-optional $(INCLUDE), $(files))
-    
-    ### Replace suffix with object file extension
-    protected.replace-extension(files)=
-        return $(addsuffix $(EXTENSION), $(removesuffix $(files)))
-    
-    ### Scanner rule command driver options
-    protected.scanner-options(src, obj)=
-        return $(CPPFLAGS) $(include-search) -MM -MT $(obj) $(src)
-    
-    ### Composer rule command driver options for compiling objects
-    protected.obj-composer-options(src, obj)=
-        return $(CPPFLAGS) $(OBJFLAGS) $(include-search) -o $(obj) -c $(src)
-    
-    ### Composer rule command driver options for linking products
-    protected.link-composer-options(src, libs, obj)=
-        libs=$(addprefix -l, $(libs))
-        return $(LDFLAGS) $(library-search) $(libs) -o $(obj) $(src)
-    
-    ### Compose object files in staging directory
-    objects(cfiles, dst)=
-        cfiles=$(file $(cfiles))
-        dst=$(dir $(dst))
-        DEPEND+=$(dst)
-        this.composer-options(src, obj)=
-            return $(obj-composer-options $(src), $(obj))
-        obj=
-            foreach(i, $(cfiles))
-                o= $(file $(addprefix $(dst)/, $(replace-extension $i)))
-                scanning-composer-rule($i, $o, $(scanner-rule $i, $o))
-                value $o
-        return $(obj)
-    
-    ### Compose linker product in staging directory
-    executable(program, objfiles, libs, dst)=
-        private.inputs=$(file $(objfiles))
-        dst=$(dir $(dst))
-        program=$(file $(dst)/$(program))
-        this.composer-options(src, obj)=
-            return $(link-composer-options $(src), $(libs), $(obj))
-        composer-rule($(inputs), $(program))
-        return $(program)
-
-### The C compiler
-CC.=
-    extends $(C_compiler)
-    DRIVER=cc
-
-### The C++ compiler
-CXX.=
-    extends $(C_compiler)
-    DRIVER=c++
-
-### The static archiver
-AR.=
-    extends $(Compiler)
-    
-    ### The default command driver is ar
-    DRIVER=ar
-    
-    ### Compose static archive in staging directory
-    archive(afile, objfiles, dst)=
-        objfiles=$(file $(objfiles))
-        dst=$(dir $(dst))
-        afile=$(file $(dst)/$(afile))
-        $(afile): $(objfiles) $(DEPEND)
-            rm -f $@
-            $(DRIVER) $(OPTIONS) -q -cs $@ $(objfiles)
-        return $(afile)
-
-### Component for staging C/C++ language compositions
-C_component.=
-    class C_component
-    extends $(Component)
-    
-    ### Protected methods
-    protected.add-search-paths(incl, lib)=
-        this.CC.INCLUDE[]+=$(incl)
-        this.CC.LDSEARCH[]+=$(lib)
-        this.CXX.INCLUDE[]+=$(incl)
-        this.CXX.LDSEARCH[]+=$(lib)
-        return $(this)
-    
-    ### Assert that $c is an instance of C_component in context $m
-    assert(c, m)=
-        if $(not $(c.instanceof C_component))
-            m=$(string $m)
-            x.=
-                message=$"C_component object required [$m]"
-            raise $x
-        return $c
-    
-    ### Add dependent checkpoints
-    depend(checkpoints)=
-        this.CC.DEPEND+=$(checkpoints)
-        this.CXX.DEPEND+=$(checkpoints)
-        this.AR.DEPEND+=$(checkpoints)
-        return $(this)
-    
-    ### Add a component to the include and library search paths
-    search(c)=
-        c=$(C_component.assert $c, C_component.add-search-paths)
-        private.incl=$(dir $(c.STAGE.DIR)/include)
-        private.lib=$(dir $(c.STAGE.DIR)/lib)
-        this=$(add-search-paths $(incl), $(lib))
-        return $(this)
-    
-    ### Reference an existing C component
-    ref(name)=
-        return $(Component::ref $(name))
-    
-    ### Construct a new component object
-    new(name)=
-        this=$(Component::new $(name))
-        incl=$(STAGE.push $"include")
-        lib=$(STAGE.push lib)
-        bin=$(STAGE.push bin)
-        private.=
-            s.=
-                incl=$(incl)
-                lib=$(lib)
-                bin=$(bin)
-            d=$(incl.DIR) $(lib.DIR) $(bin.DIR)
-        this.CC=$(CC)
-        this.CXX=$(CXX)
-        this.AR=$(AR)
-        this.CXX.DEPEND+=$d
-        this.CC.DEPEND+=$d
-        this.AR.DEPEND+=$d
-        this.substages=$s
-        this=$(add-search-paths $(s.incl.DIR), $(s.lib.DIR))
-        private.=
-            cklib=$(STAGE.checkpoint libraries, $(EMPTY))
-            ckbin=$(STAGE.checkpoint programs, $(EMPTY))
-        .DEFAULT: $(cklib) $(ckbin)
-        return $(this)
-
-### Base class for C language composition units
-C_unit.=
-    class C_unit
-    extends $(Unit)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        this=$(Unit::source $(src), $(context))
-        if $(not $(src.CFILES))
-            throw($"C unit has no CFILES member [$(context)]")
-        this.CFILES=$(file $(src.CFILES))
-        return $(this)
-    
-    ### Construct a new composer
-    protected.new(name, src, context)=
-        src.NAME=$(name)
-        this=$(source $(src), $(context))
-        return $(this)
-
-### C static library composition units
-C_static_library.=
-    class C_static_library
-    extends $(C_unit)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        this=$(C_unit::source $(src), $(context))
-        this.HPREFIX=$(src.HPREFIX)
-        this.HFILES=$(if $(src.HFILES), $(file $(src.HFILES)), $(EMPTY))
-        return $(this)
-    
-    ### Construct a new composer
-    new(name, src)=
-        return $(C_unit::new $(name), $(src), C_static_library.new)
-    
-    ### Compose
-    compose(c)=
-        c=$(C_component.assert $c, $"C_static_library $(this.NAME)")
-        private.=
-            libname=$"lib$(this.NAME).a"
-            d=$(c.substages.incl)
-            d=$(if $(this.HPREFIX), $(d.push $(this.HPREFIX)), $d)
-            CC=$(c.CC)
-            CC.DEPEND+=$(d.ln-or-cp $(this.HFILES))
-            ofiles=$(CC.objects $(this.CFILES), $(c.substages.lib.DIR))
-            AR=$(c.AR)
-            AR.DEPEND+=$(ofiles)
-            archive=$(AR.archive $(libname), $(ofiles), $(c.substages.lib.DIR))
-        
-        $(c.ck libraries): $(archive)
-        
-        return $(archive)
-
-### C executable program composition units
-C_executable.=
-    class C_executable
-    extends $(C_unit)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        this=$(C_unit::source $(src), $(context))
-        this.LIBS=$(if $(src.LIBS), $(src.LIBS), $(EMPTY))
-        return $(this)
-    
-    ### Construct a new composer
-    new(name, src)=
-        return $(C_unit::new $(name), $(src), C_executable.new)
-    
-    ### Compose
-    compose(c)=
-        c=$(C_component.assert $c, $"C_executable $(this.NAME)")
-        private.=
-            dst=$(c.substages.bin.DIR)
-            CC=$(c.CC)
-            ofiles=$(CC.objects $(this.CFILES), $(dst))
-            CC.DEPEND+=$(ofiles)
-            program=$(CC.executable $(this.NAME), $(ofiles), $(LIBS), $(dst))
-        
-        $(c.ck programs): $(program)
-        
-        return $(program)
-
-### C executable test program composition units
-C_test_program.=
-    class C_test_program
-    extends $(C_executable)
-    
-    ### Construct a new composer
-    new(name, src)=
-        return $(C_executable::new $(name), $(src))
-    
-    ### Extend the composer to add the <test> ephemeral target
-    compose(c)=
-        program=$(C_executable::compose $c)
-        
-        test: $(program)
-            $(program) -verbose
-        
-        return $(program)
-
-# End $File$

project/lang/OCaml.om

-##############################################################################
-# 
-# $Change$
-# Copyright (C) 2009, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-### Open library modules
-open project/Environment
-open project/Compiler
-open project/Stage
-open project/Component
-open project/Unit
-
-### Select the appropriate OCaml compiler driver
-private.SelectDriver(name)=
-    optname=$"$(name).opt"
-    if $(where $(optname))
-        return $(optname)
-    elseif $(where $(name))
-        return $(name)
-    else
-        eprintln(*** Error: neither $(name) nor $(optname) in PATH)
-        exit(-1)
-
-### Installed drivers
-static.=
-    USE.=
-        ocamldep=$(SelectDriver ocamldep)
-        ocamlc=$(SelectDriver ocamlc)
-        ocamlopt=$(SelectDriver ocamlopt)
-        ocamldoc=$(SelectDriver ocamldoc)
-
-### The Objective Caml native/byte-code compilers
-OCaml_compiler.=
-    class OCaml_compiler
-    extends $(Compiler)
-    
-    ### Variables
-    SEARCH[]=
-    PACKAGES[]=
-    PREDICATES[]=
-    CFLAGS=-fPIC -Wall
-    
-    ### The verbose flag
-    verbose-flag()=
-        return $(if $(VERBOSE), -verbose, $(EMPTY))
-    
-    ### Dependency scanner command driver
-    protected.cmd-driver(cmd)=
-        private.driver=$(getvar USE.$(cmd))
-        export driver
-        if $(PACKAGES)
-            driver=ocamlfind $(cmd)
-            driver+= -package $(concat $",", $(PACKAGES))
-            if $(PREDICATES)
-                driver+= -predicate $(concat $",", $(PREDICATES))
-        return $(driver)
-    
-    ### Map the -ccopt flag to the CFLAGS variable
-    protected.c-flags()=
-        return $(mapprefix -ccopt, $(CFLAGS))
-    
-    ### Include compiler search options
-    protected.include-search()=
-        return $(mapprefix -I, $(SEARCH))
-    
-    ### Include C linker search options
-    protected.support-library-search()=
-        private.path=$(SEARCH)
-        path=$(addprefix -L, $(path))
-        path=$(mapprefix -cclib, $(path))
-        return $(path)
-    
-    ### Replace suffix with object file extension
-    protected.replace-extension(extension, f)=
-        return $(file $(addsuffix $(extension), $(removesuffix $f)))
-    
-    ### Scanner digests
-    protected.scanner-digests(files)=
-        return $(digest-in-path-optional $(SEARCH), $(files))
-    
-    ### Composer rule command driver options for scanning objects
-    protected.ocaml-scanner-options(src, obj)=
-        return $(include-search) $(src)
-    
-    ### Scanner rule command driver options
-    protected.primitive-scanner-options(src, obj)=
-        return $(include-search) -c -ccopt -MM -ccopt -MT -ccopt $(obj) $(src)
-    
-    ### Composer rule command driver options for compiling objects
-    protected.composer-options(src, obj)=
-        return $(include-search) -o $(obj) -c $(src)
-    
-    ### Scanner output edit line
-    protected.ocaml-scanner-fprint1(fp, d, line)=
-        foreach(j, $(split $(line)))
-            if $(equal $j, \\)
-                fprint($(fp), $(EMPTY))
-            elseif $(equal $j, $(basename $j))
-                export j
-                match $j
-                case $"\.cmi"
-                    if $(this.object-mem CMIDIR)
-                        j=$(addprefix $(CMIDIR)/, $j)
-                    else
-                        j=$(addprefix $d/, $j)
-                default
-                    j=$(addprefix $d/, $j)
-                fprint($(fp), $" $j")
-            else
-                fprint($(fp), $" $j")
-    
-    ### Scanner output
-    protected.ocaml-scanner-fprint(fp, o, lines)=
-        private.d=$(dirname $o)
-        o=$(basename $o)
-        private.start=
-        export start
-        foreach(line, $(lines))
-            match $(line)
-            case $"^ +\(.*\)"
-                private.text=$1
-                if $(equal $o, $(start))
-                    ocaml-scanner-fprint1($(fp), $d, $(text))
-            case $"^\([^:]+\): \(.*\)"
-                private.text=$2
-                start=$1
-                start=$(basename $(start))
-                if $(equal $(start), $o)
-                    print($"$d/$o: ")
-                    ocaml-scanner-fprint1($(fp), $d, $(text))
-            default
-                x.=
-                    message=$"unmatched ocamldep output $(line)"
-                raise $x
-        fprintln($(fp), $" ")
-    
-    ### Scanner output to stdout
-    protected.ocaml-scanner-print(o, lines)=
-        ocaml-scanner-fprint($(stdout), $o, $(lines))
-    
-    ### Specialized rule to scan input file for dependencies
-    protected.ocaml-scanner-rule(i, o)=
-        private.id=$(file $o).scan
-        private.drv=$(this.cmd-driver ocamldep)
-        private.command=$(drv) $(ocaml-scanner-options $i, $o)
-        
-        .SCANNER: $(id): $(DEPEND) $i :value: $(this.scanner-digests $&)
-            ocaml-scanner-print($o, $(shella $(command)))
-        
-        return $(id)
-    
-    ### Specialized rule to scan primitive file for dependencies
-    protected.primitive-scanner-rule(i, o)=
-        private.id=$(file $o).scan
-        
-        .SCANNER: $(id): $(DEPEND) $i :value: $(this.scanner-digests $&)
-            $(this.DRIVER) $(primitive-scanner-options $i, $o)
-        
-        return $(id)
-    
-    ### Compose compiled interface files in staging directory
-    cmi-files(srcfiles, dst)=
-        srcfiles=$(file $(srcfiles))
-        dst=$(dir $(dst))
-        this.DEPEND+=$(dst)
-        obj=
-        export obj
-        foreach(i, $(srcfiles))
-            o=$(addprefix $(dst)/,  $(replace-extension .cmi, $(basename $i)))
-            o=$(file $o)
-            s=$(ocaml-scanner-rule $i, $o)
-            scanning-composer-rule($i, $o, $s)
-            obj+= $o
-        return $(obj)
-    
-    ### Compose C-language primitive objects
-    c-primitives(srcfiles, dst)=
-        srcfiles=$(file $(srcfiles))
-        dst=$(dir $(dst))
-        this.DEPEND+=$(dst)
-        obj=
-        export obj
-        foreach(i, $(srcfiles))
-            o=$(addprefix $(dst)/,  $(replace-extension .o, $(basename $i)))
-            o=$(file $o)
-            s=$(primitive-scanner-rule $i, $o)
-            this.CFLAGS+=-o $o
-            this.OPTIONS+=$(c-flags)
-            scanning-composer-rule($i, $o, $s)
-            obj+= $o
-        return $(obj)
-    
-    ### Compose executable program in staging directory
-    program(name, config, modules, dst)=
-        modules=$(file $(modules))
-        dst=$(dir $(dst))
-        program=$(file $(dst)/$(name))
-        this.DEPEND+=$(dst)
-        if $(PACKAGES)
-            this.OPTIONS+=-linkpkg
-            export
-        this.composer-options(src, obj)=
-            private.opts=$(include-search) $(support-library-search)
-            return $(opts) -o $(obj) $(src)
-        composer-rule($(modules), $(program))
-        return $(program)
-
-### The OCaml byte compiler
-OCAMLC.=
-    class OCaml_byte_compiler
-    extends $(OCaml_compiler)
-    
-    ### Driver
-    DRIVER()=
-        return $(cmd-driver ocamlc)
-    
-    ### Compose byte compiled module files in staging directory
-    cmo-files(srcfiles, dst)=
-        srcfiles=$(file $(srcfiles))
-        dst=$(dir $(dst))
-        this.DEPEND+=$(dst)
-        cmo=
-        export cmo
-        foreach(i, $(srcfiles))
-            o=$(addprefix $(dst)/, $(replace-extension .cmo, $(basename $i)))
-            o=$(file $o)
-            s=$(ocaml-scanner-rule $i, $o)
-            scanning-composer-rule($i, $o, $s)
-            cmo+= $o
-        return $(cmo)
-    
-    ### Compose native compiled library file in staging directory
-    cma-file(name, cmofiles, dst)=
-        dst=$(dir $(dst))
-        this.DEPEND+=$(dst)
-        private.cma=$(file $(dst)/$(name).cma)
-        this.composer-options(i, o)=
-            return -a $(include-search) -o $o $i
-        composer-rule($(cmofiles), $(cma))
-        return $(cma)
-
-### The OCaml native compiler
-OCAMLOPT.=
-    class OCaml_native_compiler
-    extends $(OCaml_compiler)
-    
-    ### Driver
-    DRIVER()=
-        return $(cmd-driver ocamlopt)
-    
-    ### Rule to compose output file with scanner and side-effects
-    protected.cmx-composer-rule(i, o, s)=
-        private.aux=$(replacesuffixes .cmx, .o, $o)
-        
-        $o $(aux): $i $(this.DEPEND) :scanner: $s
-            $(this.DRIVER) $(OPTIONS) $(include-search) -o $o -c $i
-    
-    ### Compose native compiled module files in staging directory
-    cmx-files(srcfiles, dst)=
-        srcfiles=$(file $(srcfiles))
-        dst=$(dir $(dst))
-        this.DEPEND+=$(dst)
-        cmx=
-        export cmx
-        foreach(i, $(srcfiles))
-            private.o=$(replace-extension .cmx, $(basename $i))
-            o=$(file $(addprefix $(dst)/, $o))
-            s=$(ocaml-scanner-rule $i, $o)
-            cmx-composer-rule($i, $o, $s)
-            cmx+= $o
-        return $(cmx)
-    
-    ### Compose native compiled library file in staging directory
-    native-library(name, cmxfiles, dst)=
-        dst=$(dir $(dst))
-        this.DEPEND+=$(dst)
-        private.cmxa=$(file $(dst)/$(name).cmxa)
-        private.a=$(replacesuffixes .cmxa, .a, $(cmxa))
-        this.composer-options(i, o)=
-            return -a $(include-search) $(verbose-flag) -o $(cmxa) $i
-        composer-rule($(cmxfiles), $(cmxa) $a)
-        return $(cmxa) $a
-
-### The OCaml library compiler driver
-OCAMLMKLIB.=
-    extends $(Compiler)
-    
-    ### Driver
-    DRIVER=ocamlmklib
-    SEARCH[]=
-    SUPPORT[]=
-    
-    ### The verbose flag
-    protected.verbose-flag()=
-        return $(if $(VERBOSE), -verbose, $(EMPTY))
-    
-    ### Linker search options
-    protected.library-search()=
-        return $(mapprefix -L, $(SEARCH))
-    
-    ### Linker reference options
-    protected.library-ref()=
-        return $(addprefix -l, $(SUPPORT))
-    
-    ### Composer options
-    protected.mklib-composer-options(i, o)=
-        return $(verbose-flag) -o $o $(library-search) $(library-ref) $i
-        
-    ### Composer rule
-    protected.mklib-composer-rule(name, outputs, inputs, dst)=
-        private.command=$(this.DRIVER) $(OPTIONS)
-        private.inputs=$(file $(inputs))
-        private.outputs=$(file $(addprefix $(dst)/, $(outputs)))
-        
-        $(outputs): $(inputs) $(this.DEPEND)
-            section
-                cd $(dst)
-                $(command) $(mklib-composer-options $(inputs), $(name))
-        
-        return $(outputs)
-    
-    ### Invoke ocamlmklib to make C libraries
-    c-library(name, ofiles, dst)=
-        private.libs=lib$(name).a dll$(name).so
-        return $(mklib-composer-rule $(name), $(libs), $(ofiles), $(dst))
-    
-    ### Invoke ocamlmklib to make bytecode libraries
-    byte-library(name, cmofiles, dst)=
-        private.libs=$(name).cma
-        return $(mklib-composer-rule $(name), $(libs), $(cmofiles), $(dst))
-    
-    ### Invoke ocamlmklib to make bytecode libraries
-    native-library(name, cmxfiles, dst)=
-        private.libs=$(name).cmxa $(name).a
-        return $(mklib-composer-rule $(name), $(libs), $(cmxfiles), $(dst))
-
-### The OCaml document generator
-OCAMLDOC.=
-    extends $(OCaml_compiler)
-    
-    ### Driver
-    DRIVER()=
-        return $(cmd-driver ocamldoc)
-    
-    ### The verbose flag
-    verbose-flag()=
-        return $(if $(VERBOSE), -v, $(EMPTY))
-    
-    ### Composer options
-    protected.composer-options(src, index)=
-        private.opts=-html -colorize-code -short-functors
-        private.opts+=$(verbose-flag) $(include-search)
-        return $(opts) -d $(dirname $(index)) $(src)
-    
-    ### Generate HTML documents
-    html-documents(srcfiles, dst)=
-        private.index=$(file $(dst)/index.html)
-        private.mlifiles=$(filter %.mli, $(srcfiles))
-        composer-rule($(mlifiles), $(index))
-        return $(index)
-
-### Component for staging OCaml language compositions
-OCaml_component.=
-    class OCaml_component
-    extends $(Component)
-    
-    ### Assert that $c is an instance of OCaml_component in context $m
-    assert(c, m)=
-        if $(not $(c.instanceof OCaml_component))
-            m=$(string $m)
-            x.=
-                message=$"OCaml_component object required [$m]"
-            raise $x
-        return $c
-    
-    ### Construct a new component object
-    new(name)=
-        this=$(Component::new $(name))
-        private.=
-            ckifc=$(STAGE.checkpoint interfaces, $(EMPTY))
-            cklib=$(STAGE.checkpoint libraries, $(EMPTY))
-            ckbin=$(STAGE.checkpoint programs, $(EMPTY))
-        .DEFAULT: $(ckifc) $(cklib) $(ckbin)
-        return $(this)
-    
-    ### Return a structure describing a library
-    library-referers(name)=
-        r.=
-            class OCaml_library_referral
-            cma(config)=
-                return $(file $(STAGE.DIR)/$(config)/$(name).cma)
-            cmxa(config)=
-                return $(file $(STAGE.DIR)/$(config)/$(name).cmxa)
-        return $r
-    
-    ### Add component to document search path for package
-    package-search(p)=
-        p.DOCSEARCH+=$(this.STAGE.DIR)
-        return $p
-
-### Class of objects that refer to an OCaml library in a component
-OCaml_library_referral.=
-    class OCaml_library_referral
-    
-    ### Return the location of the bytecode library
-    cma(config)=
-        return $(file $(this.DIR)/$(config)/$(this.NAME).cma)
-    
-    ### Return the location of the native library
-    cmxa(config)=
-        return $(file $(this.DIR)/$(config)/$(this.NAME).cmxa)
-    
-    ### Construct a referral object for a component and library name
-    new(c, name, custom)=
-        c=$(OCaml_component.assert $c, $"OCaml_library_referral")
-        this.DIR=$(c.STAGE.DIR)
-        this.NAME=$(name)
-        switch $(custom)
-        case $"pure"
-            this.MIXED=false
-            export
-        case $"mixed"
-            this.MIXED=true
-            export
-        default
-            eprintln(*** OCaml_library_referral.new: $(custom) != pure/mixed)
-            exit(-1)
-        return $(this)
-
-### Base class for OCaml language composition units
-OCaml_unit.=
-    class OCaml_unit
-    extends $(Unit)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        this=$(Unit::source $(src), $(context))
-        if $(not $(src.MLFILES))
-            throw($"OCaml unit has no MLFILES member [$(context)]")
-        this.MLFILES=$(file $(src.MLFILES))
-        this.MLIFILES[]=
-        if $(src.object-mem MLIFILES)
-            this.MLIFILES=$(file $(src.MLIFILES))
-            export
-        this.MLLFILES[]=
-        this.MLYFILES[]=
-        if $(src.object-mem MLLFILES)
-            this.MLLFILES=$(file $(src.MLLFILES))
-            export
-        if $(src.object-mem MLYFILES)
-            this.MLYFILES=$(file $(src.MLYFILES))
-            export
-        this.PACKAGES[]=
-        this.PREDICATES[]=
-        if $(src.object-mem PACKAGES)
-            this.PACKAGES=$(src.PACKAGES)
-            if $(src.object-mem PREDICATES)
-                this.PREDICATES=$(src.PREDICATES)
-                export
-            export
-        this.OCAMLC=$(public.OCAMLC)
-        this.OCAMLOPT=$(public.OCAMLOPT)
-        this.OCAMLMKLIB=$(public.OCAMLMKLIB)
-        return $(this)
-    
-    ### Specialize a compiler object
-    protected.specialize-compiler(cc)=
-        export cc
-        if $(this.PACKAGES)
-            cc.PACKAGES=$(PACKAGES)
-            if $(this.PREDICATES)
-                cc.PREDICATES=$(this.PREDICATES)
-        foreach(c, $(this.COMPONENTS))
-            cc.SEARCH+=$(c.STAGE.DIR)
-        return $(cc)
-    
-    ### Configure a compiler object
-    protected.configure-compiler(cc, config)=
-        export cc
-        cc=$(specialize-compiler $(cc))
-        match $(config)
-        case $"debug"
-            cc.OPTIONS+=-g
-            cc.CFLAGS+=-g
-        case $"release"
-            cc.OPTIONS+=-warn-error A
-            cc.CFLAGS+=-Werror -O2
-            if $(cc.instanceof OCaml_native_compiler)
-                cc.OPTIONS+=-inline 9 -noassert -unsafe
-        return $(cc)
-    
-    ### Protected composer method
-    protected.precompose(c)=
-        ckdeps=
-        export ckdeps
-        foreach(c0, $(this.COMPONENTS))
-            ckdeps+=$(c0.ck libraries)
-        this.COMPONENTS+=$c
-        this.OCAMLC.DEPEND+=$(ckdeps)
-        this.OCAMLOPT.DEPEND+=$(ckdeps)
-        private.cmi=
-        if $(this.MLIFILES)
-            private.cc=$(specialize-compiler $(this.OCAMLC))
-            cmi=$(cc.cmi-files $(this.MLIFILES), $(c.STAGE.DIR))
-            $(c.ck interfaces): $(cmi)
-            export cmi
-        this.OCAMLC.CMIDIR=$(c.STAGE.DIR)
-        this.OCAMLOPT.CMIDIR=$(c.STAGE.DIR)
-        this.OCAMLC.DEPEND+=$(c.ck interfaces)
-        this.OCAMLOPT.DEPEND+=$(c.ck interfaces)
-        return $(this)
-    
-    ### Configuration visitor
-    protected.visit-configurations(c)=
-        private.outputs=
-        export outputs
-        foreach(config, $(this.CONFIGURATIONS))
-            this.OCAMLC=$(configure-compiler $(this.OCAMLC), $(config))
-            this.OCAMLOPT=$(configure-compiler $(this.OCAMLOPT), $(config))
-            private.dst=$(dir $(c.STAGE.DIR)/$(config))
-            private.cmo=$(this.OCAMLC.cmo-files $(this.MLFILES), $(dst))
-            private.cmx=$(this.OCAMLOPT.cmx-files $(this.MLFILES), $(dst))
-            outputs+=$(this.compose-aux $(config), $(cmo), $(cmx), $(dst))
-        return $(outputs)
-    
-    ### Final configuration
-    protected.final-configuration()=
-        if $(mem release, $(CONFIGURATIONS))
-            return release
-        else
-            return $(nth 0, $(CONFIGURATIONS))
-    
-    ### Construct a new composer
-    protected.new(name, src, context)=
-        src.NAME=$(name)
-        this=$(source $(src), $(context))
-        return $(this)
-
-### OCaml library composition units
-OCaml_library.=
-    class OCaml_library
-    extends $(OCaml_unit)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        this=$(OCaml_unit::source $(src), $(context))
-        this.CFILES[]=
-        if $(src.object-mem CFILES)
-            this.CFILES=$(src.CFILES)
-            export
-        return $(this)
-    
-    ### Auxillary composition method
-    protected.compose-aux(config, cmo, cmx, dst)=
-        private.cc=$(this.OCAMLC)
-        private.ccopt=$(this.OCAMLOPT)
-        private.outputs=
-        export outputs
-        if $(this.CFILES)
-            private.mklib=$(this.OCAMLMKLIB)
-            private.libs=
-            private.po=$(ccopt.c-primitives $(this.CFILES), $(dst))
-            private.pa=$(mklib.c-library $(this.NAME), $(po), $(dst))
-            outputs+=$(pa)
-            libs=$(mklib.byte-library $(this.NAME), $(cmo), $(dst))
-            $(libs): $(pa)
-            outputs+=$(libs)
-            libs=$(mklib.native-library $(this.NAME), $(cmx), $(dst))
-            $(libs): $(pa)
-            outputs+=$(libs)
-        else
-            outputs+=$(cc.cma-file $(this.NAME), $(cmo), $(dst))
-            outputs+=$(ccopt.native-library $(this.NAME), $(cmx), $(dst))
-        return $(outputs)
-    
-    ### Construct a new composer
-    new(name, src)=
-        return $(OCaml_unit::new $(name), $(src), OCaml_library.new)
-    
-    ### Compose
-    compose(c)=
-        c=$(OCaml_component.assert $c, $"OCaml_library $(NAME)")
-        this=$(precompose $c)
-        private.libs=$(visit-configurations $c)
-        
-        $(c.ck libraries): $(libs)
-        
-        return $(libs)
-    
-    ### Package files
-    package-files(c)=
-        c=$(OCaml_component.assert $c, $"OCaml_library $(NAME)")
-        private.cdir=$(dir $(c.STAGE.DIR)/$(final-configuration))
-        private.mli=$(basename $(this.MLIFILES))
-        private.cmi=$(replacesuffixes .mli, .cmi, $(mli))
-        private.cmi=$(file $(addprefix $(c.STAGE.DIR)/, $(cmi)))
-        private.ml=$(basename $(this.MLFILES))
-        private.cmx=$(replacesuffixes .ml, .cmx, $(ml))
-        private.cmx=$(file $(addprefix $(cdir)/, $(cmx)))
-        private.libs=$(addprefix $(this.NAME), .cma .cmxa .a)
-        export libs
-        if $(this.CFILES)
-            libs+=dll$(this.NAME).so lib$(this.NAME).a
-        libs=$(file $(addprefix $(cdir)/, $(libs)))
-        return $(this.MLIFILES) $(cmi) $(cmx) $(libs)
-    
-    ### Package archive specifiers
-    package-archives()=
-        private.byte=$(this.NAME).cma
-        private.native=$(this.NAME).cmxa
-        s.=
-            extends $(Map)
-            $|byte|=$(byte)
-            $|native|=$(native)
-        return $s
-
-### OCaml library composition units
-OCaml_program.=
-    class OCaml_program
-    extends $(OCaml_unit)
-    
-    ### Normalize the source description
-    protected.source(src, context)=
-        this=$(OCaml_unit::source $(src), $(context))
-        this.LIBREFS[]=
-        if $(src.object-mem LIBREFS)
-            this.LIBREFS=$(src.LIBREFS)
-            export
-        return $(this)
-    
-    ### Return the dynamic library search path
-    protected.support-load-paths(config)=
-        search=
-        export search
-        foreach(r, $(this.LIBREFS))
-            search+=$(dir $(r.DIR)/$(config))
-        return $(search)
-    
-    ### Auxillary composition method
-    protected.compose-aux(config, cmo, cmx, dst)=
-        # define aux here to work around what looks like an OMake bug
-        private.aux=$(config)
-        cma=
-        cmxa=
-        load=$(support-load-paths $(config))
-        export cma cmxa
-        foreach(r, $(this.LIBREFS))
-            cma+=$(r.cma $(aux))
-            cmxa+=$(r.cmxa $(aux))
-        private.programs=
-        export programs
-        section
-            private.cc=$(this.OCAMLC)
-            cc.OPTIONS+=$(cc.verbose-flag)
-            cc.DEPEND+=$(cma)
-            cc.SEARCH+=$(load)
-            objs=$(cma) $(cmo)
-            name=$(this.NAME).run
-            programs+=$(cc.program $(name), $(config), $(objs), $(dst))
-        section
-            private.cc=$(this.OCAMLOPT)
-            cc.OPTIONS+=$(cc.verbose-flag)
-            cc.DEPEND+=$(cmxa)
-            cc.SEARCH+=$(load)
-            objs=$(cmxa) $(cmx)
-            name=$(this.NAME)
-            programs+=$(cc.program $(name), $(config), $(objs), $(dst))
-        return $(programs)
-    
-    ### Construct a new composer
-    new(name, src)=
-        return $(OCaml_unit::new $(name), $(src), OCaml_program.new)
-    
-    ### Compose
-    compose(c)=
-        c=$(OCaml_component.assert $c, $"OCaml_program $(this.NAME)")
-        this=$(precompose $c)
-        private.progs=$(visit-configurations $c)
-        
-        $(c.ck programs): $(progs)
-        
-        return $(progs)
-
-### OCaml program test program composition units
-OCaml_test_program.=
-    class OCaml_test_program
-    extends $(OCaml_program)
-    
-    ### Construct a new composer
-    new(name, src)=
-        return $(OCaml_program::new $(name), $(src))
-    
-    ### Extend the composer to add the <test> ephemeral target
-    compose-aux(config, cmo, cmx, dst)=
-        progs=$(OCaml_program::compose-aux $(config), $(cmo), $(cmx), $(dst))
-        load=$(concat $":", $(support-load-paths $(config)))
-        run=$(nth 0, $(progs))
-        
-        test: $(progs)
-            section
-                setenv(CAML_LD_LIBRARY_PATH, $(load))
-                foreach(p, $(progs))
-                    $p -verbose
-        
-        return $(progs)
-
-### OCaml findlib package composition
-OCaml_findlib_subpackage.=
-    class OCaml_findlib_subpackage
-    
-    ### Raise an exception
-    protected.throw(m)=
-        x.=
-            message=$"Ocaml_findlib_subpackage [$m]"
-        raise $x
-    
-    ### Constructor helper
-    protected.subpackage(i)=
-        if $(not $(i.object-mem NAME))
-            throw($"undefined package name")
-        if $(not $(i.object-mem DESCRIPTION))
-            throw($"no description for package $(i.NAME)")
-        o.=
-            NAME=$(i.NAME)
-            DESCRIPTION=$(i.DESCRIPTION)
-            REQUIRES[]=
-            ARCHIVES[]=
-            SUBPKGS[]=
-        export o
-        if $(this.object-mem NAME)
-            o.NAME=$(this.NAME)/$(o.NAME)
-        if $(i.object-mem REQUIRES)
-            o.REQUIRES=$(i.REQUIRES)
-        if $(i.object-mem ARCHIVES)
-            o.ARCHIVES=$(i.ARCHIVES)
-        return $o
-    
-    ### Construction invariant
-    protected.new(src)=
-        private.src=$(subpackage $(src))
-        this.NAME=$(src.NAME)
-        this.DESCRIPTION=$(src.DESCRIPTION)
-        this.REQUIRES=$(src.REQUIRES)
-        this.ARCHIVES=$(src.ARCHIVES)
-        this.SUBPKGS=$(src.SUBPKGS)
-        return $(this)
-    
-    ### Add a subpackage
-    add-subpackage(src)=
-        this.SUBPKGS+=$(this.subpackage $(src))
-        return $(this)
-
-### OCaml findlib package composition
-OCaml_findlib_package.=
-    class OCaml_findlib_package
-    extends $(OCaml_findlib_subpackage)
-    
-    ### Generate the META file text
-    protected.generate-meta()=
-        fp=$(open-out-string)
-        fprint($(fp), $""# META file generated for $(this.NAME) package
-
-name="$(this.NAME)"
-version="$(this.VERSION)"
-description="$(this.DESCRIPTION)"
-"")
-        if $(this.REQUIRES)
-            fprintln($(fp), $""requires="$(this.REQUIRES)" "")
-        foreach(p, $(this.SUBPKGS))
-            fprintln($(fp), $(EMPTY))
-            fprintln($(fp), $""package "$(basename $(p.NAME))" ("")
-            if $(p.REQUIRES)
-                fprintln($(fp), $""  requires="$(p.REQUIRES)" "")
-            foreach(v, $(p.ARCHIVES))
-                private.byte=$(v.find byte)
-                private.native=$(v.find native)
-                fprintln($(fp), $"  archive(byte)=" "$(byte)")
-                fprintln($(fp), $"  archive(native)=" "$(native)")
-            fprintln($(fp), $")")
-        private.text=$(out-contents $(fp))
-        close($(fp))
-        return $(text)
-    
-    ### The META file target
-    protected.meta-target()=
-        private.meta=$(file $(this.STAGE.DIR)/META)
-        private.text=$(generate-meta)
-            
-        $(meta): $(this.STAGE.DIR) $(this.FILES)
-            fprint($@, $(text))
-        return $(meta)
-    
-    ### Constructor
-    new(src)=
-        this=$(OCaml_findlib_subpackage::new $(src))
-        if $(not $(src.object-mem VERSION))
-            throw($"no version for package $(this.NAME)")
-        private.stage=$(Stage)
-        stage.DIR=$(AUXROOT)
-        this.STAGE=$(stage.push $(this.NAME).package)
-        this.VERSION=$(src.VERSION)
-        this.FILES[]=
-        this.DOCSEARCH[]=
-        return $(this)
-    
-    ### Install target
-    install-target()=
-        private.target=$(addprefix install-, $(this.NAME))
-        private.meta=$(meta-target)
-        .PHONY: $(target)
-        $(target): $(meta) $(this.FILES)
-            -ocamlfind install $(this.NAME) $^
-        return $(target)
-    
-    ### Remove target
-    remove-target()=
-        private.target=$(addprefix remove-, $(this.NAME))
-        .PHONY: $(target)
-        $(target):
-            -ocamlfind remove $(this.NAME)
-        return $(target)
-    
-    ### Documents target
-    documents-target()=
-        private.target=$(addprefix documents-, $(this.NAME))
-        private.dstage=$(this.STAGE.push docs)
-        OCAMLDOC.DEPEND+=$(dstage.DIR) $(this.FILES)
-        OCAMLDOC.SEARCH+=$(this.DOCSEARCH)
-        return $(OCAMLDOC.html-documents $(this.FILES), $(dstage.DIR))
-
-# End $File$

setup.sh

-#!/bin/sh
-
-###############################################################################
-# $Change$
-# Copyright (C) 2010, james woodyatt
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#   
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-this=${0##*/}
-
-usage() {
-    if [ -n "$*" ]; then
-        echo ''
-        echo "${this}: $*"
-    fi
-    cat 1>&2 <<_usage_
-
-Usage:
-    ${this} -h
-    ${this} -[m] [-S ...] [-T ...] [-O ...] [-F ...] [-A ...] products...
-
-  Options:
-    -h          Print this message.
-    -m          Edit search paths to include the tools directories.
-    -d          Do not build release configuration
-    -c config   Add <config> to the alternative configurations to build
-    -S stage    Specify explicit stage directory (default is \$PWD/stage).
-    -T tools    Specify tools directory (default is \$stage/tools, implies -m).
-    -O objects  Specify objects directory (default is \$stage/obj).
-    -F final    Specify final directory (default is \$stage/fin).
-    -A aux      Specify auxillary directory (default is \$stage/aux).
-    
-    Note: -d requires at least one -c <config> argument.
-_usage_
-
-    exit 1
-}
-
-top=$(cd $(dirname $0) && pwd)
-
-uname=$(uname)
-if [ $uname = Darwin ]; then
-    njobs=$(($(/usr/sbin/sysctl -n hw.ncpu) * 3 / 2))
-    if [ $njobs -lt 2 ]; then njobs=2; fi
-else
-    njobs=2
-fi
-
-# INCOMPLETE! We should remove the results of previous edits before inserting
-# new values.
-
-OMAKEFLAGS=${OMAKEFLAGS:+"${OMAKEFLAGS} "}
-OMAKEFLAGS+="-j$njobs --force-dotomake --dotomake ${top}/.omake"
-
-edit_paths=false
-release_config="release"
-opts='A:F:O:S:T:c:dhm'
-while getopts ${opts} opt; do
-    case ${opt} in
-      A)
-        eval ':'
-        AUXROOT=${OPTARG}
-        ;;
-      F)
-        eval ':'
-        FINROOT=${OPTARG}
-        ;;
-      O)
-        eval ':'
-        OBJROOT=${OPTARG}
-        ;;
-      S)
-        eval ':'
-        stage=${OPTARG}
-        ;;
-      T)
-        eval ':'
-        tools=${OPTARG}
-        edit_paths=true
-        ;;
-      c)
-        eval ':'
-        [ -n "${configs}" ] && configs+=' '
-        configs+="${OPTARG}"
-        ;;
-      d)
-        release_config=
-        ;;
-      m)
-        edit_paths=true
-        ;;
-      '?'|h)
-        usage
-        ;;
-    esac
-done
-
-shift $((${OPTIND} -1))
-
-stage=${stage:="$PWD/stage"}
-OMAKEFLAGS+=" OBJROOT=\\\"${OBJROOT:="$stage/obj"}\\\""
-OMAKEFLAGS+=" FINROOT=\\\"${FINROOT:="$stage/fin"}\\\""
-OMAKEFLAGS+=" AUXROOT=\\\"${AUXROOT:="$stage/aux"}\\\""
-
-if [ -n "${release_config}" ]; then
-    [ -n "${configs}" ] && release_config+=' '
-    configs=${release_config}${configs}
-fi
-
-[ "${configs}" = '' ] && usage
-
-OMAKEFLAGS+=" CONFIGURATIONS=\\\"${configs}\\\""
-
-if [ $# -gt 0 ]; then
-    products=$*
-    for p in ${products}; do
-        pfile=${top}/products/${p}.om
-        if [ ! -r ${pfile} ]; then
-            cat 1>&2 <<_no_product_
-$0: Error: unable to read ${pfile}
-_no_product_
-
-                exit 1
-        fi
-    done
-    
-    OMAKEFLAGS+=" PRODUCTS=\\\"$products\\\""
-fi
-
-if ${edit_paths}; then
-    toolsdir=${tools:="$stage/tools"}
-    OMAKEFLAGS+=" TOOLSDIR=\\\"$toolsdir\\\""
-    if [ $uname = Darwin ]; then
-        echo "DYLD_LIBRARY_PATH=\"$toolsdir/lib\":$DYLD_LIBRARY_PATH"
-    else
-        echo "LD_LIBRARY_PATH=\"$toolsdir/lib\":$LD_LIBRARY_PATH"
-    fi
-    echo "MANPATH=\"$toolsdir/man\":$MANPATH"
-    echo "PATH=\"$toolsdir/bin\":$PATH"
-fi
-
-echo "OMAKEFLAGS=\"${OMAKEFLAGS}\"; export OMAKEFLAGS"
-exit 0
-
-# End $File$
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.