2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00
Files
build/jam_src/build.jam

394 lines
10 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 ;
# 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 + : flags * : linklibs * )
{
tool.$(name).cc ?= $(command) ;
tool.$(name).opt.out ?= $(opt.out) ;
tool.$(name).opt.define ?= $(opt.define) ;
tool.$(name).flags ?= $(flags) ;
tool.$(name).linklibs ?= $(linklibs) ;
toolsets += $(name) ;
}
## Borland C++ 5.5.x
toolset borland bcc32 : -e -n : /D : -WC -w- -q -IC:\\Borland\\BCC55\\Include -LC:\\Borland\\BCC55\\Lib -O2 ;
## Comeau C/C++ 4.x
toolset como como : "-o " : -D ;
## MacOSX Darwin, using GCC 2.9.x, 3.x
toolset darwin cc : "-o " : -D : -s -O3 ;
## GCC 2.x, 3.x
toolset gcc gcc : "-o " : -D : -s -O3 ;
## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll
toolset gcc-nocygwin gcc : "-o " : -D : -s -O3 -mno-cygwin ;
## Intel C/C++ for Linux
toolset intel-linux icc : "-o " : -D : -Xlinker -s -O3 ;
## Intel C/C++ for Win32
toolset intel-win32 icl : /Fe : -D : /nologo /GZ /Zi /MLd ;
## KCC ?
toolset kcc KCC : "-o " : -D : -s +K2 ;
## Borland Kylix
toolset kylix bc++ : -o : -D : -tC -q -O2 ;
## Metrowerks CodeWarrior 8.x
{ local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; }
toolset metrowerks $(mwcc) : "-o " : -D : -runtime staticsingle -O ; }
## MINGW GCC
toolset mingw gcc : "-o " : -D : -s -O3 -DMINGW ;
## MIPS Pro
toolset mipspro cc : "-o " : -D : -s -O3 -g0 ;
## Microsoft Visual Studio C++ 6.x
toolset msvc cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ;
## Sun Workshop 6 C++
toolset sunpro CC : "-o " : -D : -s -fast -O4 ;
## Compaq Alpha CXX
toolset tru64cxx cc : "-o " : -D : -s -O5 ;
## IBM VisualAge C++
toolset vacpp xlc : "-o " : -D : -s -O3 -qstrict ;
## Microsoft Visual C++ .NET 7.x
toolset vc7 cl : /Fe : -D : /nologo /GZ /Zi /MLd : $(MSVCDir)\\lib\\kernel32.lib ;
# First set the build commands and options according to the
# preset toolset.
toolset = $(BOOST_JAM_TOOLSET) ;
if ! $(toolset) in $(toolsets)
{
EXIT "Unknown toolset '$(toolset)'." ;
}
--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 ?= [.binvms] ;
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) ;
}
# 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 ;
}
# 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) { 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 $(<) : $(>) ;
.clean $(<) ;
}
actions .yyacc { ./yyacc $(<) $(>) }
yacc ?= [ GLOB $(PATH) : bison bison.exe ] ;
yacc ?= [ GLOB $(PATH) : yacc yacc.exe ] ;
yacc = $(yacc[1]) ;
switch $(yacc:D=:S=)
{
case bison : yacc += -y -d --yacc ; # -t -l -v ;
case yacc : yacc += -d ;
}
rule .yacc
{
DEPENDS $(<) : $(>) ;
.clean $(<) ;
}
if $(NT) { actions .yacc
{ $(yacc) $(>)
rename y.tab.c $(<:S=.c)
rename y.tab.h $(<:S=.h) } }
if $(UNIX) { actions .yacc
{ $(yacc) $(>)
mv -f y.tab.c $(<:S=.c)
mv -f y.tab.h $(<:S=.h) } }
# How to build the grammar.
if $(yacc)
{
.yyacc jamgram.y jamgramtab.h : jamgram.yy ;
.yacc jamgram.c : 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)) ;
.clean $(<) ;
}
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 -af "$(>)" "$(<)" }
}
# 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) ;
}