Subject: toolchain/21453: [rkb] top-level Makefile doesn't use .PHONY for non-file-based tgts
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rafal@netbsd.org>
List: netbsd-bugs
Date: 05/04/2003 23:35:18
>Number:         21453
>Category:       toolchain
>Synopsis:       top-level Makefile (src/Makefile) doesn't use .PHONY
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 05 01:45:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Rafal
>Release:        NetBSD 1.6R
>Organization:
Seems to be at an all-time low...
>Environment:
System: NetBSD groo-the-wanderer 1.6R NetBSD 1.6R (STINKPAD) #0: Sun May 4 03:49:18 EDT 2003 rafal@groo-the-wanderer:/usr/rafal/netbsd-src/sys/arch/i386/compile/STINKPAD i386
Architecture: i386
Machine: i386

>Description:
	Because the intermediate build targets for building the complete
	NetBSD tree are not file-based targets, they should use .PHONY to
	always be re-made.  Otherwise, users dropping files into the top
	level of the source tree (like a build.sh wrapper) can cause the
	build to do strange things.

	I found this while trying to build 1.6.1 from a -current system,
	after creating a build.sh wrapper called 'do-build' in the top
	of my NetBSD source tree.  A lot of head-scratching later, I
	found a message saying the 'do-build' target was being skipped
	because it was up to date in the build log.

>How-To-Repeat:
	Create a 'do-build' file in the src/ directory (there are other
 	targets which will probably cause similarly odd or wierder cases
	in the top-level Makefile, this was just the one I tripped over
	myself).

	Run a 'build.sh build' or 'build.sh distribution'

	Watch the build fail in mysterious ways.
>Fix:
	Add a lot of .PHONYs to the top-level Makefile.  The change left
	as an exercise for the reader.  Alternately, document in BIG TYPE
	that dropping specific files in the src/ directory can cause odd
	build failures -- maybe even with a lot of the internal targets
	the build relies on.

>Release-Note:
>Audit-Trail:
>Unformatted:
 	Sources from May 3rd, 2003 CVS update