2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Added an V2 example.

[SVN r14833]
This commit is contained in:
Vladimir Prus
2002-08-14 11:45:35 +00:00
parent 42de522df6
commit da38c67930
24 changed files with 298 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
boost-build ../new ;

22
examples-v2/make/Jamfile Normal file
View File

@@ -0,0 +1,22 @@
# Declare a project id.
project make
# Specify requirements for this project. They will be propagated to child project.
# Use 'bjam -n' to see that MACRO is defined when compiling lib/b.obj
: requirements <define>MACRO
;
# Load a project located at "extlib", and associated with project-id "/extlib".
use-project /extlib : extlib ;
# Construct a target 'a' from a list of sources using the specified rule.
make a
: a.o # Use a target declared in this Jamfile
lib/b.o # Use a target from other Jamfile
@/extlib/c.o # Refer to a library by project-id
: gcc.link ;
# Construct another target.
make a.o : a.cpp : gcc.compile ;

5
examples-v2/make/a.cpp Normal file
View File

@@ -0,0 +1,5 @@
int main()
{
return 0;
}

View File

@@ -0,0 +1,4 @@
project extlib ;
make c.o : c.cpp : gcc.compile ;

View File

View File

@@ -0,0 +1,44 @@
import property ;
rule compile ( target : sources * : property-set * )
{
local options ;
for local p in $(property-set)
{
if $(p) = <optimization>on
{
options += -O2 ;
}
else if $(p) = <debug-symbols>on
{
options += -g ;
}
else if $(p:G) = <define>
{
options += -D$(p:G=) ;
}
}
OPTIONS on $(target) = $(options) ;
}
actions compile
{
g++ $(OPTIONS) -c -o $(<) $(>)
}
rule link ( target : sources * : property-set * )
{
local options ;
if <debug-symbols>on in $(property-set)
{
options += -g ;
}
OPTIONS on $(target) = $(options) ;
}
actions link
{
g++ $(OPTIONS) -o $(<) $(>)
}

View File

44
examples-v2/make/gcc.jam Normal file
View File

@@ -0,0 +1,44 @@
import property ;
rule compile ( target : sources * : property-set * )
{
local options ;
for local p in $(property-set)
{
if $(p) = <optimization>on
{
options += -O2 ;
}
else if $(p) = <debug-symbols>on
{
options += -g ;
}
else if $(p:G) = <define>
{
options += -D$(p:G=) ;
}
}
OPTIONS on $(target) = $(options) ;
}
actions compile
{
g++ $(OPTIONS) -c -o $(<) $(>)
}
rule link ( target : sources * : property-set * )
{
local options ;
if <debug-symbols>on in $(property-set)
{
options += -g ;
}
OPTIONS on $(target) = $(options) ;
}
actions link
{
g++ $(OPTIONS) -o $(<) $(>)
}

View File

@@ -0,0 +1,2 @@
make b.o : b.cpp : gcc.compile ;

View File

View File

@@ -0,0 +1,9 @@
import modules ;
# Temporary workaround.
local location = [ project-root get-location ] ;
local new_path = [ modules.peek : BOOST_BUILD_PATH ] $(location) ;
modules.poke : BOOST_BUILD_PATH : $(new_path) ;
import gcc ;

View File

@@ -0,0 +1,17 @@
Example of a simple project, which builds an executable using g++.
All the transformations are specified explicitly.
It illustrates the use of project identifiers to refer to other targets
and also project requirements.
Interesting commands would be
bjam
bjam release
bjam release clean
bjam release debug-symbols=on
Also, you can use jam's "-n" option to check if "debug"/"release" have any
effect on commands executed. (Note that "-n" should go before any non-option
elements on command line).

View File

@@ -0,0 +1,2 @@
boost-build ../new ;

22
v2/example/make/Jamfile Normal file
View File

@@ -0,0 +1,22 @@
# Declare a project id.
project make
# Specify requirements for this project. They will be propagated to child project.
# Use 'bjam -n' to see that MACRO is defined when compiling lib/b.obj
: requirements <define>MACRO
;
# Load a project located at "extlib", and associated with project-id "/extlib".
use-project /extlib : extlib ;
# Construct a target 'a' from a list of sources using the specified rule.
make a
: a.o # Use a target declared in this Jamfile
lib/b.o # Use a target from other Jamfile
@/extlib/c.o # Refer to a library by project-id
: gcc.link ;
# Construct another target.
make a.o : a.cpp : gcc.compile ;

5
v2/example/make/a.cpp Normal file
View File

@@ -0,0 +1,5 @@
int main()
{
return 0;
}

View File

@@ -0,0 +1,4 @@
project extlib ;
make c.o : c.cpp : gcc.compile ;

View File

View File

@@ -0,0 +1,44 @@
import property ;
rule compile ( target : sources * : property-set * )
{
local options ;
for local p in $(property-set)
{
if $(p) = <optimization>on
{
options += -O2 ;
}
else if $(p) = <debug-symbols>on
{
options += -g ;
}
else if $(p:G) = <define>
{
options += -D$(p:G=) ;
}
}
OPTIONS on $(target) = $(options) ;
}
actions compile
{
g++ $(OPTIONS) -c -o $(<) $(>)
}
rule link ( target : sources * : property-set * )
{
local options ;
if <debug-symbols>on in $(property-set)
{
options += -g ;
}
OPTIONS on $(target) = $(options) ;
}
actions link
{
g++ $(OPTIONS) -o $(<) $(>)
}

View File

44
v2/example/make/gcc.jam Normal file
View File

@@ -0,0 +1,44 @@
import property ;
rule compile ( target : sources * : property-set * )
{
local options ;
for local p in $(property-set)
{
if $(p) = <optimization>on
{
options += -O2 ;
}
else if $(p) = <debug-symbols>on
{
options += -g ;
}
else if $(p:G) = <define>
{
options += -D$(p:G=) ;
}
}
OPTIONS on $(target) = $(options) ;
}
actions compile
{
g++ $(OPTIONS) -c -o $(<) $(>)
}
rule link ( target : sources * : property-set * )
{
local options ;
if <debug-symbols>on in $(property-set)
{
options += -g ;
}
OPTIONS on $(target) = $(options) ;
}
actions link
{
g++ $(OPTIONS) -o $(<) $(>)
}

View File

@@ -0,0 +1,2 @@
make b.o : b.cpp : gcc.compile ;

View File

View File

@@ -0,0 +1,9 @@
import modules ;
# Temporary workaround.
local location = [ project-root get-location ] ;
local new_path = [ modules.peek : BOOST_BUILD_PATH ] $(location) ;
modules.poke : BOOST_BUILD_PATH : $(new_path) ;
import gcc ;

View File

@@ -0,0 +1,17 @@
Example of a simple project, which builds an executable using g++.
All the transformations are specified explicitly.
It illustrates the use of project identifiers to refer to other targets
and also project requirements.
Interesting commands would be
bjam
bjam release
bjam release clean
bjam release debug-symbols=on
Also, you can use jam's "-n" option to check if "debug"/"release" have any
effect on commands executed. (Note that "-n" should go before any non-option
elements on command line).