On Wed, 2019-09-04 at 09:33 -0500, Kyle Evans wrote: > On Wed, Sep 4, 2019 at 9:27 AM Enji Cooper <yaneurabeya_at_gmail.com> > wrote: > > > > > > > On Sep 4, 2019, at 04:59, Poul-Henning Kamp <phk_at_phk.freebsd.dk> > > > wrote: > > > > > > On: > > > > > > Repository Root: svn+ssh://repo.freebsd.org/base > > > Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f > > > Revision: 351809 > > > > > > I built a kernel, but drm-current-kmod did not get compiled > > > from the new world order in /usr/local/sys/modules > > > > > > Debugging I ended up doing this to src/sys/conf/kern.post.mk: > > > > > > Index: sys/conf/kern.post.mk > > > ============================================================== > > > ===== > > > --- sys/conf/kern.post.mk (revision 351809) > > > +++ sys/conf/kern.post.mk (working copy) > > > _at__at_ -77,12 +77,14 _at__at_ > > > ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} > > > .endif > > > .for module in ${LOCAL_MODULES} > > > -.if !empty(module) > > > + true "XXX A $(module) 2 ${LOCALBASE} 3 ${LOCAL_MODULES} 4 > > > ${MODULES_WITH_WORLD}" > > > +#.if !empty(module) > > > + true "XXX B $(module) 2 ${LOCALBASE} 3 ${LOCAL_MODULES} 4 > > > ${MODULES_WITH_WORLD}" > > > _at_${ECHODIR} "===> ${module} > > > (${target:S/^reinstall$/install/:S/^clobber$/cleandir/})" > > > _at_cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} > > > ${MAKE} \ > > > DIRPRFX="${module}/" \ > > > ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} > > > -.endif > > > +#.endif > > > .endfor > > > .endif > > > .endfor > > > > > > This gives me the expected output from buildkernel: > > > > > > true "XXX A drm-current-kmod 2 /usr/local 3 drm-current-kmod 4 > > > " > > > true "XXX B drm-current-kmod 2 /usr/local 3 drm-current-kmod 4 > > > " > > > > > > If I leave in the ".if !empty(module)" line in, I only get: > > > > > > true "XXX A drm-current-kmod 2 /usr/local 3 drm-current-kmod 4 > > > " > > > > > > suggestions welcome... > > > > (CCing Kyle) > > > > This behavior change is probably caused by r351799. > > > > I personally think the code before Kyle’s change and after it was > > buggy. It’s not word splitting LOCAL_MODULES before iterating over > > it. > > > > I've backed out r351799 since it breaks usage of LOCAL_MODULES > (though > I really don't understand how empty works, apparently, and that makes > me sad)... please advise on a correct path forward, because it's not > clear to me. > > Thanks, > > Kyle Evans > I'm not positive, but I suspect this has to do with when variables are expanded. In particular, the loop variable for a .for is expanded on each loop iteration, but doesn't yet exist during parsing. I suspect that the .if is evaluated earlier, during parsing. For example, this makefile: all: .for x in a "" b .if empty(x) _at_echo empty .endif _at_echo ${x} .endfor _at_echo done gives this output: revolution > make -f /tmp/Makefile empty a empty empty b done The way I interpret that is that empty(x) is true during parsing, so the for loop is generated to contain "_at_echo empty" and "_at_echo ${x}", then the for loop actually runs and prints both "empty" and the value of ${x} on each iteration. -- IanReceived on Wed Sep 04 2019 - 12:58:50 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:21 UTC