[make] use input/output files inside makefile

whired123

Member
Joined
Nov 15, 2021
Messages
71
Reaction score
4
Credits
539
First a few details

Code:
$ tree
├── makefile
├── snippet.txt
└── template.txt

$ cat template.txt 
aaa $input bbb

$ cat snippet.txt 
xxx

$ cat makefile 
test:
	sh -c "input=$(cat snippet.txt) envsubst < template.txt > output2.txt"

Let's do some tests

Code:
$ input=$(cat snippet.txt) envsubst < template.txt > output1.txt

$ make
sh -c "input= envsubst < template.txt > output2.txt"

Let's look at the outputs

Code:
$ cat output1.txt 
aaa xxx bbb

$ cat output2.txt 
aaa  bbb

Why doesn't xxx appear in the output2.txt file?
 

Members online


Top