Re: module(7) vs KERN_AS (Re: HEADS-UP: Recent atari install floppy overflow)

Rin Okuyama <[email protected]> Wed, 19 Sep 2018 16:14:39 +0900
Newsgroups gmane.os.netbsd.current,gmane.os.netbsd.devel.kernel,gmane.os.netbsd.ports.atari
Message-ID <[email protected]>
I found that we already have a similar code in
sys/compat/common/Makefile.inc:

https://nxr.netbsd.org/xref/src/sys/compat/common/Makefile.inc#17

     17
     18  # Default values:
     19  COMPATDST?=             ${.OBJDIR}/lib/compat
     20  .if !empty(OPT_MODULAR)
     21  COMPAT_AS?=             library
     22  .else
     23  COMPAT_AS?=             obj
     24  .endif
     25  COMPATDOTDIR?= ../../.
     26

On 2018/09/19 15:57, Rin Okuyama wrote:
> Hi,
> 
> Currently, KERN_AS is set in Makefile.arch. However, it should be
> determined on whether module(7) is enabled or not, for *all* ports,
> something like
> 
>    OPT_MODULAR=    %MODULAR%
>    .if !empty(OPT_MODULAR)
>    KERN_AS=    obj
>    .else
>    KERN_AS=    library
>    .endif
> 
> Therefore, it is not a good idea to have the common segment of
> codes above in all Makefile.arch. We would have three options:
> 
> (1) use sys/conf/Makefile.conf
> 
> (2) add %MODULAR directive and emitmodular() function in config(1)
> 
> (3) set OPT_MODULAR in Makefile.arch, and change a default value for
> KERN_AS depending on its value in sys/lib/libkern/Makefile.inc
> 
> (1) does not work since %MODULAR% is not expanded if it is in
> sys/conf/Makefile.conf. And (2) seems too much for me. Therefore,
> I propose (3) as a compromise. Please find the attached patch (MD
> part is only for amd64 as an example).
> 
> Thoughts?
> 
> Thanks,
> rin
> 
> On 2018/09/18 21:52, [email protected] wrote:
>> I'd like to propose the following to remove dead code intended for
>> modules, which are not enabled.
>>