Date: Tue, 01 Dec 2015 10:30:13 -0800 From: John Baldwin <jhb@freebsd.org> To: Warner Losh <imp@bsdimp.com> Cc: Sean Bruno <sbruno@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: sys/modules "make clean" seems broken again Message-ID: <4121969.dQSZfNjpat@ralph.baldwin.cx> In-Reply-To: <CANCZdfo8%2B0rtu99cnCr5-gCJqMnVw7Srv-kV9jf3VNkCt-s2gg@mail.gmail.com> References: <564E0322.8050308@freebsd.org> <565CB176.4070906@freebsd.org> <CANCZdfo8%2B0rtu99cnCr5-gCJqMnVw7Srv-kV9jf3VNkCt-s2gg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, November 30, 2015 02:44:54 PM Warner Losh wrote: > On Mon, Nov 30, 2015 at 1:28 PM, Sean Bruno <sbruno@freebsd.org> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA512 > > > > > > > > On 11/19/15 15:42, Warner Losh wrote: > > > > > > > > > On Thu, Nov 19, 2015 at 11:12 AM, John Baldwin <jhb@freebsd.org > > > <mailto:jhb@freebsd.org>> wrote: > > > > > > On Thursday, November 19, 2015 09:13:06 AM Sean Bruno wrote: > > >> I thought I fixed this a year or two ago, but now a "make clean" > > >> in sys/modules seems to leave bus_if.h device_if.h and pci_if.h > > >> in the directory. > > >> > > >> Should I just add these to the clean targets? > > > > > > Blame Warner as his MFILES changes broke this. In particular, see > > > r287263 which turned off cleaning these up. I'm not sure what that > > > broke that caused it to be disabled. > > > > > > Your change is a gross hack though. > > > > > > > > > Yes. The reason I had to break it was that there were a few files > > > named _if.c and _if.h in the tree that would get deleted when make > > > clean was run in the modules. > > > > > > I'll take another run at fixing this. Sean's "fix" is a horrible > > > hack. > > > > > > Warner > > > > > > Just bouncing a ping here. I haven't actually checked to see if the > > last weeks' commits to head fixed this, but I suspect this hasn't been > > addressed. What do we want to do different if not this hackery I propose? > > > > Your hackery wouldn't actually fix it completely, just mostly for a common > case. So which files broke before? Hmm, I guess just these: ./netpfil/pf/pf_if.c ./dev/oce/oce_if.c ./contrib/vchiq/interface/vchiq_arm/vchiq_if.h ./dev/oce/oce_if.h ./dev/mlx5/mlx5_rdma_if.h Honestly, I still think just having a single global list of MFILES in sys/conf/foo.mk instead of doing the find trick isn't that bad. Actually, can't we use __MPATH to do this instead? This seems to work: Index: conf/kern.pre.mk =================================================================== --- conf/kern.pre.mk (revision 291495) +++ conf/kern.pre.mk (working copy) @@ -208,6 +208,7 @@ # Calculate path for .m files early, if needed. .if !defined(_MPATH) __MPATH!=find ${S:tA}/ -name \*_if.m +_MFILES=${__MPATH:T:O} _MPATH=${__MPATH:H:O:u} .endif @@ -227,7 +228,7 @@ .if defined(DEBUG) MKMODULESENV+= DEBUG_FLAGS="${DEBUG}" .endif -MKMODULESENV+= _MPATH="${_MPATH}" +MKMODULESENV+= _MPATH="${_MPATH}" _MFILES="${_MFILES}" # Architecture and output format arguments for objdump to convert image to # object file Index: conf/kmod.mk =================================================================== --- conf/kmod.mk (revision 291495) +++ conf/kmod.mk (working copy) @@ -372,13 +372,11 @@ # Build _if.[ch] from _if.m, and clean them when we're done. .if !defined(_MPATH) __MPATH!=find ${SYSDIR:tA}/ -name \*_if.m +_MFILES=${__MPATH:T:O} _MPATH=${__MPATH:H:O:u} .endif .PATH.m: ${_MPATH} -.for _i in ${SRCS:M*_if.[ch]} -#removes too much, comment out until it's more constrained. -#CLEANFILES+= ${_i} -.endfor # _i +CLEANFILES+= ${_MFILES:R:S/$/.c/} ${_MFILES:R:S/$/.h/} .m.c: ${SYSDIR}/tools/makeobjops.awk ${AWK} -f ${SYSDIR}/tools/makeobjops.awk ${.IMPSRC} -c It bloats CLEANFILES a bit because it always cleans all generated m files even if they aren't present. If you wanted to be picky about it you could have a for loop that trims to just the used ones. This seems to work: % pwd /usr/home/john/work/freebsd/clean/sys/modules/oce % make -V CLEANFILES export_syms machine x86 if_oce.ko if_oce.kld oce_if.o oce_hw.o oce_mbox.o oce_util.o oce_queue.o oce_sysctl.o opt_inet.h opt_inet6.h bus_if.h device_if.h pci_if.h Index: conf/kern.pre.mk =================================================================== --- conf/kern.pre.mk (revision 291495) +++ conf/kern.pre.mk (working copy) @@ -208,6 +208,7 @@ # Calculate path for .m files early, if needed. .if !defined(_MPATH) __MPATH!=find ${S:tA}/ -name \*_if.m +_MFILES=${__MPATH:T:O} _MPATH=${__MPATH:H:O:u} .endif @@ -227,7 +228,7 @@ .if defined(DEBUG) MKMODULESENV+= DEBUG_FLAGS="${DEBUG}" .endif -MKMODULESENV+= _MPATH="${_MPATH}" +MKMODULESENV+= _MPATH="${_MPATH}" _MFILES="${_MFILES}" # Architecture and output format arguments for objdump to convert image to # object file Index: conf/kmod.mk =================================================================== --- conf/kmod.mk (revision 291495) +++ conf/kmod.mk (working copy) @@ -372,12 +372,16 @@ # Build _if.[ch] from _if.m, and clean them when we're done. .if !defined(_MPATH) __MPATH!=find ${SYSDIR:tA}/ -name \*_if.m +_MFILES=${__MPATH:T:O} _MPATH=${__MPATH:H:O:u} .endif .PATH.m: ${_MPATH} .for _i in ${SRCS:M*_if.[ch]} -#removes too much, comment out until it's more constrained. -#CLEANFILES+= ${_i} +_MATCH=M${_i:R:S/$/.m/} +_MATCHES=${_MFILES:${_MATCH}} +.if !empty(_MATCHES) +CLEANFILES+= ${_i} +.endif .endfor # _i .m.c: ${SYSDIR}/tools/makeobjops.awk ${AWK} -f ${SYSDIR}/tools/makeobjops.awk ${.IMPSRC} -c I've put this last one up at D4336. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4121969.dQSZfNjpat>