Subject: bin/5204: There's no (safe) way to add files into the 'make depend' mix.
To: None <>
From: None <cgd@NetBSD.ORG>
List: netbsd-bugs
Date: 03/25/1998 22:33:20
>Number:         5204
>Category:       bin
>Synopsis:       There's no (safe) way to add files into the 'make depend' mix.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 25 22:35:00 1998
>Originator:     Chris G. Demetriou
Kernel Hackers 'r' Us
>Release:        NetBSD-current as of Wed Mar 25 22:08:36 PST 1998
System: NetBSD 1.3E NetBSD 1.3E (BRICK) #47: Sun Mar 22 15:13:37 PST 1998 i386

	Some users of the system .mk templates want to be able to add
	files into the list of files for which dependencies are generated
	when 'make depend' is run.  There's currently no "good" way to do
	that.  The contents of ${SRCS} and ${DPSRCS} are fed to mkdep,
	but each of those variables has problems: ${SRCS} is used to
	create the list of objects used to build the main target for
	the directory, and ${DPSRCS} are removed when 'make clean' is

	An example of a use where you'd want to get a file run through
	mkdep is lint stubs for libraries' assembly functions.  They're
	static source files (aren't generated, shouldn't be removed),
	but you _do_ want dependencies generated for them.  (It's
	infeasible to hard-code those dependencies in the Makefiles that
	cause the files to be used, because the set of MD headers they
	use may change, etc., and having to modify the Makefiles in
	that case is a maintenance nightmare.)

	Intuitively, I thought that "DPSRCS" was the right variable to
	use (DPSRCS read as "additional sources to mkdep" to me), but
	then i noticed the cleaning behaviour.

	Some current users of DPSRCS are want the cleaning behaviour.
	However, some don't (e.g. libc, libposix).  The latter set can
	get by with the current behaviour, because of the way their
	directory structures are set up, but that's fragile and not
	particularly safe.

	Find a need to get dependencies made for a file, without
	wanting that file to be removed when cleaning.

	Try to do that with the standard make templates.


	Add a variable that does the right thing.  I think DPSRCS is
	the right name for the variable which adds things to the list
	to be mkdep'd but which _don't_ get removed when cleaning.

	I'd suggest adding a MAKEDPSRCS variable which gets fed to
	mkdep, and replace the uses of DPSRCS in ksh and tn3270
	with uses of MAKEDPSRCS.  Additionally, the lines in, and which set DPSRCS
	from .l and .y files in SRCS, which make the
	directories' main targets depend on DPSRCS, and which
	cause DPSRCS to be removed when cleaning should be changed
	to modify, use, and clean MAKEDPSRCS instead.