From owner-freebsd-current@freebsd.org Tue Jan 26 15:38:53 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34566A6EB5E for ; Tue, 26 Jan 2016 15:38:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0EEC164C for ; Tue, 26 Jan 2016 15:38:52 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 796161FE023; Tue, 26 Jan 2016 16:38:50 +0100 (CET) Subject: Re: How to add custom C-flags to kernel depend? To: FreeBSD Current , Drew Gallatin References: <56A754DE.4060404@selasky.org> From: Hans Petter Selasky Message-ID: <56A79394.5000601@selasky.org> Date: Tue, 26 Jan 2016 16:41:08 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56A754DE.4060404@selasky.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2016 15:38:53 -0000 On 01/26/16 12:13, Hans Petter Selasky wrote: > Hi, > > I would like to remove the no-depend keyword from drivers using the > LINUXKPI_C in the kernel. Currently it fails like this: > >> sys/ofed/drivers/infiniband/core/mad.c:36:10: fatal error: >> 'linux/dma-mapping.h' file not found >> #include >> ^ >> 1 error generated. > > That's very easy to fix, by simply adding the correct include path to > the C-flags of depend, though then all kernel files will have that > include path added. What is the best way to fix this? > > I see ZFS has made a solution and can we extend this scheme? > >> # We have "special" -I include paths for zfs/dtrace files in 'depend'. >> CFILES_NOCDDL= ${CFILES:N*/cddl/*:N*fs/nfsclient/nfs_clkdtrace*} >> SFILES_NOCDDL= ${SFILES:N*/cddl/*} >> CFILES_CDDL= ${CFILES:M*/cddl/*} >> SFILES_CDDL= ${SFILES:M*/cddl/*} > Does the following look OK? > Index: kern.post.mk > =================================================================== > --- kern.post.mk (revision 294311) > +++ kern.post.mk (working copy) > @@ -186,12 +186,20 @@ > > ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h > > +# Normal files first > +CFILES_NORMAL= ${CFILES:N*/cddl/*:N*fs/nfsclient/nfs_clkdtrace*:N*/compat/linuxkpi/*:N*/ofed/*:N*/mlx5/mlx5*} > +SFILES_NORMAL= ${SFILES:N*/cddl/*} > + > # We have "special" -I include paths for zfs/dtrace files in 'depend'. > -CFILES_NOCDDL= ${CFILES:N*/cddl/*:N*fs/nfsclient/nfs_clkdtrace*} > -SFILES_NOCDDL= ${SFILES:N*/cddl/*} > CFILES_CDDL= ${CFILES:M*/cddl/*} > SFILES_CDDL= ${SFILES:M*/cddl/*} > > +# We have "special" -I include paths for LinuxKPI. > +CFILES_LINUXKPI=${CFILES:M*/compat/linuxkpi/*} > + > +# We have "special" -I include paths for OFED. > +CFILES_OFED=${CFILES:M*/ofed/*:M*/mlx5/mlx5*} > + > kernel-depend: .depend > # The argument list can be very long, so use make -V and xargs to > # pass it to mkdep. > @@ -219,12 +227,20 @@ > .depend: .PRECIOUS ${SRCS} > .if ${MK_FAST_DEPEND} == "no" > rm -f ${.TARGET}.tmp > - ${MAKE} -V CFILES_NOCDDL -V SYSTEM_CFILES -V GEN_CFILES | \ > +# C files > + ${MAKE} -V CFILES_NORMAL -V SYSTEM_CFILES -V GEN_CFILES | \ > CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${CFLAGS} > ${MAKE} -V CFILES_CDDL | \ > CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_CFLAGS} \ > ${FBT_CFLAGS} ${DTRACE_CFLAGS} > - ${MAKE} -V SFILES_NOCDDL | \ > + ${MAKE} -V CFILES_LINUXKPI | \ > + CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \ > + ${CFLAGS} ${LINUXKPI_INCLUDES} > + ${MAKE} -V CFILES_OFED | \ > + CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \ > + ${CFLAGS} ${OFEDINCLUDES} > +# Assembly files > + ${MAKE} -V SFILES_NORMAL | \ > CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ASM_CFLAGS} > ${MAKE} -V SFILES_CDDL | \ > CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_ASM_CFLAGS} --HPS