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/bf/Makefile.am | 14 +++++++++++++- cscc/bf/bf_defs.tc | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) Index: cscc/bf/Makefile.am =================================================================== --- cscc/bf/Makefile.am.orig +++ cscc/bf/Makefile.am @@ -49,8 +49,20 @@ BUILT_SOURCES = $(STAMP) $(TREECC_OUTPUT libILBf_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)/bf_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) bf_defs.tc && touch $@; \ + rm -f $$codegen_tc; \ + if [ "`cd $(srcdir) && pwd`" != "`pwd`" ]; then \ + rm -f *.tc; \ + fi bf_scanner.l: bf_grammar.c Index: cscc/bf/bf_defs.tc =================================================================== --- cscc/bf/bf_defs.tc.orig +++ cscc/bf/bf_defs.tc @@ -22,7 +22,7 @@ */ %} -%include %readonly "../../codegen/cg_all.tc" +%include %readonly "cg_all.tc" %header "bf_defs.h" %output "bf_nodes.c" -- 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
