Boost logo

Boost Users :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-11-27 18:19:26


Boris Gubenko wrote:
> I just tried to build jam using build.jam you've attached to your mail
> message, and it failed -- see below. The things I noticed: [.foo.c]
> should have been []foo.c or just foo.c : on VMS, []foo.c is an
> equivalent of ./foo.c on Unix. Also, the C (and C++) compiler on VMS
> generates the .obj file vs. .o file on Unix. From the output below,
> it seems to me, that build.jam expects .o.

Yea, that's what I was trying to accomplish. But missed some conditions.

> In this quick experiment, I was using jam sources from 1.31.0
> distribution (which was the released version of boost in April, 2004).
> I can try it with the CVS HEAD if you think, that it can make a
> difference (I doubt it).

The 3.1.11 bjam sources might be better. But the errors where obvious
enough.

> don't know how to make [.command.c]

Oops, missed some changes. Attached is another try.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

#~ Copyright 2002-2005 Rene Rivera.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# Platform related specifics.
if $(NT) || $(OS2) {
    rule .path {
        if $(>) && $(<) { return "$(<:J=\\)\\$(>:J=)" ; }
        else if $(>) { return "$(>:J=)" ; }
        else { return "$(<:J=\\)" ; } } }
else if $(VMS) {
    rule .path {
        if $(>) && $(<) { return "[.$(<:J=/)]$(>:J=)" ; }
        else if $(>) { return "$(>:J=)" ; }
        else { return "[.$(<:J=/)]" ; } } }
else if $(MAC) {
    rule .path {
        if $(>) && $(<) { return ":$(<:J=\:)\:$(>:J=)" ; }
        else if $(>) { return "$(>:J=)" ; }
        else { return ":$(<:J=\:)" ; } } }
else {
    rule .path {
        if $(>) && $(<) { return "$(<:J=/)/$(>:J=)" ; }
        else if $(>) { return "$(>:J=)" ; }
        else { return "$(<:J=/)" ; } } }
if $(VMS) { . = "_" ; }
else { . = "." ; }
if $(VMS) { ~ = "" ; }
else { ~ = "\"" ; }

# Info about what we are building.
NAME = boost-jam ;
VERSION = 3$(.)1$(.)11 ;
RELEASE = 1 ;
LICENSE = 1_0 ;

HAVE_PYTHON = 0 ;
PYTHON_INCUDES = /usr/include/python2.3 ;
PYTHON_LIB = -lpython2.3 ;

# Generate development debug binaries?
if --debug in $(ARGV)
{
    debug = true ;
}

# Attempt to generate and/or build the grammar?
if --grammar in $(ARGV)
{
    grammar = true ;
}

# Do we need to add a default build type argument?
if ! ( --release in $(ARGV) ) &&
   ! ( --debug in $(ARGV) )
{
    ARGV += --release ;
}

# An explicit root for the toolset? (trim spaces)
toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ;
{
    local t = [ MATCH "[ ]*(.*)" : $(toolset-root:J=" ") ] ;
    toolset-root = ;
    while $(t)
    {
        t = [ MATCH "([^ ]+)([ ]*)(.*)" : $(t) ] ;
        toolset-root += $(t[1]) ;
        if $(t[3]) { toolset-root += $(t[2]) ; }
        t = $(t[3]) ;
    }
    toolset-root = $(toolset-root:J="") ;
}

# Configure the implemented toolsets. These are minimal
# commands and options to compile the full Jam. When
# adding new toolsets make sure to add them to the
# "known" list also.
rule toolset ( name command .type ? : opt.out + : opt.define * : flags * : linklibs * )
{
    .type ?= "" ;
    tool.$(name)$(.type).cc ?= $(command) ;
    tool.$(name)$(.type).opt.out ?= $(opt.out) ;
    tool.$(name)$(.type).opt.define ?= $(opt.define) ;
    tool.$(name)$(.type).flags ?= $(flags) ;
    tool.$(name)$(.type).linklibs ?= $(linklibs) ;
    if ! $(name) in $(toolsets) { toolsets += $(name) ; }
}
rule opt ( type : yes-opt * : no-opt * ) { if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } }
## HP-UX aCC compiler
toolset acc cc : "-o " : -D
    : -Ae
    [ opt --release : -s -O3 ]
    [ opt --debug : -g -pg ] ;
## Borland C++ 5.5.x
toolset borland bcc32 : -e -n : /D
    : -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib"
    [ opt --release : -O2 -vi -w-inl ]
    [ opt --debug : -v -Od -vi- ] ;
## Generic Unix cc
if ! $(CC) { CC = cc ; }
toolset cc $(CC) : "-o " : -D
    : $(CFLAGS)
    [ opt --release : -s -O ]
    [ opt --debug : -g ]
    : $(LIBS) ;
## Comeau C/C++ 4.x
toolset como como : "-o " : -D
    : --c
    [ opt --release : --inlining ]
    [ opt --debug : --no_inlining ] ;
## MacOSX Darwin, using GCC 2.9.x, 3.x
toolset darwin cc : "-o " : -D
    :
    [ opt --release : -Wl,-x -O3 -finline-functions ]
    [ opt --debug : -g -O0 -fno-inline -pg ] ;
## GCC 2.x, 3.x
toolset gcc gcc : "-o " : -D
    : -pedantic
    [ opt --release : [ opt --symbols : -g : -s ] -O3 -finline-functions ]
    [ opt --debug : -g -O0 -fno-inline ] ;
## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll
toolset gcc-nocygwin gcc : "-o " : -D
    : -s -O3 -mno-cygwin
    [ opt --release : -finline-functions ]
    [ opt --debug : -s -O3 -fno-inline -pg ] ;
## Intel C/C++ for Linux
toolset intel-linux icc : "-o " : -D
    :
    [ opt --release : -Xlinker -s -O3 ]
    [ opt --debug : -g -O0 -p ] ;
## Intel C/C++ for Win32
toolset intel-win32 icl : /Fe : -D
    : /nologo
    [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
    [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] ;
## KCC ?
toolset kcc KCC : "-o " : -D
    :
    [ opt --release : -s +K2 ]
    [ opt --debug : -g +K0 ] ;
## Borland Kylix
toolset kylix bc++ : -o : -D
    : -tC -q
    [ opt --release : -O2 -vi -w-inl ]
    [ opt --debug : -v -Od -vi- ] ;
## Metrowerks CodeWarrior 8.x
{
    # Even though CW can compile all files at once, it crashes if it tries in the bjam case.
    local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; }
    mwcc ?= mwcc ;
    toolset metrowerks $(mwcc) : "-o " : -D
        : -c -lang c -subsystem console -cwd include
        [ opt --release : -runtime ss -opt full -inline all ]
        [ opt --debug : -runtime ssd -opt none -inline off ] ;
    toolset metrowerks $(mwcc) .link : "-o " :
        : -subsystem console -ladvapi32.lib
        [ opt --release : -runtime ss ]
        [ opt --debug : -runtime ssd ] ;
}
## MINGW GCC
toolset mingw gcc : "-o " : -D
    :
    [ opt --release : -s -O3 -finline-functions ]
    [ opt --debug : -g -O0 -fno-inline -pg ] ;
## MIPS Pro
toolset mipspro cc : "-o " : -D
    :
    [ opt --release : -s -O3 -g0 -INLINE:none ]
    [ opt --debug : -g -O0 -INLINE ] ;
## Microsoft Visual Studio C++ 6.x
toolset msvc cl : /Fe : -D
    : /nologo
    [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
    [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
    : kernel32.lib advapi32.lib ;
## QNX 6.x GCC 3.x/2.95.3
toolset qcc qcc : "-o " : -D
    : -pedantic
    [ opt --release : [ opt --symbols : -g : -s ] -O3 -finline-functions ]
    [ opt --debug : -g -O0 -fno-inline ] ;
## Sun Workshop 6 C++
toolset sunpro cc : "-o " : -D
    :
    [ opt --release : -s -fast -xO4 ]
    [ opt --debug : -g ] ;
## Compaq Alpha CXX
toolset tru64cxx cc : "-o " : -D
    :
    [ opt --release : -s -O5 -inline speed ]
    [ opt --debug : -g -O0 -pg ] ;
## IBM VisualAge C++
toolset vacpp xlc : "-o " : -D
    :
    [ opt --release : -s -O3 -qstrict -qinline ]
    [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] ;
## Microsoft Visual C++ .NET 7.x
toolset vc7 cl : /Fe : -D
    : /nologo
    [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
    [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
    : kernel32.lib advapi32.lib ;
## VMS/OpenVMS DEC C
toolset vmsdecc cc : /OBJECT= : "/DEFINES=(" "," ")"
    : /STANDARD=VAXC /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES
    [ opt --release : /OPTIMIZE /NODEBUG ]
    [ opt --debug : /NOOPTIMIZE /DEBUG ]
    ;
toolset vmsdecc link .link : /EXECUTABLE= :
    : /NOMAP
    [ opt --release : /NODEBUG ]
    [ opt --debug : /DEBUG ]
    ;

# First set the build commands and options according to the
# preset toolset.
toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
if ! $(toolset)
{
    # For some reason, the following test does not catch
    # empty toolset.
    ECHO "###" ;
    ECHO "###" No toolset specified. Please use --toolset option. ;
    ECHO "###" ;
    ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
    EXIT "###" ;
}
if ! $(toolset) in $(toolsets)
{
    ECHO "###" ;
    ECHO "###" Unknown toolset: $(toolset) ;
    ECHO "###" ;
    ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
    EXIT "###" ;
}
--cc = $(tool.$(toolset).cc) ;
if $(tool.$(toolset).opt.out[2])
{
    --bin = $(tool.$(toolset).opt.out[1]) ;
    --dir = $(tool.$(toolset).opt.out[2]) ;
}
else
{
    --out = $(tool.$(toolset).opt.out) ;
}
--def = $(tool.$(toolset).opt.define) ;
--flags = $(tool.$(toolset).flags) ;
--defs = $(tool.$(toolset).defines) ;
--libs = $(tool.$(toolset).linklibs) ;
if $(tool.$(toolset).link.cc)
{
    --link = $(tool.$(toolset).link.cc) ;
    if $(tool.$(toolset).link.opt.out[2])
    {
        --link-bin = $(tool.$(toolset).link.opt.out[1]) ;
        --link-dir = $(tool.$(toolset).link.opt.out[2]) ;
    }
    else
    {
        --link-out = $(tool.$(toolset).link.opt.out) ;
    }
    --link-def = $(tool.$(toolset).link.opt.define) ;
    --link-flags = $(tool.$(toolset).link.flags) ;
    --link-defs = $(tool.$(toolset).link.defines) ;
    --link-libs = $(tool.$(toolset).link.linklibs) ;
}

# Put executables in platform-specific subdirectory.
locate-target = $(LOCATE_TARGET) ;
if $(VMS)
{
    locate-target ?= bin$(.)vms ;
    platform = vms ;
}
else if $(MAC)
{
    locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
    platform = $(OS:L)$(OSPLAT:L) ;
}
else if $(OSPLAT)
{
    locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
    platform = $(OS:L)$(OSPLAT:L) ;
}
else
{
    locate-target ?= bin$(.)$(OS:L) ;
    platform = $(OS:L) ;
}
if $(debug)
{
    locate-target = [ .path $(locate-target)$(.)debug ] ;
}
else
{
    locate-target = [ .path $(locate-target) ] ;
}

if --show-locate-target in $(ARGV)
{
  ECHO $(locate-target) ;
}

# We have some different files for UNIX, VMS, and NT.
jam.source =
    command.c compile.c expand.c glob.c
    hash.c hcache.c headers.c hdrmacro.c
    jam.c jambase.c jamgram.c
    lists.c make.c make1.c newstr.c
    option.c parse.c regexp.c rules.c
    scan.c search.c subst.c
    timestamp.c variable.c modules.c strings.c filesys.c
    builtins.c pwd.c class.c native.c modules/set.c
    modules/path.c modules/regex.c modules/property-set.c
    modules/sequence.c modules/order.c
    ;
if $(NT)
{
    jam.source += execnt.c filent.c pathunix.c w32_getreg.c ;
}
else if $(OS2)
{
    jam.source += execunix.c fileos2.c pathunix.c ;
}
else if $(VMS)
{
    jam.source += execvms.c filevms.c pathvms.c ;
}
else if $(MAC)
{
    jam.source += execmac.c filemac.c pathmac.c ;
}
else
{
    jam.source += execunix.c fileunix.c pathunix.c ;
}

# Debug assertions, or not.
if ! $(debug) || --noassert in $(ARGV)
{
    --defs += NDEBUG ;
}

# Enable some optional features.
--defs += OPT_HEADER_CACHE_EXT ;
--defs += OPT_GRAPH_DEBUG_EXT ;
--defs += OPT_SEMAPHORE ;

# Bug fixes
--defs += OPT_FIX_TARGET_VARIABLES_EXT ;
#~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ;

# Improvements
--defs += OPT_IMPROVED_PATIENCE_EXT ;

if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs)
{
    --defs += NT ;
}
if $(VMS)
{
    --defs += VMS ;
}
--defs += YYSTACKSIZE=5000 ;

if $(HAVE_PYTHON) = 1
{
    --defs += HAVE_PYTHON ;
    --flags += -I$(PYTHON_INCUDES) ;
    --flags += -Wno-long-long ;
    --libs += $(PYTHON_LIB) ;
}

# The basic symbolic targets...
NOTFILE all clean dist ;
ALWAYS clean ;

# Utility rules and actions...
rule .clean
{
    [DELETE] clean : $(<) ;
}
if $(NT) { actions piecemeal together existing [DELETE] {
    del /F /Q $(>)
} }
if $(UNIX) { actions piecemeal together existing [DELETE] {
    rm -f $(>)
} }
if $(VMS) { actions piecemeal together existing [DELETE] {
    DELETE $(>[--2]:J=";*, ") $(>[-1]);*
} }
if $(NT) {
    --chmod+w = "attrib -r " ;
}
if $(UNIX) {
    --chmod+w = "chmod +w " ;
}
if $(VMS) {
    --chmod+w = "SET FILE/PROT=(S:RWED) " ;
}

rule .mkdir
{
    NOUPDATE $(<) ;
    if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
    if ! $(md<$(<)>) { [MKDIR] $(<) ; md<$(<)> = - ; }
}
if $(NT) { actions [MKDIR] {
    md $(<)
} }
if $(UNIX) { actions [MKDIR] {
    mkdir $(<)
} }
if $(VMS) { actions [MKDIR] {
    CREATE/DIR $(<J=", ")
} }

rule .exe
{
    local exe = $(<) ;
    if $(NT) || ( $(UNIX) && $(OS) = CYGWIN ) || $(VMS) { exe = $(exe:S=.exe) ; }
    LOCATE on $(exe) = $(locate-target) ;
    DEPENDS all : $(exe) ;
    .mkdir $(locate-target) ;
    if $(--link)
    {
        local objs = ;
        for local s in $(>)
        {
            # Translate any subdir elements into a simple file name.
            local parts = [ MATCH "([^/]+)[/]?(.*)" : $(s) ] ;
            if ! $(parts[-1]) { parts = $(parts[1--2]) ; }
            local obj = $(parts:J=_) ;
            obj = $(obj:S=.o) ;
            objs += $(obj) ;
            local src = [ .path $(parts[1--2]) : $(parts[-1]) ] ;
            LOCATE on $(obj) = $(locate-target) ;
            DEPENDS $(exe) : $(obj) ;
            DEPENDS $(obj) : $(src) ;
            DEPENDS $(obj) : $(locate-target) ;
            [COMPILE] $(obj) : $(src) ;
            .clean $(obj) ;
        }
        DEPENDS $(exe) : $(objs) ;
        DEPENDS $(exe) : $(locate-target) ;
        [COMPILE.LINK] $(exe) : $(objs) ;
        .clean $(exe) ;
    }
    else
    {
        DEPENDS $(exe) : $(>) ;
        DEPENDS $(exe) : $(locate-target) ;
        [COMPILE] $(exe) : $(>) ;
        .clean $(exe) ;
    }
    return $(exe) ;
}
if ! $(--def[2]) { actions [COMPILE] {
    $(~)$(--cc)$(~) $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) "$(--libs)" $(>)
} }
else { actions [COMPILE] {
    $(~)$(--cc)$(~) $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) "$(--libs)" $(>)
} }
if $(VMS) { actions [COMPILE.LINK] {
    $(~)$(--link)$(~) $(--link-bin)$(<:D=) $(--link-dir)$(<:D) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>J=", ")
} }
else { actions [COMPILE.LINK] {
    $(~)$(--link)$(~) $(--link-bin)$(<:D=) $(--link-dir)$(<:D) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>)
} }

rule .link
{
    DEPENDS all : $(<) ;
    DEPENDS $(<) : $(>) ;
    [LINK] $(<) : $(>) ;
    .clean $(<) ;
}
if $(NT) { actions [LINK] {
    copy $(>) $(<)
} }
if $(UNIX) { actions [LINK] {
    ln -fs $(>) $(<)
} }
if $(VMS) { actions [LINK] {
    COPY/REPLACE $(>) $(<)
} }

rule .move
{
    DEPENDS $(<) : $(>) ;
    [MOVE] $(<) : $(>) ;
}
if $(NT) { actions [MOVE] {
    del /f $(<)
    rename $(>) $(<)
} }
if $(UNIX) { actions [MOVE] {
    mv -f $(>) $(<)
} }
if $(VMS) { actions [MOVE] {
    RENAME $(>) $(<)
} }

# Generate the grammar tokens table, and the real yacc grammar.
rule .yyacc
{
    local exe = [ .exe yyacc : yyacc.c ] ;
    NOUPDATE $(exe) ;
    DEPENDS $(<) : $(exe) $(>) ;
    LEAVES $(<) ;
    yyacc.exe on $(<) = $(exe:R=$(locate-target)) ;
    [YYACC] $(<) : $(>) ;
}
actions [YYACC] {
    $(--chmod+w)$(<[1])
    $(--chmod+w)$(<[2])
    "$(yyacc.exe)" $(<) $(>)
}
if $(grammar)
{
    .yyacc jamgram.y jamgramtab.h : jamgram.yy ;
}
else if $(debug)
{
    .exe yyacc : yyacc.c ;
}

# How to build the grammar.
if $(NT)
{
    SUFEXE = .exe ;
    # try some other likely spellings...
    PATH ?= $(Path) ;
    PATH ?= $(path) ;
}
SUFEXE ?= "" ;

yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;
yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;
yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin" "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;
yacc = $(yacc[1]) ;
switch $(yacc:D=:S=)
{
    case bison : yacc += -d --yacc ;
    case yacc : yacc += -d ;
}
if $(debug) && $(yacc)
{
    yacc += -t -v ;
}
yacc += $(YACCFLAGS) ;

rule .yacc
{
    DEPENDS $(<) : $(>) ;
    LEAVES $(<) ;
    [YACC] $(<) : $(>) ;
}
if $(NT) { actions [YACC] {
    "$(yacc)" $(>)
    if not errorlevel 1 (
        del /f $(<[1])
        rename y.tab$(<[1]:S) $(<[1])
        del /f $(<[2])
        rename y.tab$(<[2]:S) $(<[2])
    ) else set _error_ =
} }
if $(UNIX) { actions [YACC] {
    if ` "$(yacc)" $(>) ` ; then
        mv -f y.tab$(<[1]:S) $(<[1])
        mv -f y.tab$(<[2]:S) $(<[2])
    else
        exit 1
    fi
} }
if $(VMS) { actions [YACC] {
    IF "$(yacc)" $(>)
    THEN
        RENAME y_tab$(<[1]:S) $(<[1])
        RENAME y_tab$(<[2]:S) $(<[2])
    ENDIF
} }
if $(grammar) && ! $(yacc)
{
    EXIT "Could not find the 'yacc' tool, and therefore can not build the grammar." ;
}
if $(grammar) && $(yacc)
{
    .yacc jamgram.c jamgram.h : jamgram.y ;
}

# How to build the compiled in jambase.
rule .mkjambase
{
    local exe = [ .exe mkjambase : mkjambase.c ] ;
    DEPENDS $(<) : $(exe) $(>) ;
    LEAVES $(<) ;
    mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
    [MKJAMBASE] $(<) : $(>) ;
}
actions [MKJAMBASE] {
    $(--chmod+w)$(<)
    $(mkjambase.exe) $(<) $(>)
}
if $(debug)
{
    .mkjambase jambase.c : Jambase ;
}

# How to build Jam.
rule .jam
{
    $(>).exe = [ .exe $(>) : $(jam.source) ] ;
    DEPENDS all : $($(>).exe) ;
    
    if $(debug)
    {
        $(<).exe = $(<:S=$($(>).exe:S)) ;
        LOCATE on $($(<).exe) = $(locate-target) ;
        .link $($(<).exe) : $($(>).exe) ;
        DEPENDS all : $($(<).exe) ;
    }
}
.jam jam : bjam ;

# Scan sources for header dependencies.
# WARNING: Yes those are *REAL TABS* below. DO NOT CHANGE,
# under any circumstances, to spaces!! And the tabs
# indenting this are so that if someone is in the mood to
# replace tabs they hit this comment, and hopefully notice
# their error.
rule .scan
{
    HDRRULE on $(<:D=) = .hdr.scan ;
    HDRSCAN on $(<:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ;
}
rule .hdr.scan
{
    local hdrs = [ GLOB . : $(>:D=) ] ;
    INCLUDES $(<:D=) : $(hdrs:D=) ;
    HDRRULE on $(>:D=) = .hdr.scan ;
    HDRSCAN on $(>:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ;
}
.scan [ GLOB . : *.c ] ;

# Distribution making from here on out.
dist.license =
    #~ [ GLOB . : LICENSE_$(LICENSE).txt ] [ GLOB [ .path .. .. .. ] : LICENSE_$(LICENSE).txt ] ;
    [ GLOB . : LICENSE_$(LICENSE).txt ]
    [ GLOB [ .path .. .. .. ] : LICENSE_$(LICENSE).txt ]
    [ GLOB [ .path .. boost ] : LICENSE_$(LICENSE).txt ] ;
dist.docs =
    $(dist.license[1])
    index.html
    Porting
    Jam.html
    ;
dist.source =
    [ GLOB . : *.c *.h ]
    ;
dist.source = $(dist.source:D=)
    $(dist.docs)
    build.jam build.bat build.sh build_vms.com
    Jambase
    jamgram.y jamgram.yy
    [ .path debian : changelog ]
    [ .path debian : control ]
    [ .path debian : copyright ]
    [ .path debian : jam.man.sgml ]
    [ .path debian : rules ]
    [ .path modules : set.c ]
    [ .path modules : path.c ]
    [ .path modules : regex.c ]
    [ .path modules : property-set.c ]
    [ .path modules : sequence.c ]
    [ .path modules : order.c ]
    boost-jam.spec
    ;
dist.bin =
    bjam
    ;
dist.bin =
    $(dist.license[1])
    $(dist.bin:S=$(bjam.exe:S))
    ;

if $(NT)
{
    zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" "7zn.exe" ] ;
    zip ?= [ GLOB $(PATH) : zip.exe ] ;
    zip ?= zip ;
    zip = $(zip[1]) ;
    switch $(zip:D=:S=)
    {
        case 7z* : zip += a -r -tzip -mx=9 ;
        case zip : zip += -9r ;
    }
    actions piecemeal [PACK] {
    "$(zip)" "$(<)" "$(>)"
    }
    actions piecemeal [ZIP] {
    "$(zip)" "$(<)" "$(>)"
    }
    actions piecemeal [COPY] {
    copy /Y "$(>)" "$(<)" >NUL:
    }
}
if $(UNIX)
{
    actions [PACK] {
    tar zcf "$(<)" "$(>)"
    }
    actions [ZIP] {
    gzip -c9 "$(>)" > "$(<)"
    }
    actions [COPY] {
    cp -Rpf "$(>)" "$(<)"
    }
}

# The single binary, compressed.
rule .binary
{
    local zip = ;
    if $(NT) { zip = $($(<).exe:S=.zip) ; }
    if $(UNIX) { zip = $($(<).exe:S=.tgz) ; }
    zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ;
    DEPENDS $(zip) : $($(<).exe) ;
    DEPENDS dist : $(zip) ;
    #~ LOCATE on $(zip) = $(locate-target) ;
    if $(NT) { [ZIP] $(zip) : $($(<).exe) ; }
    if $(UNIX) { [PACK] $(zip) : $($(<).exe) ; }
    .clean $(zip) ;
}

# Package some file.
rule .package ( dst-dir : src-files + )
{
    local dst-files ;
    for local src-path in $(src-files)
    {
        local src-subdir = $(src-path:D) ;
        local src-file = $(src-path) ;
        while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; }
        if $(src-subdir) = ".."
        {
            src-file = $(src-file:D=) ;
        }
        dst-files += $(src-file:R=$(dst-dir)) ;
    }
    
    local pack = ;
    if $(NT) { pack = $(dst-dir).zip ; }
    if $(UNIX) { pack = $(dst-dir).tgz ; }
    
    DEPENDS dist : $(pack) ;
    DEPENDS $(pack) : $(dst-files) ;
    
    local dst-files-queue = $(dst-files) ;
    for local src-path in $(src-files)
    {
        local dst-file = $(dst-files-queue[1]) ;
        dst-files-queue = $(dst-files-queue[2-]) ;
        DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ;
        .mkdir $(dst-file:D) ;
        
        [COPY] $(dst-file) : $(src-path) ;
        .clean $(dst-file) ;
    }
    
    [PACK] $(pack) : $(dst-files) ;
    .clean $(pack) ;
}

# RPM distro file.
rpm-tool = [ GLOB $(PATH) : "rpmbuild" "rpm" ] ;
rule .rpm ( name : source )
{
    local rpm-arch = ;
    switch $(OSPLAT)
    {
        case X86 : rpm-arch ?= i386 ;
        case PPC : rpm-arch ?= ppc ;
        case AXP : rpm-arch ?= alpha ;
        # no guaranty for these:
        case IA64 : rpm-arch ?= ia64 ;
        case ARM : rpm-arch ?= arm ;
        case SPARC : rpm-arch ?= sparc ;
        case * : rpm-arch ?= other ;
    }
    local target = $(name)-rpm ;
    NOTFILE $(target) ;
    DEPENDS dist : $(target) ;
    DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ;
    DEPENDS $(name).$(rpm-arch).rpm : $(source) ;
    DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ;
    docs on $(target) = $(dist.docs:J=" ") ;
    arch on $(target) = $(rpm-arch) ;
    if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; }
    else { target-opt on $(target) = "--target " ; }
    [RPM] $(target) : $(source) ;
    .clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
}
actions [RPM] {
    export BOOST_JAM_TOOLSET="$(toolset)"
    $(rpm-tool[1]) -ta $(target-opt)$(arch) $(>) | tee rpm.out
    cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` .
    rm -f rpm.out
}

# The distribution targets. Don't bother with the targets if
# distribution build not requested.
if dist in $(ARGV)
{
    #~ .binary bjam ;
    .package $(NAME)-$(VERSION) : $(dist.source) ;
    .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
    if $(rpm-tool)
    {
        .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;
    }
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net