From 472e70f939922d7614e221e34c31325be28a78cc Mon Sep 17 00:00:00 2001 From: bde Date: Sat, 8 Jan 2000 18:48:57 +0000 Subject: Add "-I@/../include" and/or "-I${DESTDIR}/usr/include" to CFLAGS, essentially as in kernel makefiles, so that module sources can include 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. --- share/mk/bsd.kmod.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'share') 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 . 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 -- cgit v1.1