From: Name withheld by request on 5 Jun 2010 01:48 Trying to use vpath w/implicit pattern rule. Why does case B fail? # test makefile: /tmp/test0 $ cat makefile # simple test pattern rule %.foo: %.bar tac < $< > $@ vpath %.bar /tmp/test0/src # dependency/source file: /tmp/test0 $ ls /tmp/test0/src x.bar # case A: success w/vpath: /tmp/test0 $ cd tgt/ /tmp/test0/tgt $ make -f ../makefile x.foo tac < /tmp/test0/src/x.bar > x.foo # case B: why does this fail?: /tmp/test0/tgt $ rm x.foo; cd .. /tmp/test0 $ make tgt/x.foo make: *** No rule to make target `tgt/x.foo'. Stop. -- thanks much -- PS w/a minor chg to makefile, make tgt/x.foo works and the simplier target fails: /tmp/test0 $ cat makefile tgt/%.foo: %.bar tac < $< > $@ vpath %.bar /tmp/test0/src /tmp/test0 $ cd tgt/ /tmp/test0/tgt $ ls /tmp/test0/tgt $ make -f ../makefile x.foo make: *** No rule to make target `x.foo'. Stop. /tmp/test0/tgt $ cd .. /tmp/test0 $ make tgt/x.foo tac < /tmp/test0/src/x.bar > tgt/x.foo
From: Ben Bacarisse on 5 Jun 2010 08:44 anonb6e9(a)nyx3.nyx.net (Name withheld by request) writes: > Trying to use vpath w/implicit pattern rule. Why does > case B fail? > > # test makefile: > > /tmp/test0 $ cat makefile # simple test pattern rule > %.foo: %.bar > tac < $< > $@ > > vpath %.bar /tmp/test0/src > > # dependency/source file: > > /tmp/test0 $ ls /tmp/test0/src > x.bar > > # case A: success w/vpath: > > /tmp/test0 $ cd tgt/ > /tmp/test0/tgt $ make -f ../makefile x.foo > tac < /tmp/test0/src/x.bar > x.foo > > # case B: why does this fail?: > > /tmp/test0/tgt $ rm x.foo; cd .. > /tmp/test0 $ make tgt/x.foo > make: *** No rule to make target `tgt/x.foo'. Stop. The target 'tgt/x.foo' matches %.foo in the rule. The dependency is then on tgt/x.bar which is searched for in /tmp/test0/src and not found. The rather confusing message form make simply means that it then moved on to see if some other rule might work and it report the failure to find a suitable one, not the cause of your trouble which is the tgt/x.bar does not exist in the vpath. > w/a minor chg to makefile, > make tgt/x.foo > works and the simplier target fails: > > /tmp/test0 $ cat makefile > tgt/%.foo: %.bar > tac < $< > $@ > > vpath %.bar /tmp/test0/src > /tmp/test0 $ cd tgt/ > /tmp/test0/tgt $ ls > /tmp/test0/tgt $ make -f ../makefile x.foo > make: *** No rule to make target `x.foo'. Stop. > /tmp/test0/tgt $ cd .. > /tmp/test0 $ make tgt/x.foo > tac < /tmp/test0/src/x.bar > tgt/x.foo Yes, tgt/x.foo now depends on x.bar (not tgt/x.bar) and all is well. -- Ben.
From: Name withheld by request on 5 Jun 2010 11:55 Thanks much, pls see verification below. In article <0.c6b02e102696bd018532.20100605134422BST.87fx11tzru.fsf(a)bsb.me.uk>, Ben Bacarisse <ben.usenet(a)bsb.me.uk> wrote: >anonb6e9(a)nyx3.nyx.net (Name withheld by request) writes: >> Trying to use vpath w/implicit pattern rule. Why does >> case B fail? >> >> # test makefile: >> >> /tmp/test0 $ cat makefile # simple test pattern rule >> %.foo: %.bar >> tac < $< > $@ >> >> vpath %.bar /tmp/test0/src >> >> # dependency/source file: >> >> /tmp/test0 $ ls /tmp/test0/src >> x.bar /tmp/test0/src/x.bar was present for all tests shown >> # case A: success w/vpath: >> >> /tmp/test0 $ cd tgt/ >> /tmp/test0/tgt $ make -f ../makefile x.foo >> tac < /tmp/test0/src/x.bar > x.foo >> >> # case B: why does this fail?: >> >> /tmp/test0/tgt $ rm x.foo; cd .. >> /tmp/test0 $ make tgt/x.foo >> make: *** No rule to make target `tgt/x.foo'. Stop. > >The target 'tgt/x.foo' matches %.foo in the rule. The dependency is >then on tgt/x.bar which is searched for in /tmp/test0/src and not found. In a simple single colon pattern rule the % must represent exactly the same string for the target and the dependency, right? Hence % represented 'tgt/x', and the dependency searched for in vpath was tgt/x.bar which naturally is not found. -- Bottom line: your right: /tmp/test0 $ cat makefile0 %.foo: %.bar tac < $< > $@ vpath %.bar /tmp/test0/src /tmp/test0 $ make -f makefile0 tgt/x.foo make: *** No rule to make target `tgt/x.foo'. Stop. /tmp/test0 $ mkdir src/tgt /tmp/test0 $ cp src/x.bar src/tgt /tmp/test0 $ make -f makefile0 tgt/x.foo tac < /tmp/test0/src/tgt/x.bar > tgt/x.foo /tmp/test0 $ rm tgt/x.foo /tmp/test0 $ make -d -f makefile0 tgt/x.foo |egrep -i vpath Found prerequisite `tgt/x.bar' as VPATH `/tmp/test0/src/tgt/x.bar' No need to remake target `tgt/x.bar'; using VPATH name `/tmp/test0/src/tgt/x.bar'. >The rather confusing message form make simply means that it then moved >on to see if some other rule might work and it report the failure to >find a suitable one, not the cause of your trouble which is the >tgt/x.bar does not exist in the vpath. For the other working case: /tmp/test0 $ cat makefile1 tgt/%.foo: %.bar tac < $< > $@ vpath %.bar /tmp/test0/src /tmp/test0 $ rm tgt/x.foo /tmp/test0 $ make -d -f makefile1 tgt/x.foo 2>&1|egrep -i vpath Found prerequisite `x.bar' as VPATH `/tmp/test0/src/x.bar' No need to remake target `x.bar'; using VPATH name `/tmp/test0/src/x.bar'. The prerequisite is x.bar w/the target tgt/x.foo % represents the string 'x' on both sides of the pattern rule, so x.bar is search for in vpath and found. -- thanks for the help
|
Pages: 1 Prev: Access to the output of the last command Next: Join Lines |