Reputation: 3796
If I define the following variables in my makefile
REPORT_DIR = ./reports
REPORT_TARGETS = my_report.html another_report.html
clean:
rm -f $(REPORT_DIR)/$(REPORT_TARGETS)
When I execute make clean
the report directory is only pasted to the first report target.
rm -f ./reports/my_report.html another_report.html
My goal is that executing make clean
would produce
rm -f ./reports/my_report.html ./reports/another_report.html
How can I paste ./reports/
to all elements of REPORT_TARGETS
?
Upvotes: 0
Views: 58
Reputation: 99094
TARGETS_WITH_PATHS := $(addprefix $(REPORT_DIR)/, $(REPORT_TARGETS))
Upvotes: 1