osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Re: Make: Can implicit rules be forced to make
non-existing prerequisites? - msg#00017

List: gnu.utils

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

James wrote:
> Jan T. Kim wrote:
> > Dear all,
> >
> > I want to set up a Makefile to handle installation and checking etc.
> > of a bunch of R packages, and I'd like to be able to add a new
> > package by just adding the new name to a variable. I use implicit
> > rules to try and pull this off. The problem I run into is that make
> > cannot
> > be bothered to make prerequisites required by an implicit rule, but in
> > my
> > case, that's what I need.
> >
> > Here's my Makefile:
> >
> > RPACKS = xpipe jtkstuff
> > RPACKS_INSTALL = $(RPACKS:%=%-install)
> > RPACKS_UNINSTALL = $(RPACKS:%=%-uninstall)
> > RPACKS_CHECK = $(RPACKS:%=%-check)
> >
> > install : $(RPACKS_INSTALL)
> >
> > # explicit rule: target is unconditionally made
> > jtkstuff-install :
> > echo target: $@ prerequisites: $^
> > R CMD INSTALL jtkstuff
> >
> > # implicit rule: nothing is made
> > %-install :
> > echo target: $@ prerequisites: $^
> > R CMD INSTALL $*
> >
> > .PHONY : install uninstall check clean $(RPRACKS) $(RPACKS_INSTALL)

[snip]

> How about commenting out .PHONY line?

Ok -- that's the solution indeed. The reason is that .PHONY triggers
skipping of the implicit target search as an optimising side effect,
which I overlooked. Thanks for the pointer.

Specifically, it suffices to remove $(RPACKS_INSTALL) from the
.PHONY target. Of course, this opens the hole that if somehow a
xpipe-install file or directory appears, the implicit rule won't fire
anymore. To work around this, I now made a phony "implicit" target
that is a prerequisite of the implicit rules that I want to execute
unconditionally:

%-install : implicit
echo target: $@ prerequisites: $^
R CMD INSTALL $*

.PHONY : install uninstall check clean implicit $(RPRACKS)

Best regards, Jan


Thread at a glance:

Previous Message by Date:

Re: Make: Can implicit rules be forced to make non-existing prerequisites?

Jan T. Kim wrote: > Dear all, > > I want to set up a Makefile to handle installation and checking etc. > of a bunch of R packages, and I'd like to be able to add a new > package by just adding the new name to a variable. I use implicit > rules to try and pull this off. The problem I run into is that make > cannot > be bothered to make prerequisites required by an implicit rule, but in > my > case, that's what I need. > > Here's my Makefile: > > RPACKS = xpipe jtkstuff > RPACKS_INSTALL = $(RPACKS:%=%-install) > RPACKS_UNINSTALL = $(RPACKS:%=%-uninstall) > RPACKS_CHECK = $(RPACKS:%=%-check) > > install : $(RPACKS_INSTALL) > > # explicit rule: target is unconditionally made > jtkstuff-install : > echo target: $@ prerequisites: $^ > R CMD INSTALL jtkstuff > > # implicit rule: nothing is made > %-install : > echo target: $@ prerequisites: $^ > R CMD INSTALL $* > > .PHONY : install uninstall check clean $(RPRACKS) $(RPACKS_INSTALL) > > make -n -d install shows the problem: > > Updating goal targets.... > Considering target file `install'. > File `install' does not exist. > Considering target file `xpipe-install'. > File `xpipe-install' does not exist. > Finished prerequisites of target file `xpipe-install'. > Must remake target `xpipe-install'. > Successfully remade target file `xpipe-install'. > Considering target file `jtkstuff-install'. > File `jtkstuff-install' does not exist. > Finished prerequisites of target file `jtkstuff-install'. > Must remake target `jtkstuff-install'. > echo target: jtkstuff-install prerequisites: > R CMD INSTALL jtkstuff > Successfully remade target file `jtkstuff-install'. > Finished prerequisites of target file `install'. > Must remake target `install'. > Successfully remade target file `install'. > > Obviously, make handles the explicit jtkstuff-install rule differently > from the implicit %-install rule in that it does execute the commands > for the former while it considers the implicitly specified target > xpipe-install to be remade without actually doing anything. > > Is there any way to change this behaviour? > > Regards & thanks in advance, Jan How about commenting out .PHONY line? James

Next Message by Date:

Re: Make: Can implicit rules be forced to make non-existing prerequisites?

"Jan T. Kim" <jtkim@xxxxxx> wrote: > .PHONY : install uninstall check clean $(RPRACKS) $(RPACKS_INSTALL) > Obviously, make handles the explicit jtkstuff-install rule differently > from the implicit %-install rule in that it does execute the commands > for the former while it considers the implicitly specified target > xpipe-install to be remade without actually doing anything. > > Is there any way to change this behaviour? Try to remove $(RPRACKS) from the .PHONY line like this: .PHONY : install uninstall check clean $(RPACKS_INSTALL) It seems as if phony targets does not work in implicit rules. regards Henrik -- The address in the header is only to prevent spam. My real address is: hc8(at)uthyres.com Examples of addresses which go to spammers: root@xxxxxxxxxxxxx root@localhost

Previous Message by Thread:

Re: Make: Can implicit rules be forced to make non-existing prerequisites?

Jan T. Kim wrote: > Dear all, > > I want to set up a Makefile to handle installation and checking etc. > of a bunch of R packages, and I'd like to be able to add a new > package by just adding the new name to a variable. I use implicit > rules to try and pull this off. The problem I run into is that make > cannot > be bothered to make prerequisites required by an implicit rule, but in > my > case, that's what I need. > > Here's my Makefile: > > RPACKS = xpipe jtkstuff > RPACKS_INSTALL = $(RPACKS:%=%-install) > RPACKS_UNINSTALL = $(RPACKS:%=%-uninstall) > RPACKS_CHECK = $(RPACKS:%=%-check) > > install : $(RPACKS_INSTALL) > > # explicit rule: target is unconditionally made > jtkstuff-install : > echo target: $@ prerequisites: $^ > R CMD INSTALL jtkstuff > > # implicit rule: nothing is made > %-install : > echo target: $@ prerequisites: $^ > R CMD INSTALL $* > > .PHONY : install uninstall check clean $(RPRACKS) $(RPACKS_INSTALL) > > make -n -d install shows the problem: > > Updating goal targets.... > Considering target file `install'. > File `install' does not exist. > Considering target file `xpipe-install'. > File `xpipe-install' does not exist. > Finished prerequisites of target file `xpipe-install'. > Must remake target `xpipe-install'. > Successfully remade target file `xpipe-install'. > Considering target file `jtkstuff-install'. > File `jtkstuff-install' does not exist. > Finished prerequisites of target file `jtkstuff-install'. > Must remake target `jtkstuff-install'. > echo target: jtkstuff-install prerequisites: > R CMD INSTALL jtkstuff > Successfully remade target file `jtkstuff-install'. > Finished prerequisites of target file `install'. > Must remake target `install'. > Successfully remade target file `install'. > > Obviously, make handles the explicit jtkstuff-install rule differently > from the implicit %-install rule in that it does execute the commands > for the former while it considers the implicitly specified target > xpipe-install to be remade without actually doing anything. > > Is there any way to change this behaviour? > > Regards & thanks in advance, Jan How about commenting out .PHONY line? James

Next Message by Thread:

Re: Make: Can implicit rules be forced to make non-existing prerequisites?

"Jan T. Kim" <jtkim@xxxxxx> wrote: > .PHONY : install uninstall check clean $(RPRACKS) $(RPACKS_INSTALL) > Obviously, make handles the explicit jtkstuff-install rule differently > from the implicit %-install rule in that it does execute the commands > for the former while it considers the implicitly specified target > xpipe-install to be remade without actually doing anything. > > Is there any way to change this behaviour? Try to remove $(RPRACKS) from the .PHONY line like this: .PHONY : install uninstall check clean $(RPACKS_INSTALL) It seems as if phony targets does not work in implicit rules. regards Henrik -- The address in the header is only to prevent spam. My real address is: hc8(at)uthyres.com Examples of addresses which go to spammers: root@xxxxxxxxxxxxx root@localhost
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!