diff --git a/variant_path/.gitignore b/variant_path/.gitignore new file mode 100644 index 0000000..6533779 --- /dev/null +++ b/variant_path/.gitignore @@ -0,0 +1,2 @@ +/build-default +!/build-default/tup.config diff --git a/variant_path/Tupfile b/variant_path/Tupfile new file mode 100644 index 0000000..ba79860 --- /dev/null +++ b/variant_path/Tupfile @@ -0,0 +1 @@ +: |> ./generate_header.sh > %o |> header.txt ./ diff --git a/variant_path/Tupfile.ini b/variant_path/Tupfile.ini new file mode 100644 index 0000000..e69de29 diff --git a/variant_path/Tuprules.tup b/variant_path/Tuprules.tup new file mode 100644 index 0000000..58d5215 --- /dev/null +++ b/variant_path/Tuprules.tup @@ -0,0 +1,9 @@ +&root = . + +# This doesn't work, cannot find the generated header.txt +# I want to access the variant path for . but $(TUP_VARIANTDIR) will follow the +# current Tupfile and there is no variant "anchor" like &-variables. +!add_header = | &(root)/ |> cat &(root)/header.txt %f &(root)/footer.txt > %o |> %B.gen.txt + +# This works +#!add_header = | &(root)/ |> cat %f &(root)/footer.txt > %o |> %B.gen.txt diff --git a/variant_path/footer.txt b/variant_path/footer.txt new file mode 100644 index 0000000..b12144a --- /dev/null +++ b/variant_path/footer.txt @@ -0,0 +1,2 @@ +-- +the end diff --git a/variant_path/generate_header.sh b/variant_path/generate_header.sh new file mode 100755 index 0000000..e2b1f4a --- /dev/null +++ b/variant_path/generate_header.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cat << EOF +YEAR $(date +%Y) +==== +EOF diff --git a/variant_path/src/Tupfile b/variant_path/src/Tupfile new file mode 100644 index 0000000..d8f9134 --- /dev/null +++ b/variant_path/src/Tupfile @@ -0,0 +1,3 @@ +include_rules + +: a.txt |> !add_header |> diff --git a/variant_path/src/a.txt b/variant_path/src/a.txt new file mode 100644 index 0000000..c0b6465 --- /dev/null +++ b/variant_path/src/a.txt @@ -0,0 +1 @@ +letter a diff --git a/variant_path/src/sub/Tupfile b/variant_path/src/sub/Tupfile new file mode 100644 index 0000000..3ed03df --- /dev/null +++ b/variant_path/src/sub/Tupfile @@ -0,0 +1,3 @@ +include_rules + +: b.txt |> !add_header |> diff --git a/variant_path/src/sub/b.txt b/variant_path/src/sub/b.txt new file mode 100644 index 0000000..5a55a99 --- /dev/null +++ b/variant_path/src/sub/b.txt @@ -0,0 +1 @@ +letter b