I'm using this rule to substitute values in a sourcefile:
corelib/camlimages.ml: Makefile corelib/camlimages.ml.in
rm -f corelib/camlimages.ml corelib/camlimages.ml.tmp
sed \
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
...
corelib/camlimages.ml.in > corelib/camlimages.ml.tmp
mv corelib/camlimages.ml.tmp corelib/camlimages.ml
As detailed in autoconf documentation
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_mono/autoconf.html#SEC24
However, make keep complaining about a circular dependency issue:
make[1]: Circular corelib/camlimages.ml <- Makefile dependency dropped.
I guess it's because generated makefile has itself a rule triggering
configure again, but I can't find where it's related to
corelib/camlimages.ml, neither how to break the loop.