I have a problem with depdency ordering of a source file which includes a generated file. For example, in a file called unit.cpp
I have this:
#include "generated.hpp"
Where generated.hpp
is a generated file and will be produced in the output include directories. Now, this file is generated via an intermediate command, with a makefile rule such as:
.build-generated:
cmd.sh ... > include/generated.hpp
touch $@
The building of the unit.o
file thus requires that .build-generated
is called first. If I do the following I confuse the resulting makefile:
unit.cpp: .build-generated
Since the make will now assume that unit.cpp
is a generated file and ignore the one in the source directory (only if .build-generated has to be remade). I've looked at the verbose make output and it says it is ignoring the one in the VPATH.
In a normal makefile I might make unit.o
depend on the other target, but this doesn't appear to be the automake way (as it may not be portable). It actually doesn't even work, since the target may be a .lo
file instead
How can I properly tell automake about this dependency?