[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Makefile template target is not "up to date" when it has been perfor
From: |
Paul Smith |
Subject: |
Re: Makefile template target is not "up to date" when it has been performed |
Date: |
Tue, 23 Aug 2016 00:46:12 -0400 |
On Mon, 2016-08-22 at 06:33 -0700, Larry Wilson Sr wrote:
> I have the following:
>
> In a generic template (Makefile.rules.mak):
>
> BUILDPATHBASHLIBSCRIPTS = $(addprefix $(BUILDPATHDIR)/, $(BASHLIBSCRIPTS))
>
> $(BUILDPATHBASHLIBSCRIPTS): $(BUILDPATHDIR)/%: %
> if test $< -nt $@; then \
> cp -f $< $@ \
> chmod a+rx $@; fi
>
> In a local makefile:
>
> BASHLIBSCRIPTS = revisionclass.sh
>
> include $(MAKEUTILITYDIR)/Makefile.rules.mak
>
> $(BUILDPATHDIR)/revisionopssingleton.sh: privateext
>
> privateext: revisionopssingleton.sh
> ./compilerevision.sh $< $(BUILDPATHDIR)/$<
>
> My issues are that the privateext rule is ALWAYS run
> AND the $(BUILDPATHBASHLIBSCRIPTS) rule is always run
Well, sure.
Make needs to build the target privateext. Make sees that target
doesn't exist so it tries to build it, and to do so make runs the recipe
"./compilerevision.sh $< $(BUILDPATHDIR)/$<".
That recipe succeeds but the file privateext has not been created. So,
the next time make runs it tries to build the target privateext again.
And the next time it will try to build it again, etc.
Because your recipe doesn't follow the Second Rule of Makefiles (it
doesn't create the file $@), make will always try to run it, hoping this
time it will work.