mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Cleanup/simplify the 'make' example.
[SVN r30976]
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
|
||||
# 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 ;
|
||||
23
v2/example/make/Jamroot
Normal file
23
v2/example/make/Jamroot
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
import notfile ;
|
||||
import common ;
|
||||
|
||||
exe main : main.cpp ;
|
||||
|
||||
# Create 'main.cpp' from 'main.cpp.pro' using action
|
||||
# 'do-something' defined below.
|
||||
#
|
||||
make main.cpp : main.cpp.pro : do-something ;
|
||||
|
||||
# In this example, we'll just copy a file.
|
||||
# Need to find out the name of a command to copy a file.
|
||||
CP = [ common.copy-command ] ;
|
||||
|
||||
# The action itself.
|
||||
# The 'CP' variable is defined below
|
||||
# $(>) is source
|
||||
# $(<) is target
|
||||
actions do-something
|
||||
{
|
||||
$(CP) $(>) $(<)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2003 Vladimir Prus
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// http://www.boost.org
|
||||
//
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
project extlib ;
|
||||
|
||||
make c.o : c.cpp : gcc.compile ;
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright (c) 2003 Vladimir Prus
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// http://www.boost.org
|
||||
//
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
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 $(<) $(>)
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
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 $(<) $(>)
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
make b.o : b.cpp : gcc.compile ;
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright (c) 2003 Vladimir Prus
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// http://www.boost.org
|
||||
//
|
||||
2
v2/example/make/main.cpp.pro
Normal file
2
v2/example/make/main.cpp.pro
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
int main() { return 0; }
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
import gcc ;
|
||||
@@ -1,17 +1,3 @@
|
||||
|
||||
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).
|
||||
Example of using custom command to create one file from
|
||||
another, using the builtin 'make' rule.
|
||||
|
||||
Reference in New Issue
Block a user