mirror of
https://github.com/boostorg/build.git
synced 2026-02-01 08:22:15 +00:00
71 lines
1.2 KiB
Plaintext
71 lines
1.2 KiB
Plaintext
# Demonstration that module variables have the right effect in actions
|
|
|
|
# Set a variable which says how to dump a file to stdout
|
|
if $(NT)
|
|
{
|
|
CATENATE = type ;
|
|
}
|
|
else
|
|
{
|
|
CATENATE = cat ;
|
|
}
|
|
|
|
# invoke the given action rule `act' to build target from sources
|
|
rule do-make ( target : sources * : act )
|
|
{
|
|
DEPENDS $(target) : $(sources) ;
|
|
$(act) $(target) : $(sources) ;
|
|
}
|
|
|
|
# top-level version of do-make which causes target to be built by
|
|
# default
|
|
rule make ( target : sources * : act )
|
|
{
|
|
DEPENDS all : $(target) ;
|
|
do-make $(target) : $(sources) : $(act) ;
|
|
}
|
|
|
|
X1 = X1-global ;
|
|
X2 = X2-global ;
|
|
X3 = X3-global ;
|
|
|
|
module A
|
|
{
|
|
X1 = X1-A ;
|
|
|
|
rule act ( target )
|
|
{
|
|
NOTFILE $(target) ;
|
|
ALWAYS $(target) ;
|
|
}
|
|
|
|
actions act { echo A.act $(<): $(X1) $(X2) $(X3) }
|
|
|
|
make t1 : : A.act ;
|
|
make t2 : : A.act ;
|
|
make t3 : : A.act ;
|
|
}
|
|
|
|
module B
|
|
{
|
|
X2 = X2-B ;
|
|
|
|
actions act { echo B.act $(<): $(X1) $(X2) $(X3) }
|
|
|
|
make t1 : : B.act ;
|
|
make t2 : : B.act ;
|
|
make t3 : : B.act ;
|
|
}
|
|
|
|
actions act { echo act $(<): $(X1) $(X2) $(X3) }
|
|
|
|
make t1 : : act ;
|
|
make t2 : : act ;
|
|
make t3 : : act ;
|
|
|
|
X1 on t1 = X1-t1 ;
|
|
X2 on t2 = X2-t2 ;
|
|
X3 on t3 = X3-t3 ;
|
|
|
|
DEPENDS all : t1 t2 t3 ;
|