aboutsummaryrefslogtreecommitdiff
path: root/share/mk
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2000-01-08 18:48:57 +0000
committerBruce Evans <bde@FreeBSD.org>2000-01-08 18:48:57 +0000
commita0b845fe92c58a632c953e2d7013dd5767f69b5d (patch)
tree7b8e08a1cb6e1b10c8573dba79642f18fcd97942 /share/mk
parentfb0eb6fbd9ad1690f09b24356fc0badbf321456b (diff)
downloadsrc-a0b845fe92c58a632c953e2d7013dd5767f69b5d.tar.gz
src-a0b845fe92c58a632c953e2d7013dd5767f69b5d.zip
Add "-I@/../include" and/or "-I${DESTDIR}/usr/include" to CFLAGS,
essentially as in kernel makefiles, so that module sources can include <stddef.h> and other standard headers. Only add the second path when the first path can't be found, instead of when DESTDIR is defined. Adding it used to be just an obfuscation. Use "${.OBJDIR}" instyead of "." in -I paths. Using "${.OBJDIR}" just gave more verbose command lines and depend files.
Notes
Notes: svn path=/head/; revision=55624
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.kmod.mk15
1 files changed, 12 insertions, 3 deletions
diff --git a/share/mk/bsd.kmod.mk b/share/mk/bsd.kmod.mk
index bc5aa9947524..300d17ad8c1f 100644
--- a/share/mk/bsd.kmod.mk
+++ b/share/mk/bsd.kmod.mk
@@ -102,12 +102,21 @@ CFLAGS+= -nostdinc -I- ${_ICFLAGS}
# Add -I paths for system headers. Individual KLD makefiles don't
# need any -I paths for this. Similar defaults for .PATH can't be
# set because there are no standard paths for non-headers.
-CFLAGS+= -I${.OBJDIR} -I${.OBJDIR}/@
+CFLAGS+= -I. -I@
-# XXX this is now dubious.
-.if defined(DESTDIR)
+# Add a -I path to standard headers like <stddef.h>. Use a relative
+# path to src/include if possible. If the @ symlink hasn't been built
+# yet, then we can't tell if the relative path exists. Add both the
+# potential relative path and an absolute path in that case.
+.if exists(@)
+.if exists(@/../include)
+CFLAGS+= -I@/../include
+.else
CFLAGS+= -I${DESTDIR}/usr/include
.endif
+.else # !@
+CFLAGS+= -I@/../include -I${DESTDIR}/usr/include
+.endif # @
.if ${OBJFORMAT} == elf
CLEANFILES+= setdef0.c setdef1.c setdefs.h