From owner-freebsd-new-bus Wed Nov 17 22:48: 5 1999 Delivered-To: freebsd-new-bus@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 2D3F114A1D for ; Wed, 17 Nov 1999 22:48:01 -0800 (PST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id XAA09927 for ; Wed, 17 Nov 1999 23:48:00 -0700 (MST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id XAA22839 for ; Wed, 17 Nov 1999 23:48:21 -0700 (MST) Message-Id: <199911180648.XAA22839@harmony.village.org> To: new-bus@freebsd.org Subject: Makefile module cleanup Date: Wed, 17 Nov 1999 23:48:21 -0700 From: Warner Losh Sender: owner-freebsd-new-bus@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Right now nearly every makefile in the sys/modules tree has code that looks like: S = ${.CURDIR}/../.. SRCS= ... device_if.h bus_if.h isa_if.h CLEANS+= device_if.h bus_if.h isa_if.h device_if.h: $S/kern/makedevops.pl $S/kern/device_if.m perl $S/kern/makedevops.pl -h $S/kern/device_if.m bus_if.h: $S/kern/makedevops.pl $S/kern/bus_if.m perl $S/kern/makedevops.pl -h $S/kern/bus_if.m isa_if.h: $S/kern/makedevops.pl $S/isa/isa_if.m perl $S/kern/makedevops.pl -h $S/isa/isa_if.m Are there plans to make this more modular? I've cut and paste this same makefile code abotu 10 times now :-<. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-new-bus" in the body of the message From owner-freebsd-new-bus Thu Nov 18 1:42:34 1999 Delivered-To: freebsd-new-bus@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 18C4E14BEC for ; Thu, 18 Nov 1999 01:42:29 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from p132-ts5.syd2.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id UAA29460; Thu, 18 Nov 1999 20:49:16 +1100 Date: Thu, 18 Nov 1999 20:42:14 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Warner Losh Cc: new-bus@FreeBSD.ORG Subject: Re: Makefile module cleanup In-Reply-To: <199911180648.XAA22839@harmony.village.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-new-bus@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 17 Nov 1999, Warner Losh wrote: > > Right now nearly every makefile in the sys/modules tree has code that > looks like: > > S = ${.CURDIR}/../.. > SRCS= ... device_if.h bus_if.h isa_if.h > CLEANS+= device_if.h bus_if.h isa_if.h > > device_if.h: $S/kern/makedevops.pl $S/kern/device_if.m > perl $S/kern/makedevops.pl -h $S/kern/device_if.m >... > Are there plans to make this more modular? I've cut and paste this > same makefile code abotu 10 times now :-<. I've complained to people who cut and paste this spam :-). Plan: - repository-copy bsd.kmod.mk and bsd.kern.mk to sys/conf/maybe-better-names.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. - 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}. - 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. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-new-bus" in the body of the message From owner-freebsd-new-bus Thu Nov 18 19:53:15 1999 Delivered-To: freebsd-new-bus@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 9A8A115306 for ; Thu, 18 Nov 1999 19:53:10 -0800 (PST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id UAA13632; Thu, 18 Nov 1999 20:53:10 -0700 (MST) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id UAA30168; Thu, 18 Nov 1999 20:53:41 -0700 (MST) Message-Id: <199911190353.UAA30168@harmony.village.org> To: Bruce Evans Subject: Re: Makefile module cleanup Cc: new-bus@FreeBSD.ORG In-reply-to: Your message of "Thu, 18 Nov 1999 20:42:14 +1100." References: Date: Thu, 18 Nov 1999 20:53:41 -0700 From: Warner Losh Sender: owner-freebsd-new-bus@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message 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