kmod.mk - modules build framework [was: svn commit: r193818 - head/sys/modules/sound/sound]

Bruce Evans brde at optusnet.com.au
Wed Jun 10 09:37:09 UTC 2009


On Tue, 9 Jun 2009, Bjoern A. Zeeb wrote:

> On Tue, 9 Jun 2009, Bjoern A. Zeeb wrote:
>> Log:
>>  Depend on @ machine (_ILINKS) as we do with other modules so that @
>>  is there for parallel (-jN) builds.  Ideally beforedepends in kmod.mk
>>  should do the right thing but it seems it does not.
>
> Anyone with lots of build framework know how may want to look at this.

Failures only for parallel builds normally mean missing dependencies.

>> -feeder_eq_gen.h:
>> +feeder_eq_gen.h:	@ machine
>> 	${AWK} -f @/tools/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > 
>> ${.TARGET}

Here there is still a missing dependency on the
@/tools/feeder_eq_mkfilter.awk (fixed in the next commit).  This dependency
is not very important, but since the utility has "@" in its pathname,
running it certainly depends on "@".

This missing dependency seems to be a general bug.  There is an ordering
requirement that beforedepend is before built before ${DEPENDFILE},
but this apparently doesn't extend to ${DEPENDFILE}'s prerequisites,
and I don't know of any general way to make it do so and it probably
shouldn't do so in general (some of the prerequisites might be needed
before beforedepend).  In kmod.mk, all generated sources should depend
on each link, like all objects do, but modules makefiles have no way
of distinguishing generated sources from ordinary ones.

> PS: In case you do I'd have another request to be able to have an
> option similar to COPTFLAGS that will actually be passed down to
> module builds - at least for make buildkernel/universe/..

COPTFLAGS is a mistake, as is setting CFLAGS using "=" in kern.pre.mk.
Since kmod.mk doesn't have these mistakes, there is a chance that ordinary
setting of CFLAGS works right.  It does seem to work right for single
module builds.  I don't know what happens when modules are built as
part of a kernel (maybe kern.pre.mk has already clobbered CFLAGS?), and
there is always the problem that it is difficult to control the order
of CFLAGS when individual makefiles add to the end of it.  kern.pre.mk
uses:

 	CFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}

where ${DEBUG} provides good control since it is almost at the end
(${COPTS} only has include paths and some other things that wouldn't
be useful to override).  Since ${DEBUG} is also passed to modules
makefiles (as DEBUG_FLAGS in the environment), it might help.

Bruce


More information about the svn-src-head mailing list