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 8a7dcb64ba Improvements to bootstraping and building.
- build.bat; added more possible locations for VC7.
- build.bat; added an alternate for finding bison (gnuwin32.sourceforge.net version).
- build.jam; added an alternate for finding bison (gnuwin32.sourceforge.net version).
- build.jam; removed some obsolete docs from distribution.
- build.jam; fixed path problem when packaging on windows, the debian directory.
- build.jam; added header scanning to create the extra dependencies to make building the grammar work correctly.
- build.jam; fixed building of the grammar to remove attempts at building it spuriously.
- build.jam; fixed building of grammar so that it doesn't delete existing files if the yacc execution fails.
- index.html; minor cleanup of language in some places.
- index.html; removed references to no longer packaged docs.
- *; updated the version to 3.1.5 in various places.
- build.*; tested on windows with vc7, metrowerks, mingw, and borland


[SVN r18703]
2003-06-07 18:44:32 +00:00

661 lines
16 KiB
Plaintext

# Copyrigt (C) 2002-2003 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.5 ;
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 .type ? : opt.out + : opt.define * : release-flags * : debug-flags * : linklibs * )
{
.type ?= "" ;
tool.$(name)$(.type).cc ?= $(command) ;
tool.$(name)$(.type).opt.out ?= $(opt.out) ;
tool.$(name)$(.type).opt.define ?= $(opt.define) ;
if $(debug)
{
tool.$(name)$(.type).flags ?= $(debug-flags) ;
}
else
{
tool.$(name)$(.type).flags ?= $(release-flags) ;
}
tool.$(name)$(.type).linklibs ?= $(linklibs) ;
if ! $(name) in $(toolsets) { toolsets += $(name) ; }
}
## HP-UX aCC compiler
toolset acc cc : "-o " : -D
: -Ae -s -O3
: -Ae -g -pg ;
## 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- ;
## Generic Unix cc
if ! $(CC) { CC = cc ; }
toolset cc $(CC) : "-o " : -D
: -s -O $(CFLAGS)
: -g $(CFLAGS)
: $(LIBS) ;
## 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) ; }
mwcc ?= mwcc ;
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
: -g -O0 -fno-inline -pg ;
## 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
: 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
: kernel32.lib ;
## VMS/OpenVMS DEC C
toolset vms cc : /OBJECT= : /DEFINE=
: /STANDARD=VAXC
: /STANDARD=VAXC
;
toolset vms link .link : /EXECUTABLE= :
: /NOMAP
: /NOMAP
;
# 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) ;
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) ;
}
# Platform related specifics.
if $(NT) { rule .path { return "$(<:J=\\)" ; } }
else if $(OS2) { rule .path { return "$(<:J=\\)" ; } }
else if $(VMS) { rule .path { return "[.$(<:J=/)]" ; } }
else if $(MAC) { rule .path { return ":$(<:J=\:)" ; } }
else { rule .path { return "$(<:J=/)" ; } }
if $(VMS) { . = "_" ; }
else { . = "." ; }
# Put executables in platform-specific subdirectory.
locate-target = $(LOCATE_TARGET) ;
if $(VMS)
{
locate-target ?= [ .path bin$(.)vms ] ;
platform = vms ;
}
else if $(MAC)
{
locate-target ?= [ .path bin$(.)$(OS:L)$(OSPLAT:L) ] ;
platform = $(OS:L)$(OSPLAT:L) ;
}
else if $(OSPLAT)
{
locate-target ?= [ .path bin$(.)$(OS:L)$(OSPLAT:L) ] ;
platform = $(OS:L)$(OSPLAT:L) ;
}
else
{
locate-target ?= [ .path bin$(.)$(OS:L) ] ;
platform = $(OS: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 ;
--defs += OPT_SEMAPHORE ;
# Bug fixes
--defs += OPT_FIX_TARGET_VARIABLES_EXT ;
# Improvements
--defs += OPT_IMPROVED_PATIENCE_EXT ;
if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs)
{
--defs += NT ;
}
if $(VMS)
{
--defs += VMS ;
}
--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 $(>)
} }
if $(VMS) { actions piecemeal together existing .rm. {
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)
{
for local s in $(>)
{
local o = $(s:S=.o) ;
LOCATE on $(o) = $(locate-target) ;
DEPENDS $(exe) : $(o) ;
DEPENDS $(o) : $(s) ;
DEPENDS $(o) : $(locate-target) ;
.cc. $(o) : $(s) ;
.clean $(o) ;
}
DEPENDS $(exe) : $(>:S=.o) ;
DEPENDS $(exe) : $(locate-target) ;
.ld. $(exe) : $(>:S=.o) ;
.clean $(exe) ;
}
else
{
DEPENDS $(exe) : $(>) ;
DEPENDS $(exe) : $(locate-target) ;
.cc. $(exe) : $(>) ;
.clean $(exe) ;
}
return $(exe) ;
}
actions .cc. {
$(--cc) $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) "$(--libs)" $(>)
}
if $(VMS) { actions .ld. {
$(--link) $(--link-bin)$(<:D=) $(--link-dir)$(<:D) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>J=", ")
} }
else { actions .ld. {
$(--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 -f $(>) $(<)
} }
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) $(<) $(>)
}
.yyacc jamgram.y jamgramtab.h : jamgram.yy ;
# 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 "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 y.tab.c y.tab.h : $(>) ;
DEPENDS y.tab.h : y.tab.c ;
TEMPORARY y.tab.c y.tab.h ;
DEPENDS $(<[1]) : y.tab.c ;
DEPENDS $(<[2]) : y.tab.h ;
.yacc. y.tab.c y.tab.h : $(>) ;
.move $(<[1]) : y.tab.c ;
.move $(<[2]) : y.tab.h ;
}
actions .yacc. {
"$(yacc)" $(>)
}
if $(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) $(<) $(>)
}
.mkjambase jambase.c : Jambase ;
# How to build Jam.
rule .jam
{
$(>).exe = [ .exe $(>) : $(jam.source) ] ;
$(<).exe = $(<:S=$($(>).exe:S)) ;
LOCATE on $($(<).exe) = $(locate-target) ;
.link $($(<).exe) : $($(>).exe) ;
DEPENDS all : $($(>).exe) $($(<).exe) ;
}
.jam bjam : jam ;
# Scan sources for header dependencies.
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.docs =
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 ]
boost-jam.spec
;
dist.bin =
bjam jam mkjambase yyacc
;
dist.bin =
$(dist.bin:S=$(bjam.exe:S))
;
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=.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 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) ;
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_DOCS="$(docs)"
export BOOST_JAM_TOOLSET="$(toolset)"
rpm -ta $(target-opt)$(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 ;
}