summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.kmod.mk
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-01-08 18:48:57 +0000
committerbde <bde@FreeBSD.org>2000-01-08 18:48:57 +0000
commit472e70f939922d7614e221e34c31325be28a78cc (patch)
treece6c24e200cf7c482917c8685f0a9aca5993e3fb /share/mk/bsd.kmod.mk
parent65e9d529985e2b65acf40e38f03b2ecef43674c5 (diff)
downloadFreeBSD-src-472e70f939922d7614e221e34c31325be28a78cc.zip
FreeBSD-src-472e70f939922d7614e221e34c31325be28a78cc.tar.gz
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.
Diffstat (limited to 'share/mk/bsd.kmod.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 bc5aa99..300d17a 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
OpenPOWER on IntegriCloud