Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Apr 2002 19:20:30 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        "David E. O'Brien" <obrien@FreeBSD.org>
Cc:        current@FreeBSD.org
Subject:   Re: cvs commit: src/gnu/usr.bin/cc/cc1 Makefile src/gnu/usr.bin/cc/cc1obj Makefile src/gnu/usr.bin/cc/cc1plus Makefile
Message-ID:  <20020407162030.GD67968@sunbay.com>
In-Reply-To: <200204040026.g340QLB32622@freefall.freebsd.org>
References:  <200204040026.g340QLB32622@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--eheScQNz3K90DVRs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Apr 03, 2002 at 04:26:21PM -0800, David E. O'Brien wrote:
> obrien      2002/04/03 16:26:21 PST
>=20
>   Modified files:
>     gnu/usr.bin/cc/cc1   Makefile=20
>     gnu/usr.bin/cc/cc1obj Makefile=20
>     gnu/usr.bin/cc/cc1plus Makefile=20
>   Log:
>   Clean up the YACCing.  I don't know why we cannot leave the .y's as .y'=
s.
>   So lets see if doing so causes anyone trouble.
>   Also use make(1)'s assistance in using the right file.  It knows the
>   dependency, so lets just ask it.
>  =20
>   Revision  Changes    Path
>   1.20      +3 -5      src/gnu/usr.bin/cc/cc1/Makefile
>   1.14      +2 -4      src/gnu/usr.bin/cc/cc1obj/Makefile
>   1.23      +2 -2      src/gnu/usr.bin/cc/cc1plus/Makefile
>=20
Yes it does cause trouble.

%%%
 c-parse.c c-parse.h: c-parse.in
        sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
            -e "/^ifc$$/d" -e "/^end ifc$$/d" \
-           ${GCCDIR}/c-parse.in > c-parse.y
+           ${.ALLSRC} > c-parse.y
        ${YACC} -d -o c-parse.c c-parse.y
-       mv c-parse.y c-parse.y.out
%%%

c-parse.c depends on c-parse.y (due to the standard .y.c: rule) and
${.ALLSRC} becomes "c-parse.in c-parse.y" in this case.  If c-parse.y
already exists but is stale, this results in sed(1) flooding your
entire ${.OBJDIR} disk with c-parse.c.  This created a 3G file on my
machine that had the time set incorrectly.  Here's the how-to-repeat:

: # pwd
: /usr/src/gnu/usr.bin/cc/cc1
: # make cleandir
: # make cleandir
: rm -f c-parse.c c-parse.h c-parse.y cc1 c-parse.o c-lang.o c-decl.o c-lex=
.o
: rm -f .depend /usr/src/gnu/usr.bin/cc/cc1/GPATH /usr/src/gnu/usr.bin/cc/cc
: 1/GRTAGS  /usr/src/gnu/usr.bin/cc/cc1/GSYMS /usr/src/gnu/usr.bin/cc/cc1/GT
: AGS
: # touch c-parse.y
: # make -n c-parse.c
: sed -e "/^ifobjc$/,/^end ifobjc$/d"  -e "/^ifc$/d"  -e "/^end ifc$/d"  /u=
sr/src/gn
: u/usr.bin/cc/cc1/../../../../contrib/gcc.295/c-parse.in c-parse.y > c-par=
se.y
                                                          ^^^^^^^^^^^^^^^^^=
^^^^
: yacc -d -o c-parse.c c-parse.y

While backing out these changes would be an option, below is the correct fi=
x.

While working on the fix in cc1obj, I also fixed the bug in bsd.prog.mk
and bsd.lib.mk (committed now); cc1obj/Makefile has "../cc_tools" in the
=2EPATH list, and this caused .if exists(${DEPENDFILE}) in bsd.prog.mk to
match "../cc_tools/.depend" and miss the (needed in this case) dependency
of ${OBJS} on ${SRCS:M*.h}.  In anycase, ../cc_tools is not needed here
so I removed it.

While grep(1)ping for the "\.PATH.*\.\." under the gnu/usr.bin/cc, I
noticed that you forgot to "cvs rm" cc_drv/Makefile -- it's no longer
needed as of gnu/usr.bin/cc/Makefile,v 1.21.

I have also cleaned up cc1plus/Makefile (with some black magic) to avoid
redefining standard yacc build rules.

Here's the complete patch:

%%%
Index: cc1/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/gnu/usr.bin/cc/cc1/Makefile,v
retrieving revision 1.23
diff -u -r1.23 Makefile
--- cc1/Makefile	4 Apr 2002 19:26:12 -0000	1.23
+++ cc1/Makefile	7 Apr 2002 16:15:04 -0000
@@ -2,10 +2,10 @@
=20
 .include "../Makefile.inc"
=20
-.PATH: ../cc_tools ${GCCDIR}
+.PATH: ${GCCDIR}
 =20
 PROG=3D	cc1
-SRCS=3D	c-parse.c c-parse.h c-lang.c
+SRCS=3D	c-parse.y c-lang.c
 # Ugh, compiled twice...
 SRCS+=3D	c-decl.c c-lex.c
 BINDIR=3D	/usr/libexec
@@ -19,15 +19,13 @@
=20
 #-----------------------------------------------------------------------
 # C parser
-.ORDER: c-parse.c c-parse.h
-c-parse.c c-parse.h: c-parse.in
+c-parse.y: c-parse.in
 	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
 	    -e "/^ifc$$/d" \
 	    -e "/^end ifc$$/d" \
 	    ${.ALLSRC} > c-parse.y
-	${YACC} -d -o c-parse.c c-parse.y
=20
-CLEANFILES+=3D	c-parse.c c-parse.h c-parse.y		# insurance
+CLEANFILES=3D	c-parse.y		# insurance
=20
 #-----------------------------------------------------------------------
=20
Index: cc1obj/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/gnu/usr.bin/cc/cc1obj/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- cc1obj/Makefile	4 Apr 2002 19:26:13 -0000	1.17
+++ cc1obj/Makefile	7 Apr 2002 16:15:04 -0000
@@ -2,10 +2,10 @@
=20
 .include "../Makefile.inc"
=20
-.PATH: ../cc_tools ${GCCDIR}/objc ${GCCDIR}
+.PATH: ${GCCDIR}/objc ${GCCDIR}
=20
 PROG=3D	cc1obj
-SRCS=3D	objc-parse.c c-parse.h objc-act.c
+SRCS=3D	objc-parse.y c-parse.h objc-act.c
 # Ugh, compiled twice...
 SRCS+=3D	c-decl.c c-lex.c
 BINDIR=3D	/usr/libexec
@@ -19,16 +19,16 @@
=20
 #-----------------------------------------------------------------------
 # objc parser
-.ORDER: objc-parse.c c-parse.h
-objc-parse.c c-parse.h: c-parse.in
+objc-parse.y: c-parse.in
 	sed -e "/^ifc$$/,/^end ifc$$/d" \
 	    -e "/^ifobjc$$/d" \
 	    -e "/^end ifobjc$$/d" \
 	    ${.ALLSRC} > objc-parse.y
-	${YACC} -d -o objc-parse.c objc-parse.y
-	mv objc-parse.h c-parse.h
=20
-CLEANFILES+=3D	objc-parse.c c-parse.h objc-parse.y		# insurance
+c-parse.h: objc-parse.h
+	ln -s ${.ALLSRC} ${.TARGET}
+
+CLEANFILES=3D	c-parse.h objc-parse.y		# insurance
=20
 #-----------------------------------------------------------------------
=20
Index: cc1plus/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/gnu/usr.bin/cc/cc1plus/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- cc1plus/Makefile	4 Apr 2002 00:50:14 -0000	1.24
+++ cc1plus/Makefile	7 Apr 2002 16:15:04 -0000
@@ -5,7 +5,7 @@
 .PATH: ${GCCDIR}/cp
=20
 PROG=3D	cc1plus
-SRCS=3D	parse.c parse.h
+SRCS=3D	parse.y y.tab.h parse.h
 SRCS+=3D	call.c class.c cvt.c decl.c decl2.c errfn.c error.c except.c expr=
.c \
 	friend.c init.c lex.c method.c pt.c ptree.c repo.c rtti.c \
 	search.c semantics.c sig.c spew.c tree.c typeck.c typeck2.c xref.c
@@ -18,12 +18,11 @@
 DPADD+=3D	${LIBCC_INT}=20
 LDADD+=3D	${LIBCC_INT}
=20
-.ORDER: parse.c parse.h
-parse.c parse.h: parse.y
-	${YACC} -d -o parse.c ${.ALLSRC}
-	grep '^#define[   ]*YYEMPTY' parse.c >>parse.h
+parse.h: y.tab.h parse.c
+	cp y.tab.h ${.TARGET}
+	grep '^#define[   ]*YYEMPTY' parse.c >>${.TARGET}
=20
-CLEANFILES+=3D	parse.c parse.h
+CLEANFILES=3D	parse.h
=20
 CPPHDRS=3D	exception new new.h typeinfo
=20
Index: cc_drv/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: cc_drv/Makefile
diff -N cc_drv/Makefile
--- cc_drv/Makefile	24 Jan 2000 08:44:30 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
-# $FreeBSD: src/gnu/usr.bin/cc/cc_drv/Makefile,v 1.11 2000/01/24 08:44:30 =
obrien Exp $
-
-.include "../Makefile.inc"
-
-.PATH: ../cc_tools ${GCCDIR}
-
-LIB=3D		cc_drv
-NOPROFILE=3D	YES
-NOPIC=3D		YES
-
-SRCS=3D	multilib.h choose-temp.c obstack.c prefix.c pexecute.c version.c
-
-CFLAGS+=3D	-DIN_GCC
-
-install:
-	@true
-
-${OUT_OBJ}.o ${OUT_OBJ}.so:	${OUT_FILE}
-
-.include <bsd.lib.mk>
%%%


Cheers,
--=20
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--eheScQNz3K90DVRs
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE8sHHOUkv4P6juNwoRApmjAJ9pO/RsehIlgzj47ngk6E6yvI5SuQCfTPzK
/2/pq1xeLMC+dxnYFjl3zpk=
=quLY
-----END PGP SIGNATURE-----

--eheScQNz3K90DVRs--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020407162030.GD67968>