Subject: sys.mk .y lossage
To: None <tech-toolchain@NetBSD.ORG>
From: Todd Vierling <tv@NetBSD.ORG>
List: tech-toolchain
Date: 04/01/1998 10:37:16
While working on problems with egcs, I found that our default sys.mk (and
the parallelized rules in bsd.sys.mk) use yacc to build a file with a .c
extension.  Funny enough, the default YFLAGS setting is `-d', which tells
yacc to create a header file as well.  The .mk files do nothing with the .h
files that are generated, and many programs hack around this in different
ways (set CLEANFILES to y.tab.h, set YFLAGS to null, override the .y.c rule
completely).

I've just added changes to the .mk files as follows:

- sys.mk and bsd.sys.mk do something with the .h files if they exist;
  if none were generated (i.e. user resets YFLAGS), do nothing.
- bsd.kmod.mk, bsd.lib.mk, and bsd.prog.mk are set to clean the .h files.

With these changes, things which try to do hackery by overriding the default
.y.c rule in order to get its hands on the .h file can simply use the rule
that is already in [bsd.]sys.mk, which is as it should be.  And now, egcs
clobbers nothing in the ``dist'' directory (commits for this to follow after
I work out one or two more kinks). 

NOTE that there is now a .y.h rule (identical to the .y.c rule).  This may
cause problems in the BSD source tree if dependencies are not correctly
marked out or the hackery mentioned at top is still there; I'm doing a find
on makefiles now to see what could be affected and will fix them too. 

ALSO NOTE, people working on egcs: you'll still see clobbering if you don't
remove your .depend files and regenerate them; the absolute paths to the
old, pregenerated files are still there.

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)