问题
I have a quite complex (C++) project using autoconf / automake, which includes some "generated" files (foo.yy -> foo.cc). Actual builds are done using a "control script" (Gentoo .ebuild for those familiar with the concept), on various platforms.
Now, one of the target platforms does not properly support the foo.yy -> foo.cc step, and has to use the foo.cc file generated on a Linux box.
Now I have two ways to go about this:
1) Check in foo.cc into the project repository and somehow patch configure.in (or whatever) to include a timestamp check on foo.yy / foo.cc, generating a comprehensible error message if run on the target in question with an outdated foo.cc;
2) Check in foo.cc into the control script repository, and have the script control time stamps and give the error message.
I could do 2) no problem, but I don't think it's the right place to put foo.cc.
On the other hand, I don't know much about autoconf / automake, and wouldn't know how to implement a timestamp check / error message in configure.in (or whereever).
What are your suggestions, and would anyone here know how to go about solution 1)?
Edit: Solved using solution 3), tweaking the problematic target box until it is able to do the foo.yy -> foo.cc step itself. My problem is solved.
But I'll leave the question open - how to do timestamp checks / comprehensible error messages with autoconf / automake?
回答1:
From 8.8 in the Automake manual:
The intermediate files generated by ‘yacc’ (or ‘lex’) will be included in any distribution that is made. That way the user doesn't need to have ‘yacc’ or ‘lex’.
That makes it sound as if the problem you're describing should not exist.
来源:https://stackoverflow.com/questions/1164189/best-way-to-add-generated-files-to-distribution