diff --git a/v2/Jamroot.jam b/v2/Jamroot.jam index 421e51a18..11334864c 100644 --- a/v2/Jamroot.jam +++ b/v2/Jamroot.jam @@ -15,13 +15,14 @@ if [ os.on-windows ] package.install boost-build-engine boost-build : # properties : # binaries - bjam$(ext) + b2$(ext) bjam$(ext) ; local e1 = [ path.glob-tree $(SELF)/example : * : . .svn ] ; local e2 ; for e in $(e1) { + e = [ path.native $(e) ] ; if [ CHECK_IF_FILE $(e) ] { e2 += $(e) ; diff --git a/v2/bootstrap.bat b/v2/bootstrap.bat index 3fa2b199d..190c9283d 100644 --- a/v2/bootstrap.bat +++ b/v2/bootstrap.bat @@ -6,20 +6,22 @@ REM Distributed under the Boost Software License, Version 1.0. REM (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) ECHO Bootstrapping the build engine -if exist ".\engine\src\bin.ntx86\bjam.exe" del engine\src\bin.ntx86\bjam.exe -if exist ".\engine\src\bin.ntx86_64\bjam.exe" del engine\src\bin.ntx86_64\bjam.exe -cd engine\src +if exist ".\engine\bin.ntx86\bjam.exe" del engine\bin.ntx86\bjam.exe +if exist ".\engine\bin.ntx86_64\bjam.exe" del engine\bin.ntx86_64\bjam.exe +cd engine call .\build.bat %* > ..\..\bootstrap.log @ECHO OFF -cd ..\.. +cd .. -if exist ".\engine\src\bin.ntx86\bjam.exe" ( - copy .\engine\src\bin.ntx86\bjam.exe . > nul +if exist ".\engine\bin.ntx86\b2.exe" ( + copy .\engine\bin.ntx86\b2.exe . > nul + copy .\engine\bin.ntx86\bjam.exe . > nul goto :bjam_built) -if exist ".\engine\src\bin.ntx86_64\bjam.exe" ( - copy .\engine\src\bin.ntx86_64\bjam.exe . > nul +if exist ".\engine\bin.ntx86_64\b2.exe" ( + copy .\engine\bin.ntx86_64\b2.exe . > nul + copy .\engine\bin.ntx86_64\bjam.exe . > nul goto :bjam_built) goto :bjam_failure @@ -29,7 +31,7 @@ goto :bjam_failure ECHO. ECHO Bootstrapping is done. To build, run: ECHO. -ECHO .\bjam --prefix=DIR install +ECHO .\b2 --prefix=DIR install ECHO. goto :end diff --git a/v2/bootstrap.sh b/v2/bootstrap.sh index 3b681004c..508355173 100755 --- a/v2/bootstrap.sh +++ b/v2/bootstrap.sh @@ -55,7 +55,7 @@ my_dir="." # Determine the toolset, if not already decided if test "x$TOOLSET" = x; then - guessed_toolset=`$my_dir/engine/src/build.sh --guess-toolset` + guessed_toolset=`$my_dir/engine/build.sh --guess-toolset` case $guessed_toolset in acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp ) TOOLSET=$guessed_toolset @@ -96,7 +96,7 @@ rm -f config.log if test "x$BJAM" = x; then echo -n "Bootstrapping the build engine with toolset $TOOLSET... " pwd=`pwd` - (cd "$my_dir/engine/src" && ./build.sh "$TOOLSET") > bootstrap.log 2>&1 + (cd "$my_dir/engine" && ./build.sh "$TOOLSET") > bootstrap.log 2>&1 if [ $? -ne 0 ]; then echo echo "Failed to bootstrap the build engine" @@ -104,16 +104,17 @@ if test "x$BJAM" = x; then exit 1 fi cd "$pwd" - arch=`cd $my_dir/engine/src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..` - BJAM="$my_dir/engine/src/$arch/bjam" - echo "engine/src/$arch/bjam" + arch=`cd $my_dir/engine && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..` + BJAM="$my_dir/engine/$arch/b2" + echo "engine/$arch/bjam" cp "$BJAM" . + cp "$my_dir/engine/$arch/bjam" . fi cat << EOF Bootstrapping is done. To build and install, run: - ./bjam install --prefix= + ./b2 install --prefix= EOF diff --git a/v2/build-system.jam b/v2/build-system.jam index a555b610d..9f9c884cc 100644 --- a/v2/build-system.jam +++ b/v2/build-system.jam @@ -543,14 +543,15 @@ local rule should-clean-project ( project ) # ################################################################################ -{ +{ if --version in $(.argv) { version.print ; EXIT ; } - - + + version.verify-engine-version ; + load-configuration-files ; local extra-properties ; @@ -771,7 +772,6 @@ local rule should-clean-project ( project ) # Prepare valid XML header and footer with some basic info. local nl = " " ; - local jam = [ version.jam ] ; local os = [ modules.peek : OS OSPLAT JAMUNAME ] "" ; local timestamp = [ modules.peek : JAMDATE ] ; local cwd = [ PWD ] ; @@ -780,7 +780,6 @@ local rule should-clean-project ( project ) .header on $(xml-file) = "" "$(nl)" - "$(nl) " "$(nl) " "$(nl) " "$(nl) " diff --git a/v2/build/configure.jam b/v2/build/configure.jam index 6a87157a2..14c1328af 100644 --- a/v2/build/configure.jam +++ b/v2/build/configure.jam @@ -17,6 +17,8 @@ import sequence ; import property ; import property-set ; import "class" : new ; +import common ; +import path ; rule log-summary ( ) { @@ -185,12 +187,9 @@ rule builds ( metatarget-reference : properties * : what ? : retry ? ) # should never be called by users. rule set-log-file ( log-file ) { - # FIXME: remove this check as soon as Boost regression tests - # start using trunk bjam - if FILE_OPEN in [ RULENAMES ] - { - .log-fd = [ FILE_OPEN $(log-file) : "w" ] ; - } + path.makedirs [ path.parent $(log-file) ] ; + + .log-fd = [ FILE_OPEN $(log-file) : "w" ] ; } # Frontend rules diff --git a/v2/build/project.jam b/v2/build/project.jam index 4a8eb5607..c9967613b 100644 --- a/v2/build/project.jam +++ b/v2/build/project.jam @@ -433,7 +433,8 @@ rule initialize ( # Import rules common to all project modules from project-rules module, # defined at the end of this file. - modules.clone-rules project-rules $(module-name) ; + local rules = [ RULENAMES project-rules ] ; + IMPORT project-rules : $(rules) : $(module-name) : $(rules) ; local jamroot ; @@ -881,15 +882,16 @@ module project-rules # expect the module to be found even though the directory is not in # BOOST_BUILD_PATH. local x = [ modules.peek : BOOST_BUILD_PATH ] ; - local caller = [ modules.binding $(__name__) ] ; - modules.poke : BOOST_BUILD_PATH : $(caller:D) $(x) ; + local caller = [ CALLER_MODULE ] ; + local caller-location = [ modules.binding $(caller) ] ; + modules.poke : BOOST_BUILD_PATH : $(caller-location:D) $(x) ; toolset.using $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; modules.poke : BOOST_BUILD_PATH : $(x) ; # The above might have clobbered .current-project. Restore the correct # value. modules.poke project : .current-project - : [ project.target $(__name__) ] ; + : [ project.target $(caller) ] ; } import modules ; @@ -913,7 +915,8 @@ module project-rules import path ; import project ; - local attributes = [ project.attributes $(__name__) ] ; + local caller = [ CALLER_MODULE ] ; + local attributes = [ project.attributes $(caller) ] ; if $(id) { $(attributes).set id : $(id) ; @@ -991,7 +994,8 @@ module project-rules ) { import project ; - local p = [ project.target $(__name__) ] ; + local caller = [ CALLER_MODULE ] ; + local p = [ project.target $(caller) ] ; $(p).add-constant $(name) : $(value) ; } @@ -1005,20 +1009,26 @@ module project-rules ) { import project ; - local p = [ project.target $(__name__) ] ; + local caller = [ CALLER_MODULE ] ; + local p = [ project.target $(caller) ] ; $(p).add-constant $(name) : $(value) : path ; } rule use-project ( id : where ) { + import modules ; # See comment in 'load' for explanation. - .used-projects += $(id) $(where) ; + local caller = [ CALLER_MODULE ] ; + modules.poke $(caller) : .used-projects : + [ modules.peek $(caller) : .used-projects ] + $(id) $(where) ; } rule build-project ( dir ) { import project ; - local attributes = [ project.attributes $(__name__) ] ; + local caller = [ CALLER_MODULE ] ; + local attributes = [ project.attributes $(caller) ] ; local now = [ $(attributes).get projects-to-build ] ; $(attributes).set projects-to-build : $(now) $(dir) ; diff --git a/v2/build/version.jam b/v2/build/version.jam index 1d64026d9..7626ddda8 100644 --- a/v2/build/version.jam +++ b/v2/build/version.jam @@ -6,26 +6,44 @@ import errors ; import numbers ; +major = "2011" ; +minor = "04" ; rule boost-build ( ) { - return "V2 (Milestone 12)" ; + return "$(major).$(minor)-svn" ; } - -rule jam ( ) -{ - local v = [ modules.peek : JAM_VERSION ] ; - return $(v:J=.) ; -} - - rule print ( ) { - ECHO "Boost.Build" [ boost-build ] ; - ECHO "Boost.Jam" [ jam ] ; + if [ verify-engine-version ] + { + ECHO "Boost.Build" [ boost-build ] ; + } } +rule verify-engine-version ( ) +{ + local v = [ modules.peek : JAM_VERSION ] ; + + if $(v[1]) != $(major) || $(v[2]) != $(minor) + { + local argv = [ modules.peek : ARGV ] ; + local e = $(argv[1]) ; + local l = [ modules.binding version ] ; + l = $(l:D) ; + l = $(l:D) ; + ECHO "warning: mismatched versions of Boost.Build engine and core" ; + ECHO "warning: Boost.Build engine ($(e)) is $(v:J=.)" ; + ECHO "warning: Boost.Build core (at $(l)) is" [ boost-build ] ; + } + else + { + return true ; + } +} + + # Utility rule for testing whether all elements in a sequence are equal to 0. # diff --git a/v2/doc/jamfile.jam b/v2/doc/jamfile.jam index 7c946a453..9bfbd0641 100644 --- a/v2/doc/jamfile.jam +++ b/v2/doc/jamfile.jam @@ -15,6 +15,7 @@ boostbook userman : src/standalone.xml jam_docs jam_docs boost.root=../../../../.. + boost.defaults=Boost ; xml jam_docs : bjam.qbk ; diff --git a/v2/doc/src/install.xml b/v2/doc/src/install.xml index 526606fd6..afae46aa1 100644 --- a/v2/doc/src/install.xml +++ b/v2/doc/src/install.xml @@ -22,7 +22,7 @@ Run either .\bootstrap.bat (on Windows), or - ./bootstrap.sh (on other operating systmes). + ./bootstrap.sh (on other operating systems). @@ -52,7 +52,7 @@ PREFIX/share/boost-build/examples/hello to a different directory, then change to that directory and run: PREFIX/bin/bjam - A simple executable should be build. + A simple executable should be built. - - - - - - - Automatic redirection failed, please go to ../../../../doc/html/jam.html - - diff --git a/v2/engine/src/jam.c b/v2/engine/jam.c similarity index 99% rename from v2/engine/src/jam.c rename to v2/engine/jam.c index 550d78a8e..e11d082bc 100644 --- a/v2/engine/src/jam.c +++ b/v2/engine/jam.c @@ -217,7 +217,7 @@ int main( int argc, char * * argv, char * * arg_environ ) { int n; char * s; - struct option optv[N_OPTS]; + struct bjam_option optv[N_OPTS]; char const * all = "all"; int status; int arg_c = argc; diff --git a/v2/engine/src/jam.h b/v2/engine/jam.h similarity index 100% rename from v2/engine/src/jam.h rename to v2/engine/jam.h diff --git a/v2/engine/src/jambase.c b/v2/engine/jambase.c similarity index 99% rename from v2/engine/src/jambase.c rename to v2/engine/jambase.c index d89f3c54d..b15282bc3 100644 --- a/v2/engine/src/jambase.c +++ b/v2/engine/jambase.c @@ -64,7 +64,8 @@ char *jambase[] = { "}\n", "include $(.bootstrap-file) ;\n", "}\n", -"if [ MATCH .*(bjam).* : $(ARGV[1]:BL) ]\n", +"if [ MATCH .*(b2).* : $(ARGV[1]:BL) ] \n", +"|| [ MATCH .*(bjam).* : $(ARGV[1]:BL) ]\n", "|| $(BOOST_ROOT) # A temporary measure so Jam works with Boost.Build v1.\n", "{\n", "local search-path = $(BOOST_BUILD_PATH) $(BOOST_ROOT) ;\n", diff --git a/v2/engine/src/jambase.h b/v2/engine/jambase.h similarity index 100% rename from v2/engine/src/jambase.h rename to v2/engine/jambase.h diff --git a/v2/engine/src/jamgram.c b/v2/engine/jamgram.c similarity index 100% rename from v2/engine/src/jamgram.c rename to v2/engine/jamgram.c diff --git a/v2/engine/src/jamgram.h b/v2/engine/jamgram.h similarity index 100% rename from v2/engine/src/jamgram.h rename to v2/engine/jamgram.h diff --git a/v2/engine/src/jamgram.y b/v2/engine/jamgram.y similarity index 100% rename from v2/engine/src/jamgram.y rename to v2/engine/jamgram.y diff --git a/v2/engine/src/jamgram.yy b/v2/engine/jamgram.yy similarity index 100% rename from v2/engine/src/jamgram.yy rename to v2/engine/jamgram.yy diff --git a/v2/engine/src/jamgramtab.h b/v2/engine/jamgramtab.h similarity index 100% rename from v2/engine/src/jamgramtab.h rename to v2/engine/jamgramtab.h diff --git a/v2/engine/src/lists.c b/v2/engine/lists.c similarity index 100% rename from v2/engine/src/lists.c rename to v2/engine/lists.c diff --git a/v2/engine/src/lists.h b/v2/engine/lists.h similarity index 100% rename from v2/engine/src/lists.h rename to v2/engine/lists.h diff --git a/v2/engine/src/make.c b/v2/engine/make.c similarity index 100% rename from v2/engine/src/make.c rename to v2/engine/make.c diff --git a/v2/engine/src/make.h b/v2/engine/make.h similarity index 100% rename from v2/engine/src/make.h rename to v2/engine/make.h diff --git a/v2/engine/src/make1.c b/v2/engine/make1.c similarity index 100% rename from v2/engine/src/make1.c rename to v2/engine/make1.c diff --git a/v2/engine/src/md5.c b/v2/engine/md5.c similarity index 100% rename from v2/engine/src/md5.c rename to v2/engine/md5.c diff --git a/v2/engine/src/md5.h b/v2/engine/md5.h similarity index 100% rename from v2/engine/src/md5.h rename to v2/engine/md5.h diff --git a/v2/engine/src/mem.c b/v2/engine/mem.c similarity index 100% rename from v2/engine/src/mem.c rename to v2/engine/mem.c diff --git a/v2/engine/src/mem.h b/v2/engine/mem.h similarity index 100% rename from v2/engine/src/mem.h rename to v2/engine/mem.h diff --git a/v2/engine/src/mkjambase.c b/v2/engine/mkjambase.c similarity index 100% rename from v2/engine/src/mkjambase.c rename to v2/engine/mkjambase.c diff --git a/v2/engine/src/modules.c b/v2/engine/modules.c similarity index 100% rename from v2/engine/src/modules.c rename to v2/engine/modules.c diff --git a/v2/engine/src/modules.h b/v2/engine/modules.h similarity index 100% rename from v2/engine/src/modules.h rename to v2/engine/modules.h diff --git a/v2/engine/src/modules/order.c b/v2/engine/modules/order.c similarity index 100% rename from v2/engine/src/modules/order.c rename to v2/engine/modules/order.c diff --git a/v2/engine/src/modules/path.c b/v2/engine/modules/path.c similarity index 100% rename from v2/engine/src/modules/path.c rename to v2/engine/modules/path.c diff --git a/v2/engine/src/modules/property-set.c b/v2/engine/modules/property-set.c similarity index 100% rename from v2/engine/src/modules/property-set.c rename to v2/engine/modules/property-set.c diff --git a/v2/engine/src/modules/readme.txt b/v2/engine/modules/readme.txt similarity index 100% rename from v2/engine/src/modules/readme.txt rename to v2/engine/modules/readme.txt diff --git a/v2/engine/src/modules/regex.c b/v2/engine/modules/regex.c similarity index 100% rename from v2/engine/src/modules/regex.c rename to v2/engine/modules/regex.c diff --git a/v2/engine/src/modules/sequence.c b/v2/engine/modules/sequence.c similarity index 100% rename from v2/engine/src/modules/sequence.c rename to v2/engine/modules/sequence.c diff --git a/v2/engine/src/modules/set.c b/v2/engine/modules/set.c similarity index 100% rename from v2/engine/src/modules/set.c rename to v2/engine/modules/set.c diff --git a/v2/engine/src/native.c b/v2/engine/native.c similarity index 100% rename from v2/engine/src/native.c rename to v2/engine/native.c diff --git a/v2/engine/src/native.h b/v2/engine/native.h similarity index 100% rename from v2/engine/src/native.h rename to v2/engine/native.h diff --git a/v2/engine/src/newstr.c b/v2/engine/newstr.c similarity index 100% rename from v2/engine/src/newstr.c rename to v2/engine/newstr.c diff --git a/v2/engine/src/newstr.h b/v2/engine/newstr.h similarity index 100% rename from v2/engine/src/newstr.h rename to v2/engine/newstr.h diff --git a/v2/engine/src/option.c b/v2/engine/option.c similarity index 93% rename from v2/engine/src/option.c rename to v2/engine/option.c index 69f3bf802..d25e5e8ad 100644 --- a/v2/engine/src/option.c +++ b/v2/engine/option.c @@ -17,7 +17,7 @@ * was supplied for an option that does not require one." */ -int getoptions( int argc, char * * argv, char * opts, option * optv ) +int getoptions( int argc, char * * argv, char * opts, bjam_option * optv ) { int i; int optc = N_OPTS; @@ -84,7 +84,7 @@ int getoptions( int argc, char * * argv, char * opts, option * optv ) * Name: getoptval() - find an option given its character. */ -char * getoptval( option * optv, char opt, int subopt ) +char * getoptval( bjam_option * optv, char opt, int subopt ) { int i; for ( i = 0; i < N_OPTS; ++i, ++optv ) diff --git a/v2/engine/src/option.h b/v2/engine/option.h similarity index 66% rename from v2/engine/src/option.h rename to v2/engine/option.h index 872bf1ff4..99ef620da 100644 --- a/v2/engine/src/option.h +++ b/v2/engine/option.h @@ -11,13 +11,13 @@ * \ -) "Command line option." */ -typedef struct option +typedef struct bjam_option { char flag; /* filled in by getoption() */ char *val; /* set to random address if true */ -} option; +} bjam_option; # define N_OPTS 256 -int getoptions( int argc, char **argv, char *opts, option *optv ); -char * getoptval( option *optv, char opt, int subopt ); +int getoptions( int argc, char **argv, char *opts, bjam_option *optv ); +char * getoptval( bjam_option *optv, char opt, int subopt ); diff --git a/v2/engine/src/output.c b/v2/engine/output.c similarity index 100% rename from v2/engine/src/output.c rename to v2/engine/output.c diff --git a/v2/engine/src/output.h b/v2/engine/output.h similarity index 100% rename from v2/engine/src/output.h rename to v2/engine/output.h diff --git a/v2/engine/src/parse.c b/v2/engine/parse.c similarity index 100% rename from v2/engine/src/parse.c rename to v2/engine/parse.c diff --git a/v2/engine/src/parse.h b/v2/engine/parse.h similarity index 100% rename from v2/engine/src/parse.h rename to v2/engine/parse.h diff --git a/v2/engine/src/patchlevel.h b/v2/engine/patchlevel.h similarity index 51% rename from v2/engine/src/patchlevel.h rename to v2/engine/patchlevel.h index 5d5979057..699efd84b 100644 --- a/v2/engine/src/patchlevel.h +++ b/v2/engine/patchlevel.h @@ -7,11 +7,11 @@ /* Keep JAMVERSYM in sync with VERSION. */ /* It can be accessed as $(JAMVERSION) in the Jamfile. */ -#define VERSION_MAJOR 3 -#define VERSION_MINOR 1 -#define VERSION_PATCH 19 -#define VERSION_MAJOR_SYM "03" -#define VERSION_MINOR_SYM "1" -#define VERSION_PATCH_SYM "19" -#define VERSION "3.1.19" -#define JAMVERSYM "JAMVERSION=3.1" +#define VERSION_MAJOR 2011 +#define VERSION_MINOR 04 +#define VERSION_PATCH 0 +#define VERSION_MAJOR_SYM "2011" +#define VERSION_MINOR_SYM "04" +#define VERSION_PATCH_SYM "00" +#define VERSION "2011.4" +#define JAMVERSYM "JAMVERSION=2011.4" diff --git a/v2/engine/src/pathmac.c b/v2/engine/pathmac.c similarity index 100% rename from v2/engine/src/pathmac.c rename to v2/engine/pathmac.c diff --git a/v2/engine/src/pathsys.h b/v2/engine/pathsys.h similarity index 100% rename from v2/engine/src/pathsys.h rename to v2/engine/pathsys.h diff --git a/v2/engine/src/pathunix.c b/v2/engine/pathunix.c similarity index 100% rename from v2/engine/src/pathunix.c rename to v2/engine/pathunix.c diff --git a/v2/engine/src/pathvms.c b/v2/engine/pathvms.c similarity index 100% rename from v2/engine/src/pathvms.c rename to v2/engine/pathvms.c diff --git a/v2/engine/src/pwd.c b/v2/engine/pwd.c similarity index 100% rename from v2/engine/src/pwd.c rename to v2/engine/pwd.c diff --git a/v2/engine/src/pwd.h b/v2/engine/pwd.h similarity index 100% rename from v2/engine/src/pwd.h rename to v2/engine/pwd.h diff --git a/v2/engine/src/regexp.c b/v2/engine/regexp.c similarity index 100% rename from v2/engine/src/regexp.c rename to v2/engine/regexp.c diff --git a/v2/engine/src/regexp.h b/v2/engine/regexp.h similarity index 100% rename from v2/engine/src/regexp.h rename to v2/engine/regexp.h diff --git a/v2/engine/src/rules.c b/v2/engine/rules.c similarity index 100% rename from v2/engine/src/rules.c rename to v2/engine/rules.c diff --git a/v2/engine/src/rules.h b/v2/engine/rules.h similarity index 100% rename from v2/engine/src/rules.h rename to v2/engine/rules.h diff --git a/v2/engine/src/scan.c b/v2/engine/scan.c similarity index 100% rename from v2/engine/src/scan.c rename to v2/engine/scan.c diff --git a/v2/engine/src/scan.h b/v2/engine/scan.h similarity index 100% rename from v2/engine/src/scan.h rename to v2/engine/scan.h diff --git a/v2/engine/src/search.c b/v2/engine/search.c similarity index 100% rename from v2/engine/src/search.c rename to v2/engine/search.c diff --git a/v2/engine/src/search.h b/v2/engine/search.h similarity index 100% rename from v2/engine/src/search.h rename to v2/engine/search.h diff --git a/v2/engine/src/strings.c b/v2/engine/strings.c similarity index 100% rename from v2/engine/src/strings.c rename to v2/engine/strings.c diff --git a/v2/engine/src/strings.h b/v2/engine/strings.h similarity index 100% rename from v2/engine/src/strings.h rename to v2/engine/strings.h diff --git a/v2/engine/src/subst.c b/v2/engine/subst.c similarity index 100% rename from v2/engine/src/subst.c rename to v2/engine/subst.c diff --git a/v2/engine/src/timestamp.c b/v2/engine/timestamp.c similarity index 100% rename from v2/engine/src/timestamp.c rename to v2/engine/timestamp.c diff --git a/v2/engine/src/timestamp.h b/v2/engine/timestamp.h similarity index 100% rename from v2/engine/src/timestamp.h rename to v2/engine/timestamp.h diff --git a/v2/engine/src/variable.c b/v2/engine/variable.c similarity index 100% rename from v2/engine/src/variable.c rename to v2/engine/variable.c diff --git a/v2/engine/src/variable.h b/v2/engine/variable.h similarity index 100% rename from v2/engine/src/variable.h rename to v2/engine/variable.h diff --git a/v2/engine/src/w32_getreg.c b/v2/engine/w32_getreg.c similarity index 100% rename from v2/engine/src/w32_getreg.c rename to v2/engine/w32_getreg.c diff --git a/v2/engine/src/yyacc.c b/v2/engine/yyacc.c similarity index 100% rename from v2/engine/src/yyacc.c rename to v2/engine/yyacc.c diff --git a/v2/example/versioned/hello.cpp b/v2/example/versioned/hello.cpp index 8a86ff048..11fef734b 100644 --- a/v2/example/versioned/hello.cpp +++ b/v2/example/versioned/hello.cpp @@ -7,6 +7,6 @@ int main() { - std::cout << "Hello!\n"; + std::cout << "Hello there!\n"; return 1; } diff --git a/v2/roll.sh b/v2/roll.sh index 3b8eb82a1..4a8f52ec4 100755 --- a/v2/roll.sh +++ b/v2/roll.sh @@ -22,14 +22,16 @@ find . -maxdepth 1 -type f | egrep -v "boost-build.jam|timestamp.txt|roll.sh|boo # Build the documentation touch doc/jamroot.jam export BOOST_BUILD_PATH=`pwd` +./bootstrap.sh cd doc -/home/ghost/Work/Boost/boost-svn/tools/jam/src/bin.linuxx86/bjam --v2 -/home/ghost/Work/Boost/boost-svn/tools/jam/src/bin.linuxx86/bjam --v2 pdf +../bjam --v2 +../bjam --v2 pdf cp `find bin -name "*.pdf"` ../.. mv ../../standalone.pdf ../../userman.pdf cp ../../userman.pdf . rm -rf bin cd .. +rm bjam # Get the boost logo. wget http://boost.sf.net/boost-build2/boost.png @@ -42,7 +44,7 @@ perl -pi -e 's%../../../doc/html/bbv2.installation.html%doc/html/bbv2.installati # Make packages find . -name ".svn" | xargs rm -rf rm roll.sh -chmod a+x engine/src/build.bat +chmod a+x engine/build.bat cd .. && zip -r boost-build.zip boost-build && tar --bzip2 -cf boost-build.tar.bz2 boost-build # Copy packages to a location where they are grabbed for beta.boost.org cp userman.pdf boost-build.zip boost-build.tar.bz2 ~/public_html/boost_build_nightly diff --git a/v2/test/engine/README.txt b/v2/test/engine/README.txt new file mode 100644 index 000000000..c38701fb8 --- /dev/null +++ b/v2/test/engine/README.txt @@ -0,0 +1,5 @@ + +This directory contains tests for the update engine of +Boost.Build. They presently are not integrated with +the Python based test system and must be run by +hand. diff --git a/v2/engine/test/action_status.jam b/v2/test/engine/action_status.jam similarity index 100% rename from v2/engine/test/action_status.jam rename to v2/test/engine/action_status.jam diff --git a/v2/engine/test/actions_quietly.jam b/v2/test/engine/actions_quietly.jam similarity index 100% rename from v2/engine/test/actions_quietly.jam rename to v2/test/engine/actions_quietly.jam diff --git a/v2/engine/test/builtin_normalize_path.jam b/v2/test/engine/builtin_normalize_path.jam similarity index 100% rename from v2/engine/test/builtin_normalize_path.jam rename to v2/test/engine/builtin_normalize_path.jam diff --git a/v2/engine/test/builtin_shell.jam b/v2/test/engine/builtin_shell.jam similarity index 100% rename from v2/engine/test/builtin_shell.jam rename to v2/test/engine/builtin_shell.jam diff --git a/v2/engine/test/builtin_w32_getregnames.jam b/v2/test/engine/builtin_w32_getregnames.jam similarity index 100% rename from v2/engine/test/builtin_w32_getregnames.jam rename to v2/test/engine/builtin_w32_getregnames.jam diff --git a/v2/engine/test/option_d2.jam b/v2/test/engine/option_d2.jam similarity index 100% rename from v2/engine/test/option_d2.jam rename to v2/test/engine/option_d2.jam diff --git a/v2/engine/test/option_l.jam b/v2/test/engine/option_l.jam similarity index 100% rename from v2/engine/test/option_l.jam rename to v2/test/engine/option_l.jam diff --git a/v2/engine/test/option_n.jam b/v2/test/engine/option_n.jam similarity index 100% rename from v2/engine/test/option_n.jam rename to v2/test/engine/option_n.jam diff --git a/v2/engine/test/parallel_actions.jam b/v2/test/engine/parallel_actions.jam similarity index 100% rename from v2/engine/test/parallel_actions.jam rename to v2/test/engine/parallel_actions.jam diff --git a/v2/engine/test/parallel_multifile_actions_1.jam b/v2/test/engine/parallel_multifile_actions_1.jam similarity index 100% rename from v2/engine/test/parallel_multifile_actions_1.jam rename to v2/test/engine/parallel_multifile_actions_1.jam diff --git a/v2/engine/test/parallel_multifile_actions_2.jam b/v2/test/engine/parallel_multifile_actions_2.jam similarity index 100% rename from v2/engine/test/parallel_multifile_actions_2.jam rename to v2/test/engine/parallel_multifile_actions_2.jam diff --git a/v2/engine/test/rule_param.jam b/v2/test/engine/rule_param.jam similarity index 100% rename from v2/engine/test/rule_param.jam rename to v2/test/engine/rule_param.jam diff --git a/v2/engine/test/stress_var_expand.jam b/v2/test/engine/stress_var_expand.jam similarity index 100% rename from v2/engine/test/stress_var_expand.jam rename to v2/test/engine/stress_var_expand.jam diff --git a/v2/engine/test/target_var.jam b/v2/test/engine/target_var.jam similarity index 100% rename from v2/engine/test/target_var.jam rename to v2/test/engine/target_var.jam diff --git a/v2/engine/test/test.bat b/v2/test/engine/test.bat similarity index 100% rename from v2/engine/test/test.bat rename to v2/test/engine/test.bat diff --git a/v2/engine/test/test.jam b/v2/test/engine/test.jam similarity index 100% rename from v2/engine/test/test.jam rename to v2/test/engine/test.jam diff --git a/v2/engine/test/test.sh b/v2/test/engine/test.sh similarity index 100% rename from v2/engine/test/test.sh rename to v2/test/engine/test.sh diff --git a/v2/engine/test/var_expand.jam b/v2/test/engine/var_expand.jam similarity index 100% rename from v2/engine/test/var_expand.jam rename to v2/test/engine/var_expand.jam diff --git a/v2/test/preprocessor.py b/v2/test/preprocessor.py new file mode 100755 index 000000000..9faa711b7 --- /dev/null +++ b/v2/test/preprocessor.py @@ -0,0 +1,53 @@ +#!/usr/bin/python + +# Copyright 2003 Vladimir Prus +# Copyright 2011 Steven Watanabe +# 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) + +# Test the C/C++ preprocessor. + +import BoostBuild + +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ +project ; +preprocessed hello : hello.cpp ; +preprocessed a : a.c ; +exe hello.exe : hello a : FAIL ; +""") + +t.write("hello.cpp", """ +#ifndef __cplusplus +#error "This file must be compiled as C++" +#endif +#ifdef FAIL +#error "Not preprocessed?" +#endif +extern "C" int foo(); +int main() { return foo(); } +""") + +t.write("a.c", """ +/* This will not compile unless in C mode. */ +#ifdef __cplusplus +#error "This file must be compiled as C" +#endif +#ifdef FAIL +#error "Not preprocessed?" +#endif +int foo() +{ + int new = 0; + new = (new+1)*7; + return new; +} +""") + +t.run_build_system() +t.expect_addition("bin/$toolset/debug/hello.ii") +t.expect_addition("bin/$toolset/debug/a.i") +t.expect_addition("bin/$toolset/debug/hello.exe") + +t.cleanup() diff --git a/v2/tools/boostbook.jam b/v2/tools/boostbook.jam index 0c4c0ca68..3a5964c62 100644 --- a/v2/tools/boostbook.jam +++ b/v2/tools/boostbook.jam @@ -7,6 +7,23 @@ # This module defines rules to handle generation of documentation # from BoostBook sources. +# +# The type of output is controlled by the feature which can +# have the following values:: +# +# * html: Generates html documention. This is the default. +# * xhtml: Generates xhtml documentation +# * htmlhelp: Generates html help output. +# * onehtml: Generates a single html page. +# * man: Generates man pages. +# * pdf: Generates pdf documentation. +# * ps: Generates postscript output. +# * docbook: Generates docbook XML. +# * fo: Generates XSL formating objects. +# * tests: Extracts test cases from the boostbook XML. +# +# format is an implicit feature, so typing pdf on the command +# line (for example) is a short-cut for format=pdf. import "class" : new ; import common ; @@ -55,26 +72,28 @@ type.register TESTS : tests ; type.register BOOSTBOOK_MAIN ; -# Initialize BoostBook support. The parameters are: -# docbook-xsl-dir: The DocBook XSL stylesheet directory. If not provided, -# we use DOCBOOK_XSL_DIR from the environment (if available) or look in -# standard locations. Otherwise, we let the XML processor load the -# stylesheets remotely. -# -# docbook-dtd-dir: The DocBook DTD directory. If not provided, we use -# DOCBOOK_DTD_DIR From the environment (if available) or look in -# standard locations. Otherwise, we let the XML processor load the -# DTD remotely. -# -# boost-book-dir: The BoostBook directory with the DTD and XSL subdirs. -# -rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) +# Initialize BoostBook support. +rule init ( + docbook-xsl-dir ? # The DocBook XSL stylesheet directory. If not + # provided, we use DOCBOOK_XSL_DIR from the environment + # (if available) or look in standard locations. + # Otherwise, we let the XML processor load the + # stylesheets remotely. + + : docbook-dtd-dir ? # The DocBook DTD directory. If not provided, we use + # DOCBOOK_DTD_DIR From the environment (if available) or + # look in standard locations. Otherwise, we let the XML + # processor load the DTD remotely. + + : boostbook-dir ? # The BoostBook directory with the DTD and XSL subdirs. +) { if ! $(.initialized) { .initialized = true ; + check-boostbook-dir $(boostbook-dir) ; find-tools $(docbook-xsl-dir) : $(docbook-dtd-dir) : $(boostbook-dir) ; # Register generators only if we've were called via "using boostbook ; " @@ -90,7 +109,53 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) # The same about Jamfile main target rules. IMPORT $(__name__) : boostbook : : boostbook ; - } + } + else + { + if $(docbook-xsl-dir) + { + modify-config ; + .docbook-xsl-dir = [ path.make $(docbook-xsl-dir) ] ; + check-docbook-xsl-dir ; + } + if $(docbook-dtd-dir) + { + modify-config ; + .docbook-dtd-dir = [ path.make $(docbook-dtd-dir) ] ; + check-docbook-dtd-dir ; + } + if $(boostbook-dir) + { + modify-config ; + check-boostbook-dir $(boostbook-dir) ; + local boostbook-xsl-dir = [ path.glob $(boostbook-dir) : xsl ] ; + local boostbook-dtd-dir = [ path.glob $(boostbook-dir) : dtd ] ; + .boostbook-xsl-dir = $(boostbook-xsl-dir[1]) ; + .boostbook-dtd-dir = $(boostbook-dtd-dir[1]) ; + check-boostbook-xsl-dir ; + check-boostbook-dtd-dir ; + } + } +} + +rule lock-config ( ) +{ + if ! $(.initialized) + { + errors.user-error "BoostBook has not been configured." ; + } + if ! $(.config-locked) + { + .config-locked = true ; + } +} + +rule modify-config ( ) +{ + if $(.config-locked) + { + errors.user-error "BoostBook configuration cannot be changed after it has been used." ; + } } rule find-boost-in-registry ( keys * ) @@ -109,6 +174,88 @@ rule find-boost-in-registry ( keys * ) return $(boost-root) ; } +rule check-docbook-xsl-dir ( ) +{ + if $(.docbook-xsl-dir) + { + if ! [ path.glob $(.docbook-xsl-dir) : common/common.xsl ] + { + errors.user-error "BoostBook: could not find docbook XSL stylesheets in:" [ path.native $(.docbook-xsl-dir) ] ; + } + else + { + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice: BoostBook: found docbook XSL stylesheets in:" [ path.native $(.docbook-xsl-dir) ] ; + } + } + } +} + +rule check-docbook-dtd-dir ( ) +{ + if $(.docbook-dtd-dir) + { + if ! [ path.glob $(.docbook-dtd-dir) : docbookx.dtd ] + { + errors.user-error "error: BoostBook: could not find docbook DTD in:" [ path.native $(.docbook-dtd-dir) ] ; + } + else + { + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice: BoostBook: found docbook DTD in:" [ path.native $(.docbook-dtd-dir) ] ; + } + } + } +} + +rule check-boostbook-xsl-dir ( ) +{ + if ! $(.boostbook-xsl-dir) + { + errors.user-error "error: BoostBook: could not find boostbook XSL stylesheets." ; + } + else if ! [ path.glob $(.boostbook-xsl-dir) : docbook.xsl ] + { + errors.user-error "error: BoostBook: could not find docbook XSL stylesheets in:" [ path.native $(.boostbook-xsl-dir) ] ; + } + else + { + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice: BoostBook: found boostbook XSL stylesheets in:" [ path.native $(.boostbook-xsl-dir) ] ; + } + } +} + +rule check-boostbook-dtd-dir ( ) +{ + if ! $(.boostbook-dtd-dir) + { + errors.user-error "error: BoostBook: could not find boostbook DTD." ; + } + else if ! [ path.glob $(.boostbook-dtd-dir) : boostbook.dtd ] + { + errors.user-error "error: BoostBook: could not find boostbook DTD in:" [ path.native $(.boostbook-dtd-dir) ] ; + } + else + { + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice: BoostBook: found boostbook DTD in:" [ path.native $(.boostbook-dtd-dir) ] ; + } + } +} + +rule check-boostbook-dir ( boostbook-dir ? ) +{ + if $(boostbook-dir) && ! [ path.glob $(boostbook-dir) : xsl ] + { + errors.user-error "error: BoostBook: could not find boostbook in:" [ path.native $(boostbook-dir) ] ; + } +} + rule find-tools ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) { docbook-xsl-dir ?= [ modules.peek : DOCBOOK_XSL_DIR ] ; @@ -216,101 +363,88 @@ rule find-tools ( docbook-xsl-dir ? : docbook-dtd-dir ? : boostbook-dir ? ) .boostbook-xsl-dir = $(boostbook-xsl-dir[1]) ; .boostbook-dtd-dir = $(boostbook-dtd-dir[1]) ; - if --debug-configuration in [ modules.peek : ARGV ] - { - if $(.docbook-xsl-dir) - { - ECHO "notice: Boost.Book: found docbook XSL stylesheets in:" [ path.native $(.docbook-xsl-dir) ] ; - } - if $(.docbook-dtd-dir) - { - ECHO "notice: Boost.Book: found docbook DTD in:" [ path.native $(.docbook-dtd-dir) ] ; - } - if $(.boostbook-xsl-dir) - { - ECHO "notice: Boost.Book: found boostbook XSL stylesheets in:" [ path.native $(.boostbook-xsl-dir) ] ; - } - if $(.boostbook-dtd-dir) - { - ECHO "notice: Boost.Book: found boostbook DTD in:" [ path.native $(.boostbook-dtd-dir) ] ; - } - } - - if ! $(.boostbook-xsl-dir) || ! $(.boostbook-dtd-dir) - { - errors.warning - "couldn't find BoostBook xsl or dtd directories;" - : please set \"BOOST_ROOT\" variable to the root directory of - your boost installation. Searched in: - : $(boostbook-dir:J=" -") ; - } + check-docbook-xsl-dir ; + check-docbook-dtd-dir ; + check-boostbook-xsl-dir ; + check-boostbook-dtd-dir ; } rule xsl-dir { + lock-config ; return $(.boostbook-xsl-dir) ; } rule dtd-dir { + lock-config ; return $(.boostbook-dtd-dir) ; } rule docbook-xsl-dir { + lock-config ; return $(.docbook-xsl-dir) ; } rule docbook-dtd-dir { + lock-config ; return $(.docbook-dtd-dir) ; } rule dtdxml-to-boostbook ( target : source : properties * ) { + lock-config ; xslt $(target) : $(source) "$(.boostbook-xsl-dir)/dtd/dtd2boostbook.xsl" : $(properties) ; } rule boostbook-to-docbook ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/docbook.xsl ] ; xslt $(target) : $(source) $(stylesheet) : $(properties) ; } rule docbook-to-onehtml ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/html-single.xsl ] ; xslt $(target) : $(source) $(stylesheet) : $(properties) ; } rule docbook-to-htmldir ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/html.xsl ] ; xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : html ; } rule docbook-to-xhtmldir ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/xhtml.xsl ] ; xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : xhtml ; } rule docbook-to-htmlhelp ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/html-help.xsl ] ; xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : htmlhelp ; } rule docbook-to-manpages ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/manpages.xsl ] ; xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : man ; } rule docbook-to-fo ( target : source : properties * ) { + lock-config ; local stylesheet = [ path.native $(.boostbook-xsl-dir)/fo.xsl ] ; xslt $(target) : $(source) $(stylesheet) : $(properties) ; } @@ -527,6 +661,7 @@ class boostbook-generator : generator generators.register [ new boostbook-generator boostbook.main : : BOOSTBOOK_MAIN ] ; +# Creates a boostbook target. rule boostbook ( target-name : sources * : requirements * : default-build * ) { local project = [ project.current ] ; @@ -577,11 +712,9 @@ class xinclude-scanner : scanner scanner.register xinclude-scanner : xsl:path ; type.set-scanner XML : xinclude-scanner ; -############################################################################# -# Testsuite handling -############################################################################# rule boostbook-to-tests ( target : source : properties * ) { + lock-config ; local boost_root = [ modules.peek : BOOST_ROOT ] ; local native-path = [ path.native [ path.join $(.boostbook-xsl-dir) testing Jamfile ] ] ; diff --git a/v2/tools/builtin.jam b/v2/tools/builtin.jam index 5ad05b311..d1351a423 100644 --- a/v2/tools/builtin.jam +++ b/v2/tools/builtin.jam @@ -26,6 +26,7 @@ import stage ; import symlink ; import toolset ; import type ; +import targets ; import types/register ; import utility ; import virtual-target ; @@ -603,6 +604,48 @@ generators.register generators.override builtin.prebuilt : builtin.lib-generator ; +class preprocessed-target-class : basic-target +{ + import generators ; + rule construct ( name : sources * : property-set ) + { + local result = [ generators.construct [ project ] + $(name) : PREPROCESSED_CPP : $(property-set) : $(sources) ] ; + if ! $(result) + { + result = [ generators.construct [ project ] + $(name) : PREPROCESSED_C : $(property-set) : $(sources) ] ; + } + if ! $(result) + { + local s ; + for x in $(sources) + { + s += [ $(x).name ] ; + } + local p = [ project ] ; + errors.user-error + "In project" [ $(p).name ] : + "Could not construct preprocessed file \"$(name)\" from $(s:J=, )." ; + } + return $(result) ; + } +} + +rule preprocessed ( name : sources * : requirements * : default-build * : + usage-requirements * ) +{ + local project = [ project.current ] ; + return [ targets.main-target-alternative + [ new preprocessed-target-class $(name) : $(project) + : [ targets.main-target-sources $(sources) : $(name) ] + : [ targets.main-target-requirements $(r) : $(project) ] + : [ targets.main-target-default-build $(default-build) : $(project) ] + : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ] + ] ] ; +} + +IMPORT $(__name__) : preprocessed : : preprocessed ; class compile-action : action { diff --git a/v2/tools/clang-linux.jam b/v2/tools/clang-linux.jam index 00ebd1c27..036d749e6 100644 --- a/v2/tools/clang-linux.jam +++ b/v2/tools/clang-linux.jam @@ -1,4 +1,5 @@ -# Copyright (c) 2003 Michael Stevens +# Copyright (c) 2003 Michael Stevens +# Copyright (c) 2010-2011 Bryce Lelbach (blelbach@cct.lsu.edu, maintainer) # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE_1_0.txt or @@ -19,7 +20,8 @@ import numbers ; feature.extend-subfeature toolset clang : platform : linux ; toolset.inherit-generators clang-linux - clang linux : gcc : gcc.mingw.link gcc.mingw.link.dll gcc.cygwin.link gcc.cygwin.link.dll ; + clang linux : gcc + : gcc.mingw.link gcc.mingw.link.dll gcc.cygwin.link gcc.cygwin.link.dll ; generators.override clang-linux.prebuilt : builtin.lib-generator ; generators.override clang-linux.prebuilt : builtin.prebuilt ; generators.override clang-linux.searched-lib-generator : searched-lib-generator ; @@ -28,53 +30,50 @@ generators.override clang-linux.searched-lib-generator : searched-lib-generator generators.override clang-linux.compile.c.pch : pch.default-c-pch-generator ; generators.override clang-linux.compile.c++.pch : pch.default-cpp-pch-generator ; -type.set-generated-target-suffix PCH : clang linux : pchi ; +type.set-generated-target-suffix PCH + : clang linux : pth ; toolset.inherit-rules clang-linux : gcc ; toolset.inherit-flags clang-linux : gcc - : off on full - space speed - off all on - ; + : off on full + space speed + off all on ; -if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] -{ - .debug-configuration = true ; +if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] { + .debug-configuration = true ; } -# Initializes the clang-linux toolset -# version in optional -# name (default clang++) is used to invoke the specified clanglinux complier -# compile and link options allow you to specify addition command line options for each version -rule init ( version ? : command * : options * ) -{ - command = [ common.get-invocation-command clang-linux : clang++ - : $(command) ] ; +rule init ( version ? : command * : options * ) { + command = [ common.get-invocation-command clang-linux : clang++ + : $(command) ] ; - # Determine the version - local command-string = $(command:J=" ") ; - if $(command) - { - version ?= [ MATCH "^([0-9.]+)" - : [ SHELL "$(command-string) -dumpversion" ] ] ; - } + # Determine the version + local command-string = $(command:J=" ") ; - local condition = [ common.check-init-parameters clang-linux - : version $(version) ] ; - - common.handle-options clang-linux : $(condition) : $(command) : $(options) ; + if $(command) { + version ?= [ MATCH "version ([0-9.]+)" + : [ SHELL "$(command-string) --version" ] ] ; + } - gcc.init-link-flags clang-linux gnu $(condition) ; + local condition = [ common.check-init-parameters clang-linux + : version $(version) ] ; + common.handle-options clang-linux : $(condition) : $(command) : $(options) ; + + gcc.init-link-flags clang-linux gnu $(condition) ; } -SPACE = " " ; +############################################################################### +# Flags + +toolset.flags clang-linux.compile OPTIONS ; +toolset.flags clang-linux.compile OPTIONS ; -# Declare flags and action for compilation. toolset.flags clang-linux.compile OPTIONS off : ; toolset.flags clang-linux.compile OPTIONS speed : -O3 ; toolset.flags clang-linux.compile OPTIONS space : -Os ; +# note: clang silently ignores some of these inlining options toolset.flags clang-linux.compile OPTIONS off : -fno-inline ; toolset.flags clang-linux.compile OPTIONS on : -Wno-inline ; toolset.flags clang-linux.compile OPTIONS full : -finline-functions -Wno-inline ; @@ -85,89 +84,113 @@ toolset.flags clang-linux.compile OPTIONS all : -Wall -pedantic ; toolset.flags clang-linux.compile OPTIONS on : -Werror ; toolset.flags clang-linux.compile OPTIONS on : -g ; -toolset.flags clang-linux.compile OPTIONS on : ; +toolset.flags clang-linux.compile OPTIONS on : -pg ; toolset.flags clang-linux.compile OPTIONS off : -fno-rtti ; -rule compile.c++ ( targets * : sources * : properties * ) -{ - gcc.setup-threading $(targets) : $(sources) : $(properties) ; - gcc.setup-fpic $(targets) : $(sources) : $(properties) ; - gcc.setup-address-model $(targets) : $(sources) : $(properties) ; - DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; +############################################################################### +# C and C++ compilation + +rule compile.c++ ( targets * : sources * : properties * ) { + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; + + local pth-file = [ on $(<) return $(PCH_FILE) ] ; + + if $(pth-file) { + DEPENDS $(<) : $(pth-file) ; + compile.c++.with-pch $(targets) : $(sources) ; + } + else { + compile.c++.without-pth $(targets) : $(sources) ; + } } -actions compile.c++ bind PCH_FILE +actions compile.c++.without-pth { + "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" +} + +actions compile.c++.with-pch bind PCH_FILE { - "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pth -Xclang "$(PCH_FILE)" -o "$(<)" "$(>)" } rule compile.c ( targets * : sources * : properties * ) { - gcc.setup-threading $(targets) : $(sources) : $(properties) ; - gcc.setup-fpic $(targets) : $(sources) : $(properties) ; - gcc.setup-address-model $(targets) : $(sources) : $(properties) ; - DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; + + local pth-file = [ on $(<) return $(PCH_FILE) ] ; + + if $(pth-file) { + DEPENDS $(<) : $(pth-file) ; + compile.c.with-pch $(targets) : $(sources) ; + } + else { + compile.c.without-pth $(targets) : $(sources) ; + } } -actions compile.c bind PCH_FILE +actions compile.c.without-pth { - "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } -rule compile.c++.pch ( targets * : sources * : properties * ) +actions compile.c.with-pch bind PCH_FILE { - gcc.setup-threading $(targets) : $(sources) : $(properties) ; - gcc.setup-fpic $(targets) : $(sources) : $(properties) ; - gcc.setup-address-model $(targets) : $(sources) : $(properties) ; -} -# -# Compiling a pch first deletes any existing *.pchi file, as Clang's compiler -# won't over-write an existing pch: instead it creates filename$1.pchi, filename$2.pchi -# etc - which appear not to do anything except take up disk space :-( -# -actions compile.c++.pch -{ - rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -pch-create "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pth -Xclang "$(PCH_FILE)" -c -o "$(<)" "$(>)" } -rule compile.c.pch ( targets * : sources * : properties * ) -{ - gcc.setup-threading $(targets) : $(sources) : $(properties) ; - gcc.setup-fpic $(targets) : $(sources) : $(properties) ; - gcc.setup-address-model $(targets) : $(sources) : $(properties) ; +############################################################################### +# PCH emission + +rule compile.c++.pch ( targets * : sources * : properties * ) { + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; +} + +actions compile.c++.pch { + rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)" "$(>)" +} + +rule compile.c.pch ( targets * : sources * : properties * ) { + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; } actions compile.c.pch { - rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -pch-create "$(<)" "$(>)" + rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)" "$(>)" } -rule link ( targets * : sources * : properties * ) -{ - gcc.setup-threading $(targets) : $(sources) : $(properties) ; - gcc.setup-address-model $(targets) : $(sources) : $(properties) ; - SPACE on $(targets) = " " ; - JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; +############################################################################### +# Linking + +SPACE = " " ; + +rule link ( targets * : sources * : properties * ) { + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; + SPACE on $(targets) = " " ; + JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; } -actions link bind LIBRARIES -{ - "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) $(USER_OPTIONS) +actions link bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) $(USER_OPTIONS) } -rule link.dll ( targets * : sources * : properties * ) -{ - gcc.setup-threading $(targets) : $(sources) : $(properties) ; - gcc.setup-address-model $(targets) : $(sources) : $(properties) ; - SPACE on $(targets) = " " ; - JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; +rule link.dll ( targets * : sources * : properties * ) { + gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; + SPACE on $(targets) = " " ; + JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; } # Differ from 'link' above only by -shared. -actions link.dll bind LIBRARIES -{ - "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) $(USER_OPTIONS) +actions link.dll bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) $(USER_OPTIONS) } - - diff --git a/v2/tools/darwin.jam b/v2/tools/darwin.jam index 703803ad5..283dface9 100644 --- a/v2/tools/darwin.jam +++ b/v2/tools/darwin.jam @@ -254,6 +254,22 @@ local rule init-sdk ( condition * : root ? : version + : version-feature ? ) # Then device variation options. switch $(version[1]) { + case iphonesim* : + { + local N = $(version[2]) ; + if ! $(version[3]) { N += 00 ; } + else if [ regex.match (..) : $(version[3]) ] { N += $(version[3]) ; } + else { N += 0$(version[3]) ; } + if ! $(version[4]) { N += 00 ; } + else if [ regex.match (..) : $(version[4]) ] { N += $(version[4]) ; } + else { N += 0$(version[4]) ; } + N = $(N:J=) ; + flags darwin.compile OPTIONS $(version-feature) + : -D__IPHONE_OS_VERSION_MIN_REQUIRED=$(N) ; + flags darwin.link OPTIONS $(version-feature) + : -D__IPHONE_OS_VERSION_MIN_REQUIRED=$(N) ; + } + case iphone* : { flags darwin.compile OPTIONS $(version-feature) @@ -482,7 +498,8 @@ flags darwin.link OPTIONS space : -Wl,-dead_strip -no_dead_strip_i flags darwin.compile OPTIONS shared : -dynamic ; # Misc options. -flags darwin.compile OPTIONS : -no-cpp-precomp -gdwarf-2 ; +flags darwin.compile OPTIONS : -no-cpp-precomp -gdwarf-2 -fexceptions ; +#~ flags darwin.link OPTIONS : -fexceptions ; # Add the framework names to use. flags darwin.link FRAMEWORK ; diff --git a/v2/tools/doxygen.jam b/v2/tools/doxygen.jam index ebc9f017b..8394848dd 100644 --- a/v2/tools/doxygen.jam +++ b/v2/tools/doxygen.jam @@ -38,6 +38,7 @@ import common ; import modules ; import project ; import utility ; +import errors ; # Use to specify extra configuration paramters. These get translated @@ -95,60 +96,6 @@ rule init ( name ? ) { .initialized = true ; - if ! $(name) - { - local doxygen-path ; - - if [ os.name ] = NT - { - local ProgramFiles = [ modules.peek : ProgramFiles ] ; - if $(ProgramFiles) - { - ProgramFiles = "$(ProgramFiles:J= )" ; - } - else - { - ProgramFiles = "C:\\Program Files" ; - } - - doxygen-path = - [ GLOB - [ modules.peek : PATH ] - "$(ProgramFiles)\\doxygen\\bin" - : doxygen\.exe ] ; - } - else - { - doxygen-path = - [ GLOB - [ modules.peek : PATH ] - : doxygen ] ; - } - - doxygen-path = $(doxygen-path[1]) ; - - if $(doxygen-path) - { - .doxygen = $(doxygen-path) ; - } - - .doxygen ?= doxygen ; - } - else - { - .doxygen = $(name) ; - } - - if --debug-configuration in [ modules.peek : ARGV ] - { - ECHO "notice:" using doxygen ":" $(.doxygen) ; - } - - if [ .is-cygwin ] - { - .is-cygwin = true ; - } - .doxproc = [ modules.binding $(__name__) ] ; .doxproc = $(.doxproc:D)/doxproc.py ; @@ -171,11 +118,71 @@ rule init ( name ? ) IMPORT $(__name__) : doxygen : : doxygen ; } + + if $(name) + { + modify-config ; + .doxygen = $(name) ; + check-doxygen ; + } + + if ! $(.doxygen) + { + check-doxygen ; + } } +rule freeze-config ( ) +{ + if ! $(.initialized) + { + errors.user-error "doxygen must be initialized before it can be used." ; + } + if ! $(.config-frozen) + { + .config-frozen = true ; + + if [ .is-cygwin ] + { + .is-cygwin = true ; + } + } +} + +rule modify-config ( ) +{ + if $(.config-frozen) + { + errors.user-error "Cannot change doxygen after it has been used." ; + } +} + +rule check-doxygen ( ) +{ + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice:" using doxygen ":" $(.doxygen) ; + } + local extra-paths ; + if [ os.name ] = NT + { + local ProgramFiles = [ modules.peek : ProgramFiles ] ; + if $(ProgramFiles) + { + extra-paths = "$(ProgramFiles:J= )" ; + } + else + { + extra-paths = "C:\\Program Files" ; + } + } + .doxygen = [ common.get-invocation-command doxygen : + doxygen : $(.doxygen) : $(extra-paths) ] ; +} rule name ( ) { + freeze-config ; return $(.doxygen) ; } @@ -219,6 +226,7 @@ actions doxproc rule translate-path ( path ) { + freeze-config ; if [ os.on-windows ] { if [ os.name ] = CYGWIN @@ -311,6 +319,7 @@ rule headers-to-doxyfile ( target : sources * : properties * ) # rule run ( target : source : properties * ) { + freeze-config ; if on in $(properties) { local output-dir = @@ -602,6 +611,7 @@ targets.main-target-alternative # rule doxygen ( target : sources * : requirements * : default-build * : usage-requirements * ) { + freeze-config ; local project = [ project.current ] ; if $(target:S) = .html diff --git a/v2/tools/fop.jam b/v2/tools/fop.jam index ed0255502..c24b8725f 100644 --- a/v2/tools/fop.jam +++ b/v2/tools/fop.jam @@ -6,100 +6,64 @@ # This module defines rules to handle generation of PDF and # PostScript files from XSL Formatting Objects via Apache FOP -import os ; import generators ; import common ; -import errors ; import boostbook ; generators.register-standard fop.render.pdf : FO : PDF ; generators.register-standard fop.render.ps : FO : PS ; +# Initializes the fop toolset. +# rule init ( fop-command ? : java-home ? : java ? ) { - fop-command = [ common.get-invocation-command fop : fop : $(fop-command) - : [ modules.peek : FOP_DIR ] ] ; - - .FOP_COMMAND = $(fop-command) ; - .FOP_SETUP = ; - - # JAVA_HOME is the location that java was installed to. - - if $(java-home) + local has-command = $(.has-command) ; + + if $(fop-command) { - .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ; + .has-command = true ; } - # JAVACMD is the location that of the java executable, useful for a - # non-standard java installation, where the executable isn't at - # $JAVA_HOME/bin/java. - - if $(java) + if $(fop-command) || ! $(has-command) { - .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ; + fop-command = [ common.get-invocation-command fop : fop : $(fop-command) + : [ modules.peek : FOP_DIR ] ] ; } - # Make sure the fop command is executed from within the directory where it's located. - - # DPG: I can't see how this could ever be correct, because it - # messes up path names that are used in the command. - - # if $(.FOP_COMMAND:D) - # { - # .FOP_SETUP = $(.FOP_SETUP)" -# cd "$(.FOP_COMMAND:D) ; - # } - -} - -local rule find-by-absolute-path ( target ) -{ - # Mask off any vars by these names that may be hanging around in - # outer dynamic scopes. - local LOCATE SEARCH ; - - # simulate the target binding process to find the target - - local found = [ on $(target) GLOB $(LOCATE) (SEARCH) : $(target:G=) ] ; - - if $(found) + if $(fop-command) { - # Re-LOCATE the target with an absolute path if it isn't - # already absolute. - local found-dir = $(found[1]:D) ; - local cwd = [ PWD ] ; - local absolute-dir = $(found-dir:R=$(cwd)) ; - - # Translate cygwin paths to Windows iff the user is running on - # cygwin but using a Windows FOP. We detect a Windows FOP by - # looking to see if FOP_COMMAND ends with ".bat" - if [ os.name ] = CYGWIN && [ MATCH .*\\.([Bb][Aa][Tt])$ : $(.FOP_COMMAND) ] + .FOP_COMMAND = $(fop-command) ; + } + + if $(java-home) || $(java) + { + .FOP_SETUP = ; + + + # JAVA_HOME is the location that java was installed to. + + if $(java-home) { - absolute-dir = "`cygpath --windows '$(absolute-dir)'`" ; + .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ; + } + + # JAVACMD is the location that of the java executable, useful for a + # non-standard java installation, where the executable isn't at + # $JAVA_HOME/bin/java. + + if $(java) + { + .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ; } - LOCATE on $(target) = $(absolute-dir) ; } } -rule render.pdf ( source : target : properties * ) -{ - find-by-absolute-path $(source) ; - find-by-absolute-path $(target) ; -} - -rule render.ps ( source : target : properties * ) -{ - find-by-absolute-path $(source) ; - find-by-absolute-path $(target) ; -} - - actions render.pdf { - $(.FOP_SETUP) $(.FOP_COMMAND) $(>) $(<) + $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) $(<) } actions render.ps { - $(.FOP_SETUP) $(.FOP_COMMAND) $(>) -ps $(<) + $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) -ps $(<) } diff --git a/v2/tools/gcc.jam b/v2/tools/gcc.jam index 9cdcd1e51..f7b0da542 100644 --- a/v2/tools/gcc.jam +++ b/v2/tools/gcc.jam @@ -284,6 +284,8 @@ if [ os.name ] = NT JAMSHELL = % ; } +generators.register-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : gcc ; +generators.register-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : gcc ; generators.register-c-compiler gcc.compile.c++ : CPP : OBJ : gcc ; generators.register-c-compiler gcc.compile.c : C : OBJ : gcc ; generators.register-c-compiler gcc.compile.asm : ASM : OBJ : gcc ; @@ -507,6 +509,37 @@ actions compile.c.pch "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } +rule compile.c++.preprocess ( targets * : sources * : properties * ) +{ + setup-threading $(targets) : $(sources) : $(properties) ; + setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; + + # Some extensions are compiled as C++ by default. For others, we need to + # pass -x c++. We could always pass -x c++ but distcc does not work with it. + if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C + { + LANG on $(<) = "-x c++" ; + } + DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; +} + +rule compile.c.preprocess ( targets * : sources * : properties * ) +{ + setup-threading $(targets) : $(sources) : $(properties) ; + setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; + + # If we use the name g++ then default file suffix -> language mapping does + # not work. So have to pass -x option. Maybe, we can work around this by + # allowing the user to specify both C and C++ compiler names. + #if $(>:S) != .c + #{ + LANG on $(<) = "-x c" ; + #} + DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; +} + rule compile.c++ ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; @@ -570,13 +603,25 @@ actions compile.c bind PCH_FILE "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } +actions compile.c++.preprocess bind PCH_FILE +{ + "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)" +} + +actions compile.c.preprocess bind PCH_FILE +{ + "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>)" -E >$(<) +} + actions compile.fortran { "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } -rule compile.asm +rule compile.asm ( targets * : sources * : properties * ) { + setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; LANG on $(<) = "-x assembler-with-cpp" ; } diff --git a/v2/tools/intel-linux.jam b/v2/tools/intel-linux.jam index 06e11fe03..d9164add8 100644 --- a/v2/tools/intel-linux.jam +++ b/v2/tools/intel-linux.jam @@ -1,4 +1,5 @@ # Copyright (c) 2003 Michael Stevens +# Copyright (c) 2011 Bryce Lelbach # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE_1_0.txt or @@ -44,15 +45,55 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] # Initializes the intel-linux toolset # version in mandatory -# name (default icc) is used to invoke the specified intellinux complier +# name (default icpc) is used to invoke the specified intel-linux complier # compile and link options allow you to specify addition command line options for each version rule init ( version ? : command * : options * ) { local condition = [ common.check-init-parameters intel-linux : version $(version) ] ; + if $(.debug-configuration) + { + ECHO "notice: intel-linux version is" $(version) ; + } + + local default_path ; + + # Intel C++ Composer XE 2011 for Linux, aka Intel C++ Compiler XE 12.0, + # aka intel-linux-12.0. In this version, Intel thankfully decides to install + # to a sane 'intel' folder in /opt. + if [ MATCH "(12[.]0|12)" : $(version) ] + { default_path = /opt/intel/bin ; } + # Intel C++ Compiler 11.1. + else if [ MATCH "(11[.]1)" : $(version) ] + { default_path = /opt/intel_cce_11.1.064.x86_64/bin ; } + # Intel C++ Compiler 11.0. + else if [ MATCH "(11[.]0|11)" : $(version) ] + { default_path = /opt/intel_cce_11.0.074.x86_64/bin ; } + # Intel C++ Compiler 10.1. + else if [ MATCH "(10[.]1)" : $(version) ] + { default_path = /opt/intel_cce_10.1.013_x64/bin ; } + # Intel C++ Compiler 9.1. + else if [ MATCH "(9[.]1)" : $(version) ] + { default_path = /opt/intel_cc_91/bin ; } + # Intel C++ Compiler 9.0. + else if [ MATCH "(9[.]0|9)" : $(version) ] + { default_path = /opt/intel_cc_90/bin ; } + # Intel C++ Compiler 8.1. + else if [ MATCH "(8[.]1)" : $(version) ] + { default_path = /opt/intel_cc_81/bin ; } + # Intel C++ Compiler 8.0 - this used to be the default, so now it's the + # fallback. + else + { default_path = /opt/intel_cc_80/bin ; } + + if $(.debug-configuration) + { + ECHO "notice: default search path for intel-linux is" $(default_path) ; + } + command = [ common.get-invocation-command intel-linux : icpc - : $(command) : /opt/intel_cc_80/bin ] ; + : $(command) : $(default_path) ] ; common.handle-options intel-linux : $(condition) : $(command) : $(options) ; @@ -77,12 +118,24 @@ rule init ( version ? : command * : options * ) flags intel-linux.compile OPTIONS $(condition)/off : "-Ob0" ; flags intel-linux.compile OPTIONS $(condition)/on : "-Ob1" ; flags intel-linux.compile OPTIONS $(condition)/full : "-Ob2" ; + flags intel-linux.compile OPTIONS $(condition)/space : "-O1" ; + flags intel-linux.compile OPTIONS $(condition)/speed : "-O3 -ip" ; } - else + else if $(major) && [ numbers.less $(major) 11 ] + { + flags intel-linux.compile OPTIONS $(condition)/off : "-inline-level=0" ; + flags intel-linux.compile OPTIONS $(condition)/on : "-inline-level=1" ; + flags intel-linux.compile OPTIONS $(condition)/full : "-inline-level=2" ; + flags intel-linux.compile OPTIONS $(condition)/space : "-O1" ; + flags intel-linux.compile OPTIONS $(condition)/speed : "-O3 -ip" ; + } + else # newer version of intel do have -Os (at least 11+, don't know about 10) { flags intel-linux.compile OPTIONS $(condition)/off : "-inline-level=0" ; flags intel-linux.compile OPTIONS $(condition)/on : "-inline-level=1" ; flags intel-linux.compile OPTIONS $(condition)/full : "-inline-level=2" ; + flags intel-linux.compile OPTIONS $(condition)/space : "-Os" ; + flags intel-linux.compile OPTIONS $(condition)/speed : "-O3 -ip" ; } if $(root) @@ -103,9 +156,6 @@ rule init ( version ? : command * : options * ) SPACE = " " ; -flags intel-linux.compile OPTIONS space : "-O1" ; # no specific space optimization flag in icc -flags intel-linux.compile OPTIONS speed : "-O3 -ip" ; # no specific space optimization flag in icc - flags intel-linux.compile OPTIONS off : -w0 ; flags intel-linux.compile OPTIONS on : -w1 ; flags intel-linux.compile OPTIONS all : -w2 ; @@ -174,7 +224,7 @@ rule link ( targets * : sources * : properties * ) gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-address-model $(targets) : $(sources) : $(properties) ; SPACE on $(targets) = " " ; - JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; + JAM_SEMAPHORE on $(targets) = intel-linux-link-semaphore ; } actions link bind LIBRARIES @@ -187,7 +237,7 @@ rule link.dll ( targets * : sources * : properties * ) gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-address-model $(targets) : $(sources) : $(properties) ; SPACE on $(targets) = " " ; - JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; + JAM_SEMAPHORE on $(targets) = intel-linux-link-semaphore ; } # Differ from 'link' above only by -shared. diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index a7731cb54..e33a66d22 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -325,6 +325,14 @@ rule compile.c ( targets + : sources * : properties * ) } +rule compile.c.preprocess ( targets + : sources * : properties * ) +{ + C++FLAGS on $(targets[1]) = ; + get-rspline $(targets) : -TC ; + preprocess-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; +} + + rule compile.c.pch ( targets + : sources * : properties * ) { C++FLAGS on $(targets[1]) = ; @@ -363,6 +371,11 @@ actions compile-c-c++ bind PDB_NAME $(.CC) @"@($(<[1]:W).rsp:E="$(>[1]:W)" -Fo"$(<[1]:W)" $(PDB_CFLAG)"$(PDB_NAME)" -Yu"$(>[3]:D=)" -Fp"$(>[2]:W)" $(CC_RSPLINE))" $(.CC.FILTER) } +actions preprocess-c-c++ bind PDB_NAME +{ + $(.CC) @"@($(<[1]:W).rsp:E="$(>[1]:W)" -E $(PDB_CFLAG)"$(PDB_NAME)" -Yu"$(>[3]:D=)" -Fp"$(>[2]:W)" $(CC_RSPLINE))" >"$(<[1]:W)" +} + rule compile-c-c++ ( targets + : sources * ) { DEPENDS $(<[1]) : [ on $(<[1]) return $(PCH_HEADER) ] ; @@ -370,6 +383,13 @@ rule compile-c-c++ ( targets + : sources * ) PDB_NAME on $(<) = $(<:S=.pdb) ; } +rule preprocess-c-c++ ( targets + : sources * ) +{ + DEPENDS $(<[1]) : [ on $(<[1]) return $(PCH_HEADER) ] ; + DEPENDS $(<[1]) : [ on $(<[1]) return $(PCH_FILE) ] ; + PDB_NAME on $(<) = $(<:S=.pdb) ; +} + # Action for running the C/C++ compiler using precompiled headers. In addition # to whatever else it needs to compile, this action also adds a temporary source # .cpp file used to compile the precompiled headers themselves. @@ -397,6 +417,12 @@ rule compile.c++ ( targets + : sources * : properties * ) compile-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; } +rule compile.c++.preprocess ( targets + : sources * : properties * ) +{ + get-rspline $(targets) : -TP ; + preprocess-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ; +} + rule compile.c++.pch ( targets + : sources * : properties * ) { @@ -1110,6 +1136,8 @@ local rule register-toolset-really ( ) generators.register-archiver msvc.archive : OBJ : STATIC_LIB : msvc ; generators.register-c-compiler msvc.compile.c++ : CPP : OBJ : msvc ; generators.register-c-compiler msvc.compile.c : C : OBJ : msvc ; + generators.register-c-compiler msvc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : msvc ; + generators.register-c-compiler msvc.compile.c.preprocess : C : PREPROCESSED_C : msvc ; # Using 'register-c-compiler' adds the build directory to INCLUDES. generators.register-c-compiler msvc.compile.rc : RC : OBJ(%_res) : msvc ; diff --git a/v2/tools/pathscale.jam b/v2/tools/pathscale.jam index b5aa910d7..454e34547 100644 --- a/v2/tools/pathscale.jam +++ b/v2/tools/pathscale.jam @@ -161,7 +161,8 @@ actions link.dll bind LIBRARIES } # Declare action for creating static libraries +# "$(CONFIG_COMMAND)" -ar -o "$(<)" "$(>)" actions piecemeal archive { - "$(CONFIG_COMMAND)" -ar -o "$(<)" "$(>)" + ar $(ARFLAGS) ru "$(<)" "$(>)" } diff --git a/v2/tools/quickbook.jam b/v2/tools/quickbook.jam index 0b4e2bb62..6de2d42f8 100644 --- a/v2/tools/quickbook.jam +++ b/v2/tools/quickbook.jam @@ -112,7 +112,10 @@ import type ; import scanner ; import project ; import targets ; - +import build-system ; +import path ; +import common ; +import errors ; # The one and only QUICKBOOK type! type.register QUICKBOOK : qbk ; @@ -138,51 +141,23 @@ feature.feature : : free ; # class quickbook-binary-generator : generator { - import common modules path targets build-system ; + import modules path targets quickbook ; rule run ( project name ? : property-set : sources * : multiple ? ) { + quickbook.freeze-config ; # QuickBook invocation command and dependencies. - local quickbook-binary = [ modules.peek quickbook : .command ] ; + local quickbook-binary = [ modules.peek quickbook : .quickbook-binary ] ; local quickbook-binary-dependencies ; - if $(quickbook-binary) + if ! $(quickbook-binary) { - # Use user-supplied command. - quickbook-binary = [ common.get-invocation-command quickbook : quickbook : $(quickbook-binary) ] ; - } - else - { - # Search for QuickBook sources in sensible places, like - # $(BOOST_ROOT)/tools/quickbook - # $(BOOST_BUILD_PATH)/../../quickbook - - # And build quickbook executable from sources. - - local boost-root = [ modules.peek : BOOST_ROOT ] ; - local boost-build-path = [ build-system.location ] ; - - local quickbook-dir ; - - if $(boost-root) - { - quickbook-dir += [ path.join $(boost-root) tools ] ; - } - - if $(boost-build-path) - { - quickbook-dir += $(boost-build-path)/../.. ; - } - - quickbook-dir = [ path.glob $(quickbook-dir) : quickbook ] ; - # If the QuickBook source directory was found, mark its main target # as a dependency for the current project. Otherwise, try to find # 'quickbook' in user's PATH + local quickbook-dir = [ modules.peek quickbook : .quickbook-dir ] ; if $(quickbook-dir) { - quickbook-dir = [ path.make $(quickbook-dir[1]) ] ; - # Get the main-target in QuickBook directory. local quickbook-main-target = [ targets.resolve-reference $(quickbook-dir) : $(project) ] ; @@ -215,28 +190,6 @@ class quickbook-binary-generator : generator } } } - else - { - ECHO "QuickBook warning: The path to the quickbook executable was" ; - ECHO " not provided. Additionally, couldn't find QuickBook" ; - ECHO " sources searching in" ; - ECHO " * BOOST_ROOT/tools/quickbook" ; - ECHO " * BOOST_BUILD_PATH/../../quickbook" ; - ECHO " Will now try to find a precompiled executable by searching" ; - ECHO " the PATH for 'quickbook'." ; - ECHO " To disable this warning in the future, or to completely" ; - ECHO " avoid compilation of quickbook, you can explicitly set the" ; - ECHO " path to a quickbook executable command in user-config.jam" ; - ECHO " or site-config.jam with the call" ; - ECHO " using quickbook : /path/to/quickbook ;" ; - - # As a last resort, search for 'quickbook' command in path. Note - # that even if the 'quickbook' command is not found, - # get-invocation-command will still return 'quickbook' and might - # generate an error while generating the virtual-target. - - quickbook-binary = [ common.get-invocation-command quickbook : quickbook ] ; - } } # Add $(quickbook-binary-dependencies) as a dependency of the current @@ -284,13 +237,87 @@ rule init ( command ? # path to the QuickBook executable. ) { - if ! $(.initialized) + if $(command) { - .initialized = true ; + if $(.config-frozen) + { + errors.user-error "quickbook: configuration cannot be changed after it has been used." ; + } .command = $(command) ; } } +rule freeze-config ( ) +{ + if ! $(.config-frozen) + { + .config-frozen = true ; + + # QuickBook invocation command and dependencies. + + .quickbook-binary = $(.command) ; + + if $(.quickbook-binary) + { + # Use user-supplied command. + .quickbook-binary = [ common.get-invocation-command quickbook : quickbook : $(.quickbook-binary) ] ; + } + else + { + # Search for QuickBook sources in sensible places, like + # $(BOOST_ROOT)/tools/quickbook + # $(BOOST_BUILD_PATH)/../../quickbook + + # And build quickbook executable from sources. + + local boost-root = [ modules.peek : BOOST_ROOT ] ; + local boost-build-path = [ build-system.location ] ; + + if $(boost-root) + { + .quickbook-dir += [ path.join $(boost-root) tools ] ; + } + + if $(boost-build-path) + { + .quickbook-dir += $(boost-build-path)/../.. ; + } + + .quickbook-dir = [ path.glob $(.quickbook-dir) : quickbook ] ; + + # If the QuickBook source directory was found, mark its main target + # as a dependency for the current project. Otherwise, try to find + # 'quickbook' in user's PATH + if $(.quickbook-dir) + { + .quickbook-dir = [ path.make $(.quickbook-dir[1]) ] ; + } + else + { + ECHO "QuickBook warning: The path to the quickbook executable was" ; + ECHO " not provided. Additionally, couldn't find QuickBook" ; + ECHO " sources searching in" ; + ECHO " * BOOST_ROOT/tools/quickbook" ; + ECHO " * BOOST_BUILD_PATH/../../quickbook" ; + ECHO " Will now try to find a precompiled executable by searching" ; + ECHO " the PATH for 'quickbook'." ; + ECHO " To disable this warning in the future, or to completely" ; + ECHO " avoid compilation of quickbook, you can explicitly set the" ; + ECHO " path to a quickbook executable command in user-config.jam" ; + ECHO " or site-config.jam with the call" ; + ECHO " using quickbook : /path/to/quickbook ;" ; + + # As a last resort, search for 'quickbook' command in path. Note + # that even if the 'quickbook' command is not found, + # get-invocation-command will still return 'quickbook' and might + # generate an error while generating the virtual-target. + + .quickbook-binary = [ common.get-invocation-command quickbook : quickbook ] ; + } + } + } +} + generators.register [ new quickbook-binary-generator quickbook.quickbook-to-boostbook : QUICKBOOK : XML ] ; diff --git a/v2/tools/types/preprocessed.jam b/v2/tools/types/preprocessed.jam new file mode 100644 index 000000000..c9187ba67 --- /dev/null +++ b/v2/tools/types/preprocessed.jam @@ -0,0 +1,9 @@ +# Copyright Steven Watanabe 2011 +# Distributed under the Boost Software License Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import type ; + +type.register PREPROCESSED_C : i : C ; +type.register PREPROCESSED_CPP : ii : CPP ; diff --git a/v2/tools/xsltproc.jam b/v2/tools/xsltproc.jam index 900800a46..96f5170be 100644 --- a/v2/tools/xsltproc.jam +++ b/v2/tools/xsltproc.jam @@ -16,6 +16,7 @@ import common ; import os ; import modules ; import path ; +import errors ; feature.feature xsl:param : : free ; feature.feature xsl:path : : free ; @@ -27,26 +28,50 @@ feature.feature catalog : : free ; # rule init ( xsltproc ? ) { - if ! $(xsltproc) + if $(xsltproc) { - xsltproc = [ modules.peek : XSLTPROC ] ; - } - - if ! $(.initialized) - { - .initialized = true ; + modify-config ; .xsltproc = $(xsltproc) ; - .is-cygwin = [ .is-cygwin $(xsltproc:E=xsltproc) ] ; + check-xsltproc ; + } +} + +rule freeze-config ( ) +{ + if ! $(.config-frozen) + { + .config-frozen = true ; + .xsltproc ?= [ modules.peek : XSLTPROC ] ; + .xsltproc ?= xsltproc ; + check-xsltproc ; + .is-cygwin = [ .is-cygwin $(.xsltproc) ] ; + } +} + +rule modify-config +{ + if $(.config-frozen) + { + errors.user-error "xsltproc: Cannot change xsltproc command after it has been used." ; + } +} + +rule check-xsltproc ( ) +{ + if $(.xsltproc) + { + local status = [ SHELL "\"$(.xsltproc)\" -V" : no-output : exit-status ] ; + if $(status[2]) != "0" + { + errors.user-error "xsltproc: Could not run \"$(.xsltproc)\" -V." ; + } } } # Returns a non-empty string if a cygwin xsltproc binary was specified. rule is-cygwin ( ) { - if ! $(.initialized) - { - init ; - } + freeze-config ; return $(.is-cygwin) ; } @@ -115,6 +140,7 @@ rule compute-xslt-flags ( target : properties * ) local rule .xsltproc ( target : source stylesheet : properties * : dirname ? : action ) { + freeze-config ; STYLESHEET on $(target) = $(stylesheet) ; FLAGS on $(target) += [ compute-xslt-flags $(target) : $(properties) ] ; NAME on $(target) = $(.xsltproc) ; diff --git a/v2/util/path.jam b/v2/util/path.jam index 34b0f630c..ea26b816b 100644 --- a/v2/util/path.jam +++ b/v2/util/path.jam @@ -465,6 +465,23 @@ rule programs-path ( ) return $(result) ; } +rule makedirs ( path ) +{ + local result = true ; + local native = [ native $(path) ] ; + if ! [ exists $(native) ] + { + if [ makedirs [ parent $(path) ] ] + { + if ! [ MAKEDIR $(native) ] + { + errors.error "Could not create directory '$(path)'" ; + result = ; + } + } + } + return $(result) ; +} # Converts native Windows paths into our internal canonic path representation. # Supports 'invalid' paths containing multiple successive path separator