I'm not familiar with Makefile, and I try to run the piece of bash script in Makefile, and use the variable as result in target.
my bash script like below, read from file, merge each line to variable
#!/bin/bash
input="./logs"
context=""
while IFS= read -r var; \
do \
context+="\n$var"; \
done < "$input"
echo -e $context
my logs file like below
- foo
- bar
- barzz
and the bash script work fine
but when I move it to Makefile, it can't works
Makefile
.PHONY: test pack clean
INPUT = "./logs"
CONTEXT = ""
while IFS= read -r var; \
do \
CONTEXT+="\n$(var)"; \
done < "$(INPUT)"
test:
echo -e $(CONTEXT)
how should I fix it?
thanks for your time.