]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright 2008 Vladimir Prus |
2 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 | 3 | # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) |
7c673cae FG |
4 | |
5 | # Defines main target type 'message', that prints a message when built for the | |
6 | # first time. | |
7 | ||
8 | import project ; | |
9 | import "class" : new ; | |
10 | import targets ; | |
11 | import property-set ; | |
12 | ||
13 | class message-target-class : basic-target | |
14 | { | |
15 | rule set-message ( * ) | |
16 | { | |
17 | self.1 = $(1) ; | |
18 | self.2 = $(2) ; | |
19 | self.3 = $(3) ; | |
20 | self.4 = $(4) ; | |
21 | self.5 = $(5) ; | |
22 | self.6 = $(6) ; | |
23 | self.7 = $(7) ; | |
1e59de90 TL |
24 | self.8 = $(8) ; |
25 | self.9 = $(9) ; | |
7c673cae FG |
26 | self.built = ; |
27 | } | |
1e59de90 | 28 | |
7c673cae FG |
29 | rule construct ( name : source-targets * : property-set ) |
30 | { | |
31 | if ! $(self.built) | |
32 | { | |
33 | for i in 1 2 3 4 5 6 7 8 9 | |
34 | { | |
35 | if $(self.$(i)) | |
36 | { | |
37 | ECHO $(self.$(i)) ; | |
38 | } | |
39 | } | |
40 | self.built = 1 ; | |
41 | } | |
1e59de90 | 42 | |
7c673cae FG |
43 | return [ property-set.empty ] ; |
44 | } | |
45 | } | |
46 | ||
47 | ||
48 | rule message ( name : * ) | |
49 | { | |
50 | local project = [ project.current ] ; | |
51 | ||
52 | local result = [ targets.main-target-alternative | |
53 | [ new message-target-class $(name) : $(project) | |
54 | : [ targets.main-target-sources : $(name) ] | |
55 | : [ targets.main-target-requirements : $(project) ] | |
56 | : [ targets.main-target-default-build : $(project) ] | |
57 | : [ targets.main-target-usage-requirements : $(project) ] | |
58 | ] ] ; | |
59 | $(result).set-message $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; | |
60 | return $(result) ; | |
61 | } | |
62 | IMPORT $(__name__) : message : : message ; |