How to build kernel module spread on subdirectories?
Mel
fbsd.hackers at rachie.is-a-geek.net
Mon Dec 1 03:31:55 PST 2008
On Monday 01 December 2008 12:08:13 Nikola Knežević wrote:
> On 1 Dec 2008, at 01:22 , Tim Kientzle wrote:
> >> .MAKEFILEDEPS: elements.mk
> >> .sinclude "elements.mk"
> >> .include <bsd.kmod.mk>
> >> --->8---
> >> When I run make depend, it only includes SRCSs from BSDmakefile,
> >> not those from elements.mk.
> >
> > I would try adding a "beforedepend" requirement:
> >
> > beforedepend: elements.mk
> >
> > Look at /usr/share/mk/bsd.dep.mk, which has the 'make depend'
> > logic. It supports optional "beforedepend" and "afterdepend"
> > targets.
>
> Hi Tim,
> thanks for the tip.
>
> I've tried adding beforedepend: elements.mk rule before .sinclude.
>
> Unfortunately, everything is the same still. Is there a way to force
> explicitly what .MAKEFILEDEPS? beforedepend will create elements.mk,
> but that file won't be re-read and included before depend is called.
Does it have to be generated? What's the contents of that file after
generation and what generates it?
As you discovered, includes are done before targets. You would need seperate
invocations of make, to generate the file and get it included.
Maybe this will work, tho I doubt it (I expect the include to screw with the
beforedepend target):
beforedepend:
.if !exists(${.CURDIR}/elements.mk)
${MAKE} ${MAKEFLAGS} -f ${MAKEFILE} genmk
.endif
.if exists(${.CURDIR}/elements.mk)
.include "${.CURDIR}/elements.mk"
.endif
genmk:
# do whatever here to generate the mk file
--
Mel
More information about the freebsd-hackers
mailing list