Subject: bin/2134: CPPFLAGS broken if third-party Makefiles use DESTDIR
To: None <gnats-bugs@NetBSD.ORG>
From: Chris G. Demetriou <cgd@sun-lamp.pc.cs.cmu.edu>
List: netbsd-bugs
Date: 02/26/1996 15:26:30
>Number:         2134
>Category:       bin
>Synopsis:       DESTDIR is bogusly used to set CPPFLAGS in sys.mk
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 26 15:35:02 1996
>Last-Modified:
>Originator:     Chris G. Demetriou
>Organization:
Kernel Hackers 'r' Us
>Release:        NetBSD-current, Feb. 26, 1996
>Environment:
System: NetBSD sun-lamp.pc.cs.cmu.edu 1.1A NetBSD 1.1A (SUN_LAMP) #9: Fri Feb 23 14:38:42 EST 1996 cgd@sun-lamp.pc.cs.cmu.edu:/a/netbsd-src/working/src/sys/arch/i386/compile/SUN_LAMP i386


>Description:
	sys.mk does:

	.if defined(DESTDIR)
	CPPFLAGS+=      -nostdinc -idirafter ${DESTDIR}/usr/include
	.endif

	The problem is, some, if not many, third-party Makefiles use
	recursive makes and DESTDIR for their own purposes, and do NOT
	want those "special" changes to CPPFLAGS applied...

>How-To-Repeat:
	Build a program which uses recursive invocations of 'make' and
	which sets DESTDIR on the command line (for whatever reason).
	(I ran into this problem while trying to build the AFS client
	sources.)

	As a quick example, try:

	(echo "#include <sys/types.h>"; echo "main() {}") > foo.c
	echo "foo: foo.c" > Makefile
	make DESTDIR=foobar
	
>Fix:
	Remove those three lines from sys.mk.  However, that would break
	functionality which some people like.

	Possibly do the CPPFLAGS set if defined(DESTDIR) in bsd.sys.mk?
>Audit-Trail:
>Unformatted: