add variant sample

This commit is contained in:
Fabien Freling 2024-11-20 16:01:51 +01:00
parent cd19bd75b3
commit 1c38b53ae2
12 changed files with 34 additions and 0 deletions

2
variant_path/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/build-default
!/build-default/tup.config

0
variant_path/Tupfile.ini Normal file
View file

View file

@ -0,0 +1,9 @@
&templates_dir = ./templates
# This doesn't work, cannot find the generated header.txt
# I want to access the variant path for templates/ but $(TUP_VARIANTDIR) will
# follow the current Tupfile and there is no variant "anchor" like &-variables.
!add_header = | &(templates_dir)/<header_group> |> cat &(templates_dir)/header.txt %f &(templates_dir)/footer.txt > %o |> %B.gen.txt
# This works
#!add_header = | &(templates_dir)/<header_group> |> cat %f &(templates_dir)/footer.txt > %o |> %B.gen.txt

View file

@ -0,0 +1,3 @@
include_rules
: a.txt |> !add_header |>

View file

@ -0,0 +1 @@
letter a

View file

@ -0,0 +1,3 @@
include_rules
: b.txt |> !add_header |>

View file

@ -0,0 +1 @@
letter b

View file

@ -0,0 +1,3 @@
include_rules
: c.txt |> !add_header |>

View file

@ -0,0 +1 @@
letter c

View file

@ -0,0 +1 @@
: |> ./generate_header.sh > %o |> header.txt ./<header_group>

View file

@ -0,0 +1,2 @@
--
the end

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
cat << EOF
YEAR $(date +%Y)
====
EOF