On Wed, 27 May 2009 11:26:14 am Philip Guenther wrote: > On Tue, May 26, 2009 at 9:45 AM, Anthony Shipman <a...@iinet.net.au> wrote: > > I've tried the example in section 3.8 Overriding Part of Another > > Makefile. i.e. > > > > foo: > > frobnicate > foo > > > > %: force > > �...@$(MAKE) -f Makefile $@ > > > > force: ; > > > > The command 'make foo' results in > > > > make[1]: Makefile: No such file or directory > > make[1]: *** No rule to make target `Makefile'. Stop. > > make: *** [GNUmakefile] Error 2 > > The paragraph just above the example says this: > ---- > For example, if you have a makefile called `Makefile' that says how > to make the target `foo' (and other targets), you can write a makefile > called `GNUmakefile' that contains: > ---- > > I.e., you *first* must have a file "Makefile" in the current > directory. The error message you got says that you don't have that, > so of course the example doesn't work.
I expected that "make foo" would cause "frobnicate > foo" to be run and not require a file called Makefile to exist. I thought that the Makefile would only be used when a "make bar" is attempted. "make -d foo" says Reading makefiles... Reading makefile `GNUmakefile'... Updating makefiles.... Considering target file `GNUmakefile'. Looking for an implicit rule for `GNUmakefile'. Trying pattern rule with stem `GNUmakefile'. Trying rule prerequisite `force'. Found an implicit rule for `GNUmakefile'. Considering target file `force'. File `force' does not exist. Finished prerequisites of target file `force'. Must remake target `force'. Successfully remade target file `force'. Finished prerequisites of target file `GNUmakefile'. Prerequisite `force' of target `GNUmakefile' does not exist. Must remake target `GNUmakefile'. So what is happening is that the match-anything rule is being used to attempt to update GNUmakefile. It appears to do "make -f Makefile GNUmakefile" without showing me that command. So the example is correct but the error messages and debug output have confused me. -- Anthony Shipman Mamas don't let your babies a...@iinet.net.au grow up to be outsourced. _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make