>>>>> "Andrew" == Andrew S Townley <[EMAIL PROTECTED]> writes:
Andrew> Hi. I have been trying to add support for our ESQL/C
Andrew> preprocessor to an Automake makefile, but I'm having trouble
Andrew> with a couple of different things.
Andrew> The extra sed command is there so that the dependencies will
Andrew> actually be set to the .ec file instead of the generated .c
Andrew> file and the generated file is removed at the end. This works
Andrew> great as long as the esql command completes successfully. If
Andrew> the esql command fails, the generated file is not removed and
Andrew> the next time the compile takes place, it doesn't reprocess
Andrew> the .ec file due to the implicit rules.
You're saying that if the esql command fails, it still leaves the .c
file, and so the .c.o rule is run the next time?
Oops. Programs like this should always remove their temporary files.
You could write a shell script to wrap esql and remove the file.
Or you could do it in the Makefile rule, but that would be more ugly:
esql ... ; status=$$?; rm -f temp-file > /dev/null 2>&1; exit $$status
Andrew> I guess my questions boil down to: 1) is this the right way to
Andrew> integrate a new target into the automake dependency rules, and
Andrew> 2) without adding suffix rules for .ec -> .c -> .o, is there a
Andrew> better way to do it?
Your approach looks fine to me, except for the temp file thing.
Andrew> With regards to the 1st question, I am wondering if the
Andrew> solution is linux-specific and therefore won't work on other
Andrew> platforms with non GNU C compilers.
It is gcc-specific, not Linux-specific.
The -Wp stuff is a gcc thing.
You can just eliminate that if you don't mind getting rid of
dependency tracking.
There's no real way to have both without hacking automake itself :-(
(At least, not in 1.4.)
Tom