Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 1999 20:53:41 -0700
From:      Warner Losh <imp@village.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        new-bus@FreeBSD.ORG
Subject:   Re: Makefile module cleanup 
Message-ID:  <199911190353.UAA30168@harmony.village.org>
In-Reply-To: Your message of "Thu, 18 Nov 1999 20:42:14 %2B1100." <Pine.BSF.4.10.9911182021160.786-100000@alphplex.bde.org> 
References:  <Pine.BSF.4.10.9911182021160.786-100000@alphplex.bde.org>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSF.4.10.9911182021160.786-100000@alphplex.bde.org> Bruce Evans writes:
: Plan:
: - repository-copy bsd.kmod.mk and bsd.kern.mk to
:   sys/conf/maybe-better-names.mk.

I can see it now:

.include "${.CURDIR}/../../conf/maybe-better-names.mk"

:-)

Since we're moving to a "everything is a module" approach in the
kernel, wouldn't we just need bsd.module.mk?  Or does the remaining
husk of the kernel still need its own bsd.kernel.mk?

: - arrange to find bsd.kmod.mk there using searches like the ones now in
:   bsd.kmod.mk (only kernel makefiles and makefiles for modules in
:   sys/modules can use relative paths).  May need a stub bsd.kmod.mk
:   in the standard place.

ok.  That's actually one area of problem in the current scheme.  There
is no standard way to say "My kernel sources live here" so that the
gross rules for _if.h work.  No, /usr/src/sys/ isn't where my kernel
sources live :-).  ~imp/work/tsc/FreeBSD-tsc-3/sys happens to be the
place on this machine, but others have them in even odder locations.
The sources to my drivers live in ~imp/tsc-dev/drivers/{src,inc,lkm}
which has little or no relationship with the kernel sources most days.

: - put general rules like the one for device_if.h above in the
:   new bsd.kern.mk and remove them from module makefiles, kernel
:   makefiles, sys/conf/files and sys/${MACHINE}/conf/files.${MACHINE}.

So have a .m.h rule?  Cool, I like it.  At the very least, we could
define ${NORMAL_M2H} and ${NORMAL_M2C} (or use better names) so that
the kernel makefiles go from

device_if.c: $S/kern/makedevops.pl $S/kern/device_if.m
	perl5 $S/kern/makedevops.pl -c $S/kern/device_if.m

device_if.h: $S/kern/makedevops.pl $S/kern/device_if.m
	perl5 $S/kern/makedevops.pl -h $S/kern/device_if.m

to

device_if.c: $S/kern/device_if.m
	${NORMAL_M2C}

device_if.h: $S/kern/device_if.m
	${NORMAL_M2H}

But I kinda like the more generic:

PERL=perl5
MAKEDEVOPS=$S/kern/makedevops.pl
NORMAL_M2H= ${PERL} ${MAKEDEVOPS} -h $<
NORMAL_M2C= ${PERL} ${MAKEDEVOPS} -c $<
.SUFFIXES: ${.SUFFIXES} .m

.m.c:
	${NORMAL_M2C}
.m.h:
	${NORMAL_M2H}

for the bsd.module.mk, but I don't know how well make deals with two
levels of indirection like this (but for modules, one wouldn't need
the two levels of indirection...).

: - add support to the new bsd.kmod.mk for putting *_if.h in SRCS and
:   CLEANFILES as required.  The VFS_KLD macro handles this well for
:   vfs modules, but modules are probably too diverse for a generalisation
:   of this to work well.  I think I'll try requiring module makefiles
:   put the required foo_if.h's in SRCS.

I think that would work well because with the right .PATH directives
it will find the foo_if.m.

Hmmm, thinking out loud....

Maybe have a NEWBUS_H_FILES = foo_if.h bar_if.h and have, if nothing
else, a SRCS += ${NEWBUS_H_FILES} as well as a

.for i in ${NEWBUS_H_FILES}
$i: ${i:S/.h/.m/g} $S/kern/makedevops.pl
	${NORMAL_M2H}
.endfor

in bsd.module.mk and let the .PATH directive sort things out...

Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-new-bus" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911190353.UAA30168>