Hi ken,
Thanks for the tip, it looks advanced... I like it. However, if I
execute "make all", wouldn't this execute the always rule twice. Once for
dep1 and once for dep2?
Thanks,
Rafael.
On Jan 16, 2008 3:43 PM, Ken Smith <[EMAIL PROTECTED]> wrote:
> On Jan 16, 2008 7:14 AM, Rafael Garabato <[EMAIL PROTECTED]> 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
>
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make