Subject: misc/4129: rule for mkdep doesn't obey DESTDIR
To: None <>
From: Jeremy Cooper <>
List: netbsd-bugs
Date: 09/21/1997 00:47:43
>Number:         4129
>Category:       misc
>Synopsis: doesn't use correct header flags when DESTDIR is set
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 21 00:50:01 1997
>Originator:     Jeremy Cooper
>Release:        NetBSD-current-9-20-1997

When building the source tree with the environment variable DESTDIR set,
all compiler tools should prevent the inclusion of header files from
/usr/include and use $DESTDIR/usr/include instead.  This is to prevent the
header files of belonging to the build system from being used during the
build process.  While it currently works correctly for the compilation phase
of the build, the dependency generation phase that usually preceeds it
(make depend) does not.

The problem likely lies in the ``depend'' rule in  It uses the
variable CPPFLAGS where all other build rules use CFLAGS.  While this is
probably correct, since mkdep is a pre-processor scanner rather than compiler,
the inconsistency of header flags between the two variables needs to be

(This example shows how to repeat an error message noticed
 by using a NetBSD-1.2 m68k system to build NetBSD-current.)

  # set DESTDIR environment variable  (here, /mnt/build)
  # cd /mnt/src/lib/csu && make depend
  ===> m68k
  mkdep -a -DLIBC_SCCS -I/mnt/src/lib/csu/m68k/.. -DDYNAMIC crt0.c
  In file included from crt0.c:43:
  /mnt/src/lib/csu/m68k/../common.h:52: link.h: No such file or directory

The mkdep line above should have additionally included the flags:
  -nostdinc -I/mnt/build/usr/include