2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00
Files
build/jam_src/build.jam
Rene Rivera 43f51fdffa More cleanup...
* build.bat; accept all toolsets.
*build.bat; set toolset root when known.
* build.jam; accept --toolset-root=* for setting where the toolset lives.
* build.jam; don't clean grammar intermediates.


[SVN r16220]
2002-11-13 07:05:52 +00:00

471 lines
12 KiB
Plaintext

# Copyrigt (C) 2002 Rene Rivera.
# Permission to copy, use, modify, sell and distribute this software
# is granted provided this copyright notice appears in all copies.
# This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Info about what we are building.
NAME = boost-jam ;
VERSION = 3.1.3 ;
RELEASE = 1 ;
# Generate development debug binaries?
if --debug in $(ARGV)
{
debug = true ;
}
# 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 : opt.out + : opt.define + : release-flags * : debug-flags * : linklibs * )
{
tool.$(name).cc ?= $(command) ;
tool.$(name).opt.out ?= $(opt.out) ;
tool.$(name).opt.define ?= $(opt.define) ;
if $(debug)
{
tool.$(name).flags ?= $(debug-flags) ;
}
else
{
tool.$(name).flags ?= $(release-flags) ;
}
tool.$(name).linklibs ?= $(linklibs) ;
toolsets += $(name) ;
}
## Borland C++ 5.5.x
toolset borland bcc32 : -e -n : /D
: -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib" -O2 -vi -w-inl
: -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib" -v -Od -vi- ;
## Comeau C/C++ 4.x
toolset como como : "-o " : -D
: --inlining
: --no_inlining ;
## MacOSX Darwin, using GCC 2.9.x, 3.x
toolset darwin cc : "-o " : -D
: -Wl,-x -O3 -finline-functions
: -g -O0 -fno-inline -pg ;
## GCC 2.x, 3.x
toolset gcc gcc : "-o " : -D
: -s -O3 -finline-functions
: -g -O0 -fno-inline -pg ;
## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll
toolset gcc-nocygwin gcc : "-o " : -D
: -s -O3 -finline-functions -mno-cygwin
: -s -O3 -fno-inline -pg -mno-cygwin ;
## Intel C/C++ for Linux
toolset intel-linux icc : "-o " : -D
: -Xlinker -s -O3
: -g -O0 -p ;
## Intel C/C++ for Win32
toolset intel-win32 icl : /Fe : -D
: /nologo /ML /O2 /Ob2 /Gy /GF /GA /GB
: /nologo /MLd /DEBUG /Z7 /Od /Ob0 ;
## KCC ?
toolset kcc KCC : "-o " : -D
: -s +K2
: -g +K0 ;
## Borland Kylix
toolset kylix bc++ : -o : -D
: -tC -q -O2 -vi -w-inl
: -tC -q -v -Od -vi- ;
## Metrowerks CodeWarrior 8.x
{
local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; }
toolset metrowerks $(mwcc) : "-o " : -D
: -subsystem console -runtime staticsingle -opt full -inline auto -inline level=8
: -subsystem console -runtime staticsingle -O0 -inline off ;
}
## MINGW GCC
toolset mingw gcc : "-o " : -D
: -s -O3 -finline-functions -DMINGW
: -g -O0 -fno-inline -pg -DMINGW ;
## MIPS Pro
toolset mipspro cc : "-o " : -D
: -s -O3 -g0 -INLINE:none
: -g -O0 -INLINE ;
## Microsoft Visual Studio C++ 6.x
toolset msvc cl : /Fe : -D
: /nologo /ML /O2 /Ob2 /Gy /GF /GA /GB
: /nologo /MLd /DEBUG /Z7 /Od /Ob0
: $(toolset-root)lib\\kernel32.lib ;
## Sun Workshop 6 C++
toolset sunpro CC : "-o " : -D
: -s -fast -O4
: -g +d ;
## Compaq Alpha CXX
toolset tru64cxx cc : "-o " : -D
: -s -O5 -inline speed
: -g -O0 -pg ;
## IBM VisualAge C++
toolset vacpp xlc : "-o " : -D
: -s -O3 -qstrict -qinline
: -g -qNOOPTimize -qnoinline -pg ;
## Microsoft Visual C++ .NET 7.x
toolset vc7 cl : /Fe : -D
: /nologo /ML /O2 /Ob2 /Gy /GF /GA /GB
: /nologo /MLd /DEBUG /Z7 /Od /Ob0
: $(toolset-root)lib\\kernel32.lib ;
# First set the build commands and options according to the
# preset toolset.
toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
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) ;
# 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
{
locate-target ?= bin.$(OS:L)$(OSPLAT:L) ;
platform = $(OS:L)$(OSPLAT:L) ;
}
if $(debug)
{
locate-target = $(locate-target).debug ;
}
# 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
;
if $(NT)
{
jam.source += execnt.c filent.c pathunix.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)
{
--defs += NDEBUG ;
}
# Enable some optional features.
--defs += OPT_HEADER_CACHE_EXT ;
--defs += OPT_GRAPH_DEBUG_EXT ;
# Bug fixes
--defs += OPT_FIX_TARGET_VARIABLES_EXT ;
# Improvements
--defs += OPT_IMPROVED_PATIENCE_EXT ;
if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs)
{
--defs += NT ;
}
--defs += YYSTACKSIZE=5000 ;
# The basic symbolic targets...
NOTFILE all clean dist ;
ALWAYS clean ;
# Utility rules and actions...
rule .clean
{
.rm clean : $(<) ;
}
if $(NT) { actions piecemeal together existing .rm { del /F /Q $(>) } }
if $(UNIX) { actions piecemeal together existing .rm { rm -f $(>) } }
rule .mkdir
{
NOUPDATE $(<) ;
if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
if ! $(md<$(<)>) { .md $(<) ; md<$(<)> = - ; }
}
actions .md { mkdir $(<) }
rule .exe
{
local exe = $(<) ;
if $(NT) || ( $(UNIX) && $(OS) = CYGWIN ) { exe = $(exe:S=.exe) ; }
LOCATE on $(exe) = $(locate-target) ;
DEPENDS $(exe) : $(>) ;
DEPENDS $(exe) : $(locate-target) ;
.mkdir $(locate-target) ;
.cc $(exe) : $(>) ;
.clean $(exe) ;
return $(exe) ;
}
actions .cc { $(--cc) $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) $(--libs) $(>) }
rule .link
{
DEPENDS $(<) : $(>) ;
.clean $(<) ;
}
if $(NT) { actions .link { copy $(>) $(<) } }
if $(UNIX) { actions .link { ln -f $(>) $(<) } }
rule .yyacc
{
DEPENDS $(<) : $(>) ;
}
actions .yyacc { ./yyacc $(<) $(>) }
yacc ?= [ GLOB $(PATH) : yacc yacc.exe ] ;
yacc ?= [ GLOB $(PATH) : bison bison.exe ] ;
yacc = $(yacc[1]) ;
switch $(yacc:D=:S=)
{
case bison : yacc += -y -d --yacc ; # -t -l -v ;
case yacc : yacc += -d ;
}
rule .yacc
{
DEPENDS $(<) : $(>) ;
}
if $(NT) { actions .yacc
{ $(yacc) $(>)
rename y.tab.c $(<[1]:S=.c)
rename y.tab.h $(<[1]:S=.h) } }
if $(UNIX) { actions .yacc
{ $(yacc) $(>)
mv -f y.tab.c $(<[1]:S=.c)
mv -f y.tab.h $(<[1]:S=.h) } }
# How to build the grammar.
if $(yacc)
{
.yyacc jamgram.y jamgramtab.h : jamgram.yy ;
.yacc jamgram.c jamgram.h : jamgram.y ;
}
# How to build the compiled in jambase.
rule exe.mkjambase
{
local exe = [ .exe mkjambase : mkjambase.c ] ;
DEPENDS $(<) : $(exe) $(>) ;
LEAVES $(<) ;
if $(NT) { chmod on $(<) = "attrib -r " ; }
if $(UNIX) { chmod on $(<) = "chmod +w " ; }
mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
}
actions exe.mkjambase
{ $(chmod)$(<)
$(mkjambase.exe) $(<) $(>) }
exe.mkjambase jambase.c : Jambase ;
# How to build Jam.
rule exe.jam
{
$(>).exe = [ .exe $(>) : $(jam.source) ] ;
$(<).exe = $(<:S=$($(>).exe:S)) ;
LOCATE on $($(<).exe) = $(locate-target) ;
.link $($(<).exe) : $($(>).exe) ;
DEPENDS all : $($(>).exe) $($(<).exe) ;
}
exe.jam bjam : jam ;
# Distribution making from here on out.
dist.docs =
Porting README RELNOTES
Jam.html Jambase.html Jamfile.html
;
dist.source =
[ GLOB . : *.c *.h ]
;
dist.source = $(dist.source:D=)
$(dist.docs)
build.jam build.bat build.sh
Jambase Jamfile
yyacc jamgram.y jamgram.yy
debian/changelog debian/control debian/copyright debian/jam.man.sgml debian/rules
boost-jam.spec
;
dist.bin =
bjam jam mkjambase
;
dist.bin =
$(dist.bin:S=$(bjam.exe:S):R=$(locate-target))
;
if $(NT)
{
if [ GLOB "C:\\Program Files\\7-ZIP" : "7zn.exe" ]
{
actions piecemeal .pack { "C:\Program Files\7-ZIP\7zn.exe" a -r -tzip "$(<)" "$(>)" }
actions piecemeal .zip { "C:\Program Files\7-ZIP\7zn.exe" a -r -tzip "$(<)" "$(>)" }
}
else
{
actions piecemeal .pack { zip -9r "$(<)" "$(>)" }
actions piecemeal .zip { zip -9r "$(<)" "$(>)" }
}
actions piecemeal .cp { copy /Y "$(>)" "$(<)" }
}
if $(UNIX)
{
actions .pack { tar zcf "$(<)" "$(>)" }
actions .zip { gzip -c9 "$(>)" > "$(<)" }
actions .cp { cp -Rpf "$(>)" "$(<)" }
}
# The single binary, compressed.
rule .binary
{
local zip = ;
if $(NT) { zip = $($(<).exe:S=.zip) ; }
if $(UNIX) { zip = $($(<).exe:S=.gz) ; }
DEPENDS $(zip) : $($(<).exe) ;
DEPENDS dist : $(zip) ;
LOCATE on $(zip) = $(locate-target) ;
.zip $(zip) : $($(<).exe) ;
.clean $(zip) ;
}
# Package some file.
rule .package ( dst-dir : src-files + )
{
local src-dirs = ;
for local s in $(src-files:D) { if ! $(s) in $(src-dirs) && ! $(s) = "" { src-dirs += $(s) ; } }
local dst-files = $(src-files:R=$(dst-dir)) ;
local dst-dirs = $(src-dirs:R=$(dst-dir)) ;
local pack = ;
if $(NT) { pack = $(dst-dir).zip ; }
if $(UNIX) { pack = $(dst-dir).tgz ; }
DEPENDS dist : $(pack) ;
DEPENDS $(pack) : $(dst-files) ;
for local src-file in $(src-files)
{
local dst-file = $(src-file:R=$(dst-dir)) ;
DEPENDS $(dst-file) : $(src-file) $(dst-file:D) ;
.mkdir $(dst-file:D) ;
.cp $(dst-file) : $(src-file) ;
.clean $(dst-file) ;
}
.pack $(pack) : $(dst-files) ;
.clean $(pack) ;
}
# RPM distro file.
rpm-tool = [ GLOB $(PATH) : "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) ;
.rpm-build $(target) : $(source) ;
.clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
}
actions .rpm-build
{ export BOOST_JAM_DOCS="$(docs)"
rpm -ta --target $(arch) $(>) | tee rpm.out
cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` .
rm -f rpm.out }
# The distribution targets.
.binary bjam ;
.package $(NAME)-$(VERSION) : $(dist.source) ;
.package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
if $(rpm-tool)
{
.rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;
}
# Update any targets in the specified commandline.
local e-- = ;
for local e in $(ARGV[2-])
{
if ! [ MATCH "^(-).*" : $(e) ] && $(e--) != "-f"
{
# This is not an option, so it is a target name.
UPDATE $(e) ;
}
e-- = $(e) ;
}