Subject: misc/25887: Missing yacc dependency in bsd Make system
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <Peter.Bex@student.kun.nl>
List: netbsd-bugs
Date: 06/09/2004 23:50:53
>Number:         25887
>Category:       misc
>Synopsis:       Missing yacc dependency in bsd Make system
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 09 21:45:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 2.0_BETA
>Organization:
>Environment:
	
	
System: NetBSD frohike.nvie.com 2.0_BETA NetBSD 2.0_BETA (GENERIC) #0: Thu May 13 04:56:30 UTC 2004 autobuild@tgm.netbsd.org:/autobuild/netbsd-2-0/i386/OBJ/autobuild/netbsd-2-0/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	When one uses yacc in a project which includes bsd.lib.mk (and bsd.prog.mk
	as well, on 1.6.2 machines), changing the .y file does not result in
	recompilation of the matching lex file, which it should via the
	generated .h file.

>How-To-Repeat:
	Have foo.y and foo_lex.l and a working Makefile.  Then after lex/yacc
	steps we would have this:

	foo.y -> { foo.c, foo.h }
	foo_lex.l -> { foo_lex.c }

	foo_lex.c, after generating it from foo_lex.l has a  #include "foo.h".

	Run `make all'.  Change foo.y.  Run `make all' again.
	Now, foo_lex.c does not get recompiled, even though foo.h has
	been touched by yacc.

>Fix:
	Here's a patch for NetBSD 2.0_BETA:

--- bsd.lib.mk.orig     2004-06-09 23:15:09.000000000 +0200
+++ bsd.lib.mk  2004-06-09 23:16:38.000000000 +0200
@@ -403,6 +403,7 @@
        ${INSTALL_SYMLINK} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
 
 DPSRCS+=       ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
+DPSRCS+=       ${YHEADER:D${SRCS:M*.y:.y=.h}}
 CLEANFILES+=   ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
 CLEANFILES+=   ${YHEADER:D${SRCS:M*.y:.y=.h}}


	Here's two for NetBSD 1.6.2:
--- bsd.lib.mk.orig     Wed Jun  9 23:16:23 2004
+++ bsd.lib.mk  Wed Jun  9 23:23:40 2004
@@ -352,8 +352,8 @@
 __archivesymlinkpic: .USE
        ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
 
-DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/}
-CLEANFILES+=   ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
+DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
+CLEANFILES+=   ${DPSRCS}
 
 lib${LIB}.a:: ${OBJS} __archivebuild
        @echo building standard ${LIB} library


--- bsd.prog.mk.orig    Wed Jun  9 23:29:30 2004
+++ bsd.prog.mk Wed Jun  9 23:30:21 2004
@@ -91,8 +91,8 @@
 SRCS?=         ${PROG}.c
 .endif
 
-DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/}
-CLEANFILES+=   ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
+DPSRCS+=       ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
+CLEANFILES+=   ${DPSRCS}
 
 .if !empty(SRCS:N*.h:N*.sh:N*.fth)
 OBJS+=         ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}

>Release-Note:
>Audit-Trail:
>Unformatted: