Make ignoring Prerequisite that doesn't exist
gnu-make, makefile
Solution
Most likely you have implemented an automatic dependency generation method that tells make to essentially ignore those files if they don't exist, by defining a target for that file without a rule. When I have this makefile:
foo: foo.h ; @echo make $@ from $^
And no `foo.h` then make tells me:
$ make
make: **** No rule to make target 'foo.h', needed by 'foo'. Stop.
But, if I have this makefile:
foo: foo.h ; @echo make $@ from $^
foo.h:
Now make is perfectly happy:
$ make
make foo from foo.h
That's a documented behavior that many auto-dependency generation utilities rely on: if you look in your generated dependency makefiles you'll see one of those empty targets for every header file.
The idea is that given correct dependency information there should never be a way to rename or delete a header file without modifying some other source or header file, which would cause the object file to be rebuilt anyway (hence recreating the dependency information correctly for the next time).
Problem
`make` continues to build and says everything is up to date when my dependency files say an object depends on a header file that has moved. If run `make -d` to capture the evaluation I see: ``` Considering target file `../build/out/src/manager.o'. Looking for an implicit rule for `../build/out/src/manager.o'. No implicit rule found for `../build/out/src/manager.o'. Pruning file `../product/build/config/product.conf'. Pruning file `../build/out/opt_cc.txt'. Considering target file `../mem/src/manager.c'. Looking for an implicit rule for `../mem/src/manager.c'. No implicit rule found for `../mem/src/manager.c'. Finished prerequisites of target file `../mem/src/manager.c'. No need to remake target `../mem/src/manager.c'. Pruning file `../mem/mem.h'. Finished prerequisites of target file `../build/out/src/manager.o'. Prerequisite `../product/build/config/product.conf' is older than target `../build/out/src/manager.o'. Prerequisite `../build/out/opt_cc.txt' is older than target `../build/out/src/manager.o'. Prerequisite `../mem/src/manager.c' is older than target `../build/out/src/manager.o'. Prerequisite `../mem/mem.h' of target `../build/out/src/manager.o' does not exist. ../build/out/src/manager.o'. Prerequisite `../mem/mem_in.h' is older than target `../build/out/src/manager.o'. No need to remake target `../build/out/src/manager.o'. ``` So make knows the file is needed and is not there but doesn't attempt to create it from a rule or fail. ``` Prerequisite `../mem/mem.h' of target `../build/out/src/manager.o' does not exist. ``` Why is this and how can I get make to not ignore this rule?