[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Initialization targets
From: |
Ken Smith |
Subject: |
Re: Initialization targets |
Date: |
Wed, 16 Jan 2008 09:43:08 -0800 |
On Jan 16, 2008 7:14 AM, Rafael Garabato <address@hidden> wrote:
> I would like to know if it exists a way to define a target that will
> always be executed once and prior to any other target, regardless of the
> target that is specified.
As Paul said, the only way to do this is to make always a prerequisite
of every target. It turns out that it isn't that hard to do.
Consider:
deps := dep1 dep2
all: $(deps);
echo all
dep1:
echo dep1
dep2:
echo dep2
# make always a prerequisite of every target listed in $(deps)
$(foreach d,$(deps),$(eval $(d): always))
.PHONY: always
always:
echo always
#EOF
Making always a .PHONY target ensures that it is run every time the
makefile is run.
Ken