Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



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, maya%netbsd.org@localhost wrote:
I'd like to propose the following to remove dead code intended for
modules, which are not enabled.

Index: sys/conf/Makefile.kern.inc
===================================================================
RCS file: /home/netbsd/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.265
diff -p -u -r1.265 Makefile.kern.inc
--- sys/conf/Makefile.kern.inc	27 Aug 2018 05:35:22 -0000	1.265
+++ sys/conf/Makefile.kern.inc	19 Sep 2018 06:34:04 -0000
@@ -157,8 +157,8 @@ LINK_O?=	@${_MKSHMSG} "   link  ${.CURDI
 ##
 ## (3) libkern and compat
 ##
-## Set KERN_AS in the port Makefile to "obj" or "library".  The
-## default is "library", as documented in $S/lib/libkern/Makefile.inc.
+## Set OPT_MODULAR in the port Makefile if module(7) should be enabled,
+## as documented in $S/lib/libkern/Makefile.inc.
 ##
 
 ### find out what to use for libkern
Index: sys/lib/libkern/Makefile.inc
===================================================================
RCS file: /home/netbsd/src/sys/lib/libkern/Makefile.inc,v
retrieving revision 1.45
diff -p -u -r1.45 Makefile.inc
--- sys/lib/libkern/Makefile.inc	27 May 2018 01:14:50 -0000	1.45
+++ sys/lib/libkern/Makefile.inc	19 Sep 2018 06:31:38 -0000
@@ -7,7 +7,8 @@
 #		objects are to be built.  Defaults to ${.OBJDIR}/lib/kern.
 #	KERN_AS	may be set to 'obj' to build a object from the library's
 #		object files.  (Otherwise, a library will be built.)
-#		Defaults to 'library'.
+#		Defaults to 'obj' if OPT_MODULAR is set. Otherwise,
+#		'library' is used as a default value.
 #	KERNMISCCPPFLAGS
 #		Miscellaneous cpp flags to be passed to the library's Makefile
 #		when building.
@@ -18,7 +19,13 @@
 
 # Default values:
 KERNDST?=	${.OBJDIR}/lib/kern
-KERN_AS?=	library
+.if !defined(KERN_AS)
+.if !empty(OPT_MODULAR)
+KERN_AS=	obj
+.else
+KERN_AS=	library
+.endif
+.endif
 KERNDOTDIR?= ../../.
 
 KERNDIR=	${S:S@^.@${KERNDOTDIR}@:q}/lib/libkern
Index: sys/arch/amd64/conf/Makefile.amd64
===================================================================
RCS file: /home/netbsd/src/sys/arch/amd64/conf/Makefile.amd64,v
retrieving revision 1.73
diff -p -u -r1.73 Makefile.amd64
--- sys/arch/amd64/conf/Makefile.amd64	22 Aug 2018 12:07:42 -0000	1.73
+++ sys/arch/amd64/conf/Makefile.amd64	19 Sep 2018 06:22:20 -0000
@@ -63,11 +63,6 @@ CFLAGS+=	${KASANFLAGS.${.IMPSRC:T}:U${KA
 ## (3) libkern and compat
 ##
 OPT_MODULAR=	%MODULAR%
-.if !empty(OPT_MODULAR)
-KERN_AS=	obj
-.else
-KERN_AS=	library
-.endif
 
 ##
 ## (4) local objects, compile rules, and dependencies


Home | Main Index | Thread Index | Old Index