This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH to Makefile *parse.c rules


I like to set BISONFLAGS=-v so that if something is acting strange in the
parser, I can look at the *.output file.  Since the change to use $$ in the
output name, this has resulted in lots of pNNNN.output files accumulating
in the source directory.  This patch causes them to be renamed like the .c
files.

It also fixes the C++ and ObjC frontend hunks to fail the rule properly if
bison fails.

Tested i686-pc-linux-gnu.

2002-01-31  Jason Merrill  <jason@redhat.com>

	* Makefile.in (c-parse.c): Handle .output file.
	* objc/Make-lang.in (objc-parse.c): Likewise.
	* cp/Make-lang.in (parse.c): Handle .output file.

*** Makefile.in.~1~	Mon Jan 28 16:54:56 2002
--- Makefile.in	Thu Jan 31 15:42:13 2002
*************** c-parse.o : $(srcdir)/c-parse.c $(CONFIG
*** 1128,1135 ****
  	       -c $(srcdir)/c-parse.c $(OUTPUT_OPTION)
  
  $(srcdir)/c-parse.c: $(srcdir)/c-parse.y
! 	(cd $(srcdir) && $(BISON) $(BISONFLAGS) -o c-p$$$$.c c-parse.y && \
! 	mv -f c-p$$$$.c c-parse.c)
  $(srcdir)/c-parse.y: c-parse.in
  	echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
  	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
--- 1130,1144 ----
  	       -c $(srcdir)/c-parse.c $(OUTPUT_OPTION)
  
  $(srcdir)/c-parse.c: $(srcdir)/c-parse.y
! 	cd $(srcdir) && \
! 	if $(BISON) $(BISONFLAGS) -o c-p$$$$.c c-parse.y; then \
! 	  test -f c-p$$$$.output && mv -f c-p$$$$.output c-parse.output ; \
! 	  mv -f c-p$$$$.c c-parse.c ; \
! 	else \
! 	  rm -f c-p$$$$.* ; \
! 	  false ; \
! 	fi
! 
  $(srcdir)/c-parse.y: c-parse.in
  	echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
  	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
*** objc/Make-lang.in.~1~	Fri Dec 28 22:39:32 2001
--- objc/Make-lang.in	Thu Jan 31 15:43:44 2002
***************
*** 1,4 ****
! # Top level makefile fragment for GNU Objective-C
  #   Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
  
  #This file is part of GNU CC.
--- 1,4 ----
! # Top level -*- makefile -*- fragment for GNU Objective-C
  #   Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
  
  #This file is part of GNU CC.
*************** objc-parse.o : $(srcdir)/objc/objc-parse
*** 73,80 ****
  po-generated: $(srcdir)/objc/objc-parse.c
  $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y
  	cd $(srcdir)/objc; \
! 	$(BISON) $(BISONFLAGS) -o op$$$$.c objc-parse.y ; \
! 	mv -f op$$$$.c objc-parse.c
  
  $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
  	echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y
--- 73,85 ----
  po-generated: $(srcdir)/objc/objc-parse.c
  $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y
  	cd $(srcdir)/objc; \
! 	if $(BISON) $(BISONFLAGS) -o op$$$$.c objc-parse.y ; then \
! 	  test -f op$$$$.output && mv -f op$$$$.output objc-parse.output ; \
! 	  mv -f op$$$$.c objc-parse.c ; \
! 	else \
! 	  rm -f op$$$$.* ; \
! 	  false ; \
! 	fi
  
  $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
  	echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y
*** cp/Make-lang.in.~1~	Thu Jan 31 16:59:01 2002
--- cp/Make-lang.in	Thu Jan 31 15:28:41 2002
*************** $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.g
*** 120,129 ****
  
  $(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c
  $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
! 	@echo "Expect 36 shift/reduce conflicts and 58 reduce/reduce conflicts."
! 	cd $(srcdir)/cp; $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y ; \
! 	grep '^#define[ 	]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
! 	mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h
  
  #
  # Build hooks:
--- 120,135 ----
  
  $(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c
  $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
! 	@echo "Expect 31 shift/reduce conflicts and 58 reduce/reduce conflicts."
! 	cd $(srcdir)/cp && \
! 	if $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y; then \
! 	  grep '^#define[ 	]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
! 	  test -f p$$$$.output && mv -f p$$$$.output parse.output ; \
! 	  mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h ; \
! 	else \
! 	  rm -f p$$$$.* ; \
! 	  false ; \
! 	fi
  
  #
  # Build hooks:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]