On 'make distcheck', autotools try to package the source tree with 'make dist' first, then extract it and try to build it out-of-tree.
Unfortunately, treecc has no option which says "the source is $here, but put the output to $there". -d looks like that, but seems to work only for Java. This patch works around this problem by finding out if we are doing an out-of-tree build and copying the sources into the build dir in that case, then running treecc and removing the .tc files afterwards. It is a little bit hacky, but I don't see a better solution as long as treecc doesn't support a proper -d option for all languages. Signed-off-by: Robert Schwebel <[EMAIL PROTECTED]> --- cscc/c/Makefile.am | 14 ++++++++++++-- cscc/c/c_defs.tc | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) Index: cscc/c/Makefile.am =================================================================== --- cscc/c/Makefile.am.orig +++ cscc/c/Makefile.am @@ -70,8 +70,20 @@ BUILT_SOURCES = $(STAMP) $(TREECC_OUTPUT libILCLang_a_DEPENDENCIES = $(STAMP) -$(STAMP): $(TREECC_INPUTS) ../../codegen/$(STAMP) - $(TREECC) $(srcdir)/c_defs.tc && touch $@ +# Hack alert: if we build out of tree, copy sources to here, +# because treecc has no option to define the output directory + +$(STAMP): $(TREECC_INPUTS) $(top_builddir)/codegen/$(STAMP) + if [ "`cd $(srcdir) && pwd`" != "`pwd`" ]; then \ + cp -f $(srcdir)/*.tc .; \ + fi; \ + codegen_tc=`cd $(top_srcdir)/codegen && find . -name "*.tc"`; \ + for i in $$codegen_tc; do cp $(top_srcdir)/codegen/$$i .; done; \ + $(TREECC) c_defs.tc && touch $@; \ + rm -f $$codegen_tc; \ + if [ "`cd $(srcdir) && pwd`" != "`pwd`" ]; then \ + rm -f *.tc; \ + fi c_scanner.l: c_grammar.c Index: cscc/c/c_defs.tc =================================================================== --- cscc/c/c_defs.tc.orig +++ cscc/c/c_defs.tc @@ -21,7 +21,7 @@ /* * Inherit the common definitions. */ -%include %readonly "../../codegen/cg_all.tc" +%include %readonly "cg_all.tc" /* * Set a new header for definitions that follow. -- Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de Pengutronix - Linux Solutions for Science and Industry Handelsregister: Amtsgericht Hildesheim, HRA 2686 Hannoversche Str. 2, 31134 Hildesheim, Germany Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9 _______________________________________________ Developers mailing list [email protected] http://dotgnu.org/mailman/listinfo/developers
