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/csharp/Makefile.am | 13 ++++++++++++- cscc/csharp/cs_defs.tc | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) Index: cscc/csharp/Makefile.am =================================================================== --- cscc/csharp/Makefile.am.orig +++ cscc/csharp/Makefile.am @@ -63,9 +63,22 @@ BUILT_SOURCES = $(STAMP) $(TREECC_OUTPUT libILCSharp_a_DEPENDENCIES = $(STAMP) +# 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) ../../codegen/$(STAMP) - $(TREECC) $(srcdir)/cs_defs.tc && touch $@ + 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) cs_defs.tc && touch $@; \ + rm -f $$codegen_tc; \ + if [ "`cd $(srcdir) && pwd`" != "`pwd`" ]; then \ + rm -f *.tc; \ + fi cs_scanner.l: cs_grammar.c CLEANFILES = cs_grammar.c cs_scanner.c cs_grammar.h $(TREECC_OUTPUT) $(STAMP) + Index: cscc/csharp/cs_defs.tc =================================================================== --- cscc/csharp/cs_defs.tc.orig +++ cscc/csharp/cs_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
