Paul Smith <psm...@gnu.org> writes: > On Tue, 2021-01-12 at 12:35 +0000, jerem...@pdp10.guru wrote: >> > After a quick squiz at your makefile I’m guessing line 42 should >> > not read >> > -o bin/M2-Planet >> > But rather >> > -o M2-Planet >> > Or even better: >> > -o $@ >> > No? >> > Similar changes for line 67 are probably in order >> >> No that does not correct the issue reported. >> As bin is in the VPATH on line 19. > > Whether bin is on VPATH is not relevant. That's not how VPATH works: > VPATH is _only_ useful for locating _source_ files (files that always > exist). It cannot be used for locating generated files. > > For more details read this: > > http://make.mad-scientist.net/papers/how-not-to-use-vpath/ > >> Further it would break the all of the tests. >> As they expect bin/M2-Planet. > > Your rule MUST ALWAYS build the target file that you told make they > would build. It's invalid, and will lead to breakage, if you tell make > that your recipe will create M2-Planet but it instead creates bin/M2- > Planet, which is a completely different file. > > As a result, as Malcolm says, all recipes should build $@ and never > some alternate version of that (like bin/$@ or whatever). > > If you really need the generated file to be bin/M2-Planet then your > target should build bin/M2-Planet: > > all: bin/M2-Planet > > bin/M2-Planet: ... > $(CC) ... -o $@ > > If you want to be able to run "make M2-Planet" you can create a > shortcut like this: > > M2-Planet: bin/M2-Planet
OK! Is that understood as a shortcut by make? So the "MUST ALWAYS build the target" does not apply in this case? Best regards -- Tomas