From d87598ca5a519e61dfc9741bdf787beeb4c4b14d Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 14 Sep 2005 10:03:01 +0000 Subject: [PATCH] Cleanup/simplify the 'make' example. [SVN r30976] --- v2/example/make/Jamfile | 22 ------------- v2/example/make/Jamroot | 23 +++++++++++++ v2/example/make/a.cpp | 13 -------- v2/example/make/extlib/Jamfile | 4 --- v2/example/make/extlib/c.cpp | 8 ----- v2/example/make/extlib/gcc.jam | 44 ------------------------- v2/example/make/extlib/project-root.jam | 0 v2/example/make/gcc.jam | 44 ------------------------- v2/example/make/lib/Jamfile | 2 -- v2/example/make/lib/b.cpp | 8 ----- v2/example/make/main.cpp.pro | 2 ++ v2/example/make/project-root.jam | 2 -- v2/example/make/readme.txt | 18 ++-------- 13 files changed, 27 insertions(+), 163 deletions(-) delete mode 100644 v2/example/make/Jamfile create mode 100644 v2/example/make/Jamroot delete mode 100644 v2/example/make/a.cpp delete mode 100644 v2/example/make/extlib/Jamfile delete mode 100644 v2/example/make/extlib/c.cpp delete mode 100644 v2/example/make/extlib/gcc.jam delete mode 100644 v2/example/make/extlib/project-root.jam delete mode 100644 v2/example/make/gcc.jam delete mode 100644 v2/example/make/lib/Jamfile delete mode 100644 v2/example/make/lib/b.cpp create mode 100644 v2/example/make/main.cpp.pro delete mode 100644 v2/example/make/project-root.jam diff --git a/v2/example/make/Jamfile b/v2/example/make/Jamfile deleted file mode 100644 index 5e9ff9b45..000000000 --- a/v2/example/make/Jamfile +++ /dev/null @@ -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 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 ; diff --git a/v2/example/make/Jamroot b/v2/example/make/Jamroot new file mode 100644 index 000000000..03724f900 --- /dev/null +++ b/v2/example/make/Jamroot @@ -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) $(>) $(<) +} diff --git a/v2/example/make/a.cpp b/v2/example/make/a.cpp deleted file mode 100644 index 42f08d34c..000000000 --- a/v2/example/make/a.cpp +++ /dev/null @@ -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; -} diff --git a/v2/example/make/extlib/Jamfile b/v2/example/make/extlib/Jamfile deleted file mode 100644 index fb21b1ccf..000000000 --- a/v2/example/make/extlib/Jamfile +++ /dev/null @@ -1,4 +0,0 @@ - -project extlib ; - -make c.o : c.cpp : gcc.compile ; \ No newline at end of file diff --git a/v2/example/make/extlib/c.cpp b/v2/example/make/extlib/c.cpp deleted file mode 100644 index ccecbb414..000000000 --- a/v2/example/make/extlib/c.cpp +++ /dev/null @@ -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 -// diff --git a/v2/example/make/extlib/gcc.jam b/v2/example/make/extlib/gcc.jam deleted file mode 100644 index 3818bac2f..000000000 --- a/v2/example/make/extlib/gcc.jam +++ /dev/null @@ -1,44 +0,0 @@ - -import property ; - -rule compile ( target : sources * : property-set * ) -{ - local options ; - for local p in $(property-set) - { - if $(p) = on - { - options += -O2 ; - } - else if $(p) = on - { - options += -g ; - } - else if $(p:G) = - { - options += -D$(p:G=) ; - } - } - OPTIONS on $(target) = $(options) ; -} - -actions compile -{ - g++ $(OPTIONS) -c -o $(<) $(>) -} - -rule link ( target : sources * : property-set * ) -{ - local options ; - if on in $(property-set) - { - options += -g ; - } - OPTIONS on $(target) = $(options) ; -} - -actions link -{ - g++ $(OPTIONS) -o $(<) $(>) -} - diff --git a/v2/example/make/extlib/project-root.jam b/v2/example/make/extlib/project-root.jam deleted file mode 100644 index e69de29bb..000000000 diff --git a/v2/example/make/gcc.jam b/v2/example/make/gcc.jam deleted file mode 100644 index 3818bac2f..000000000 --- a/v2/example/make/gcc.jam +++ /dev/null @@ -1,44 +0,0 @@ - -import property ; - -rule compile ( target : sources * : property-set * ) -{ - local options ; - for local p in $(property-set) - { - if $(p) = on - { - options += -O2 ; - } - else if $(p) = on - { - options += -g ; - } - else if $(p:G) = - { - options += -D$(p:G=) ; - } - } - OPTIONS on $(target) = $(options) ; -} - -actions compile -{ - g++ $(OPTIONS) -c -o $(<) $(>) -} - -rule link ( target : sources * : property-set * ) -{ - local options ; - if on in $(property-set) - { - options += -g ; - } - OPTIONS on $(target) = $(options) ; -} - -actions link -{ - g++ $(OPTIONS) -o $(<) $(>) -} - diff --git a/v2/example/make/lib/Jamfile b/v2/example/make/lib/Jamfile deleted file mode 100644 index 1f29af62d..000000000 --- a/v2/example/make/lib/Jamfile +++ /dev/null @@ -1,2 +0,0 @@ - -make b.o : b.cpp : gcc.compile ; \ No newline at end of file diff --git a/v2/example/make/lib/b.cpp b/v2/example/make/lib/b.cpp deleted file mode 100644 index ccecbb414..000000000 --- a/v2/example/make/lib/b.cpp +++ /dev/null @@ -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 -// diff --git a/v2/example/make/main.cpp.pro b/v2/example/make/main.cpp.pro new file mode 100644 index 000000000..d38ae81af --- /dev/null +++ b/v2/example/make/main.cpp.pro @@ -0,0 +1,2 @@ + +int main() { return 0; } diff --git a/v2/example/make/project-root.jam b/v2/example/make/project-root.jam deleted file mode 100644 index 487eef980..000000000 --- a/v2/example/make/project-root.jam +++ /dev/null @@ -1,2 +0,0 @@ - -import gcc ; diff --git a/v2/example/make/readme.txt b/v2/example/make/readme.txt index 499dbba96..aa4bde879 100644 --- a/v2/example/make/readme.txt +++ b/v2/example/make/readme.txt @@ -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.