Fri Jul 28 02:41:31 2023 UTC ()
Simplify fix for PR toolchain/57146

Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug
symbols from MD Makefile's to Makefile.kern.inc.


(rin)
diff -r1.24 -r1.25 src/sys/arch/aarch64/conf/Makefile.aarch64
diff -r1.56 -r1.57 src/sys/arch/arm/conf/Makefile.arm
diff -r1.298 -r1.299 src/sys/conf/Makefile.kern.inc

cvs diff -r1.24 -r1.25 src/sys/arch/aarch64/conf/Makefile.aarch64 (switch to unified diff)

--- src/sys/arch/aarch64/conf/Makefile.aarch64 2023/07/26 03:39:55 1.24
+++ src/sys/arch/aarch64/conf/Makefile.aarch64 2023/07/28 02:41:30 1.25
@@ -1,162 +1,156 @@ @@ -1,162 +1,156 @@
1# $NetBSD: Makefile.aarch64,v 1.24 2023/07/26 03:39:55 rin Exp $ 1# $NetBSD: Makefile.aarch64,v 1.25 2023/07/28 02:41:30 rin Exp $
2 2
3# Makefile for NetBSD 3# Makefile for NetBSD
4# 4#
5# This makefile is constructed from a machine description: 5# This makefile is constructed from a machine description:
6# config machineid 6# config machineid
7# Most changes should be made in the machine description 7# Most changes should be made in the machine description
8# /sys/arch/<arch>/conf/``machineid'' 8# /sys/arch/<arch>/conf/``machineid''
9# after which you should do 9# after which you should do
10# config machineid 10# config machineid
11# Machine generic makefile changes should be made in 11# Machine generic makefile changes should be made in
12# /sys/arch/arm/conf/Makefile.arm 12# /sys/arch/arm/conf/Makefile.arm
13# after which config should be rerun for all machines of that type. 13# after which config should be rerun for all machines of that type.
14# 14#
15# To specify debugging, add the config line: makeoptions DEBUG="-g" 15# To specify debugging, add the config line: makeoptions DEBUG="-g"
16# A better way is to specify -g only for a few files. 16# A better way is to specify -g only for a few files.
17# 17#
18# makeoptions DEBUGLIST="uvm* trap if_*" 18# makeoptions DEBUGLIST="uvm* trap if_*"
19 19
20USETOOLS?= no 20USETOOLS?= no
21NEED_OWN_INSTALL_TARGET?=no 21NEED_OWN_INSTALL_TARGET?=no
22.include <bsd.own.mk> 22.include <bsd.own.mk>
23 23
24## 24##
25## (1) port identification 25## (1) port identification
26## 26##
27THISARM= $S/arch/${MACHINE} 27THISARM= $S/arch/${MACHINE}
28ARM= $S/arch/aarch64 28ARM= $S/arch/aarch64
29GENASSYM_CONF= ${ARM}/aarch64/genassym.cf 29GENASSYM_CONF= ${ARM}/aarch64/genassym.cf
30.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" 30.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc"
31 31
32## 32##
33## (2) compile settings 33## (2) compile settings
34## 34##
35# CPPFLAGS set by platform-specific Makefile fragment. 35# CPPFLAGS set by platform-specific Makefile fragment.
36CFLAGS+= -march=armv8-a+nofp+nosimd 36CFLAGS+= -march=armv8-a+nofp+nosimd
37#CFLAGS+= -fomit-frame-pointer 37#CFLAGS+= -fomit-frame-pointer
38CFLAGS+= -fno-omit-frame-pointer 38CFLAGS+= -fno-omit-frame-pointer
39CFLAGS+= -mno-omit-leaf-frame-pointer 39CFLAGS+= -mno-omit-leaf-frame-pointer
40#CFLAGS+= -mno-unaligned-access 40#CFLAGS+= -mno-unaligned-access
41 41
42.if defined(PROF) && ${HAVE_GCC:U0} > 0 42.if defined(PROF) && ${HAVE_GCC:U0} > 0
43# For accurate profiling, it is better to suppress the tail call. 43# For accurate profiling, it is better to suppress the tail call.
44CFLAGS+= -fno-optimize-sibling-calls 44CFLAGS+= -fno-optimize-sibling-calls
45.endif 45.endif
46 46
47.if ${ARMV83_PAC:U0} > 0 && ${ARMV85_BTI:U0} > 0 47.if ${ARMV83_PAC:U0} > 0 && ${ARMV85_BTI:U0} > 0
48CFLAGS+= -mbranch-protection=pac-ret+bti 48CFLAGS+= -mbranch-protection=pac-ret+bti
49.else 49.else
50.if ${ARMV83_PAC:U0} > 0 50.if ${ARMV83_PAC:U0} > 0
51CFLAGS+= -mbranch-protection=pac-ret 51CFLAGS+= -mbranch-protection=pac-ret
52.endif 52.endif
53.if ${ARMV85_BTI:U0} > 0 53.if ${ARMV85_BTI:U0} > 0
54CFLAGS+= -mbranch-protection=bti 54CFLAGS+= -mbranch-protection=bti
55.endif 55.endif
56.endif 56.endif
57 57
58.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 58.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0
59KASANFLAGS= -fsanitize=kernel-address \ 59KASANFLAGS= -fsanitize=kernel-address \
60 --param asan-globals=1 --param asan-stack=1 \ 60 --param asan-globals=1 --param asan-stack=1 \
61 --param asan-instrument-allocas=1 \ 61 --param asan-instrument-allocas=1 \
62 -fsanitize-address-use-after-scope \ 62 -fsanitize-address-use-after-scope \
63 -fasan-shadow-offset=0xDFFF600000000000 63 -fasan-shadow-offset=0xDFFF600000000000
64.for f in subr_asan.c 64.for f in subr_asan.c
65KASANFLAGS.${f}= # empty 65KASANFLAGS.${f}= # empty
66.endfor 66.endfor
67CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}} 67CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}}
68.endif 68.endif
69 69
70## 70##
71## (3) libkern and compat 71## (3) libkern and compat
72## 72##
73OPT_MODULAR= %MODULAR% 73OPT_MODULAR= %MODULAR%
74 74
75## 75##
76## (4) local objects, compile rules, and dependencies 76## (4) local objects, compile rules, and dependencies
77## 77##
78MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 78MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o
79MD_CFILES+= 79MD_CFILES+=
80MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/aarch64/locore.S 80MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/aarch64/locore.S
81 81
82.if defined(SYSTEM_FIRST_OBJ) 82.if defined(SYSTEM_FIRST_OBJ)
83${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 83${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
84 ${NORMAL_S} 84 ${NORMAL_S}
85.endif 85.endif
86 86
87locore.o: ${ARM}/aarch64/locore.S assym.h 87locore.o: ${ARM}/aarch64/locore.S assym.h
88 ${NORMAL_S} 88 ${NORMAL_S}
89 89
90## 90##
91## (5) link settings 91## (5) link settings
92## 92##
93KERNLDSCRIPT?= ${ARM}/conf/kern.ldscript 93KERNLDSCRIPT?= ${ARM}/conf/kern.ldscript
94LOADADDRESS?= 0xffffc00000000000 94LOADADDRESS?= 0xffffc00000000000
95LINKFLAGS_NORMAL= -X 95LINKFLAGS_NORMAL= -X
96 96
97# Strip AArch64 mapping symbols from the kernel image, as they interfere 97# Strip AArch64 mapping symbols from the kernel image, as they interfere
98# with ddb, but don't strip them in netbsd.gdb. 98# with ddb, but don't strip them in netbsd.gdb. See Makefile.kern.inc.
99AA64_STRIP_SYMBOLS= --strip-symbol='[$$][dx]' \ 99ARCH_STRIP_SYMBOLS= --strip-symbol='[$$][dx]' \
100 --strip-symbol='[$$][dx]\.*' 100 --strip-symbol='[$$][dx]\.*'
101.if (defined(DEBUG) && !empty(DEBUG:M-g*)) || (!defined(DEBUG) && \ 
102 (${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes")) 
103OBJCOPY_STRIPFLAGS= -g -w ${AA64_STRIP_SYMBOLS} 
104.else 
105SYSTEM_LD_TAIL= @${OBJCOPY} -w ${AA64_STRIP_SYMBOLS} $@ 
106.endif 
107 101
108## 102##
109## (6) port specific target dependencies 103## (6) port specific target dependencies
110## 104##
111 105
112# depend on DIAGNOSTIC etc. 106# depend on DIAGNOSTIC etc.
113cpuswitch.o fault.o machdep.o: Makefile 107cpuswitch.o fault.o machdep.o: Makefile
114 108
115# various assembly files that depend on assym.h 109# various assembly files that depend on assym.h
116atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 110atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
117exception.o sigcode.o: assym.h 111exception.o sigcode.o: assym.h
118spl.o vectors.o: assym.h 112spl.o vectors.o: assym.h
119 113
120## 114##
121## (7) misc settings 115## (7) misc settings
122## 116##
123 117
124# define .MAIN _before_ the make() check, so that implicit target 118# define .MAIN _before_ the make() check, so that implicit target
125# would be defined 119# would be defined
126.MAIN: all 120.MAIN: all
127 121
128.if !make(obj) && !make(clean) && !make(cleandir) 122.if !make(obj) && !make(clean) && !make(cleandir)
129.BEGIN:: 123.BEGIN::
130 -@rm -f arm && \ 124 -@rm -f arm && \
131 ln -s $S/arch/arm/include arm 125 ln -s $S/arch/arm/include arm
132.endif 126.endif
133 127
134## 128##
135## (8) config(8) generated machinery 129## (8) config(8) generated machinery
136## 130##
137%INCLUDES 131%INCLUDES
138 132
139%OBJS 133%OBJS
140 134
141%CFILES 135%CFILES
142 136
143%SFILES 137%SFILES
144 138
145%LOAD 139%LOAD
146 140
147%RULES 141%RULES
148 142
149## 143##
150## (9) after the config file is inserted 144## (9) after the config file is inserted
151## 145##
152 146
153## 147##
154## (10) port independent kernel machinery 148## (10) port independent kernel machinery
155## 149##
156 150
157.include "$S/conf/Makefile.kern.inc" 151.include "$S/conf/Makefile.kern.inc"
158 152
159## 153##
160## (11) Appending make options. 154## (11) Appending make options.
161## 155##
162%MAKEOPTIONSAPPEND 156%MAKEOPTIONSAPPEND

cvs diff -r1.56 -r1.57 src/sys/arch/arm/conf/Makefile.arm (switch to unified diff)

--- src/sys/arch/arm/conf/Makefile.arm 2023/07/26 03:39:55 1.56
+++ src/sys/arch/arm/conf/Makefile.arm 2023/07/28 02:41:30 1.57
@@ -1,170 +1,164 @@ @@ -1,170 +1,164 @@
1# $NetBSD: Makefile.arm,v 1.56 2023/07/26 03:39:55 rin Exp $ 1# $NetBSD: Makefile.arm,v 1.57 2023/07/28 02:41:30 rin Exp $
2 2
3# Makefile for NetBSD 3# Makefile for NetBSD
4# 4#
5# This makefile is constructed from a machine description: 5# This makefile is constructed from a machine description:
6# config machineid 6# config machineid
7# Most changes should be made in the machine description 7# Most changes should be made in the machine description
8# /sys/arch/<arch>/conf/``machineid'' 8# /sys/arch/<arch>/conf/``machineid''
9# after which you should do 9# after which you should do
10# config machineid 10# config machineid
11# Machine generic makefile changes should be made in 11# Machine generic makefile changes should be made in
12# /sys/arch/arm/conf/Makefile.arm 12# /sys/arch/arm/conf/Makefile.arm
13# after which config should be rerun for all machines of that type. 13# after which config should be rerun for all machines of that type.
14# 14#
15# To specify debugging, add the config line: makeoptions DEBUG="-g" 15# To specify debugging, add the config line: makeoptions DEBUG="-g"
16# A better way is to specify -g only for a few files. 16# A better way is to specify -g only for a few files.
17# 17#
18# makeoptions DEBUGLIST="uvm* trap if_*" 18# makeoptions DEBUGLIST="uvm* trap if_*"
19 19
20USETOOLS?= no 20USETOOLS?= no
21NEED_OWN_INSTALL_TARGET?=no 21NEED_OWN_INSTALL_TARGET?=no
22.include <bsd.own.mk> 22.include <bsd.own.mk>
23 23
24## 24##
25## (1) port identification 25## (1) port identification
26## 26##
27THISARM= $S/arch/${MACHINE} 27THISARM= $S/arch/${MACHINE}
28ARM= $S/arch/arm 28ARM= $S/arch/arm
29GENASSYM_CONF= ${ARM}/arm32/genassym.cf 29GENASSYM_CONF= ${ARM}/arm32/genassym.cf
30.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" 30.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc"
31 31
32## 32##
33## (2) compile settings 33## (2) compile settings
34## 34##
35# CPPFLAGS set by platform-specific Makefile fragment. 35# CPPFLAGS set by platform-specific Makefile fragment.
36AFLAGS+= -x assembler-with-cpp 36AFLAGS+= -x assembler-with-cpp
37COPTS.arm32_kvminit.c+= -fno-stack-protector 37COPTS.arm32_kvminit.c+= -fno-stack-protector
38COPTS.vfp_init.c= -mfpu=vfp 38COPTS.vfp_init.c= -mfpu=vfp
39CLANG_OBSOLETE_MULTI_ST= ${${ACTIVE_CC} == "clang":? -Wa,-W :} 39CLANG_OBSOLETE_MULTI_ST= ${${ACTIVE_CC} == "clang":? -Wa,-W :}
40AFLAGS.bcopyinout.S+= -marm 40AFLAGS.bcopyinout.S+= -marm
41AFLAGS.blockio.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 41AFLAGS.blockio.S+= -marm ${CLANG_OBSOLETE_MULTI_ST}
42AFLAGS.copystr.S+= -marm 42AFLAGS.copystr.S+= -marm
43AFLAGS.cpufunc_asm.S+= ${CLANG_OBSOLETE_MULTI_ST} 43AFLAGS.cpufunc_asm.S+= ${CLANG_OBSOLETE_MULTI_ST}
44AFLAGS.cpuswitch.S+= -marm -mfpu=vfp 44AFLAGS.cpuswitch.S+= -marm -mfpu=vfp
45AFLAGS.exception.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 45AFLAGS.exception.S+= -marm ${CLANG_OBSOLETE_MULTI_ST}
46AFLAGS.fiq_subr.S+= ${CLANG_OBSOLETE_MULTI_ST} 46AFLAGS.fiq_subr.S+= ${CLANG_OBSOLETE_MULTI_ST}
47AFLAGS.fusu.S+= -marm 47AFLAGS.fusu.S+= -marm
48AFLAGS.irq_dispatch.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 48AFLAGS.irq_dispatch.S+= -marm ${CLANG_OBSOLETE_MULTI_ST}
49AFLAGS.locore.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 49AFLAGS.locore.S+= -marm ${CLANG_OBSOLETE_MULTI_ST}
50CFLAGS+= -mfloat-abi=soft 50CFLAGS+= -mfloat-abi=soft
51 51
52# This files use instructions deprecated for ARMv7+, but still 52# This files use instructions deprecated for ARMv7+, but still
53# included in kernel that build with higher -mcpu=... settings. 53# included in kernel that build with higher -mcpu=... settings.
54CPPFLAGS.cpufunc_asm_armv4.S+= -mcpu=arm8 54CPPFLAGS.cpufunc_asm_armv4.S+= -mcpu=arm8
55CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm1136j-s 55CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm1136j-s
56CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s 56CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s
57CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale 57CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale
58 58
59OPT_DDB= %DDB% 59OPT_DDB= %DDB%
60.if !empty(OPT_DDB) && ${HAVE_GCC:U0} > 0 60.if !empty(OPT_DDB) && ${HAVE_GCC:U0} > 0
61CFLAGS+= -mapcs-frame 61CFLAGS+= -mapcs-frame
62.endif 62.endif
63 63
64# Note: -fasan-shadow-offset= 64# Note: -fasan-shadow-offset=
65# KASAN_SHADOW_START - (__MD_KERNMEM_BASE >> KASAN_SHADOW_SCALE_SHIFT) = 65# KASAN_SHADOW_START - (__MD_KERNMEM_BASE >> KASAN_SHADOW_SCALE_SHIFT) =
66# 0xc000_0000 - (0x8000_0000 >> 3) = 0xb000_0000 66# 0xc000_0000 - (0x8000_0000 >> 3) = 0xb000_0000
67# 67#
68 68
69.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 69.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0
70KASANFLAGS= \ 70KASANFLAGS= \
71 -fsanitize=kernel-address \ 71 -fsanitize=kernel-address \
72 --param asan-globals=1 \ 72 --param asan-globals=1 \
73 --param asan-stack=1 \ 73 --param asan-stack=1 \
74 --param asan-instrument-allocas=1 \ 74 --param asan-instrument-allocas=1 \
75 -fsanitize-address-use-after-scope \ 75 -fsanitize-address-use-after-scope \
76 -fasan-shadow-offset=0xb0000000 76 -fasan-shadow-offset=0xb0000000
77.for f in subr_asan.c 77.for f in subr_asan.c
78KASANFLAGS.${f}= # empty 78KASANFLAGS.${f}= # empty
79.endfor 79.endfor
80CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}} 80CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}}
81.endif 81.endif
82 82
83## 83##
84## (3) libkern and compat 84## (3) libkern and compat
85## 85##
86OPT_MODULAR= %MODULAR% 86OPT_MODULAR= %MODULAR%
87 87
88## 88##
89## (4) local objects, compile rules, and dependencies 89## (4) local objects, compile rules, and dependencies
90## 90##
91MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 91MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o
92MD_CFILES+= 92MD_CFILES+=
93MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S 93MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S
94 94
95.if defined(SYSTEM_FIRST_OBJ) 95.if defined(SYSTEM_FIRST_OBJ)
96${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 96${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
97 ${NORMAL_S} 97 ${NORMAL_S}
98.endif 98.endif
99 99
100locore.o: ${ARM}/arm32/locore.S assym.h 100locore.o: ${ARM}/arm32/locore.S assym.h
101 ${NORMAL_S} 101 ${NORMAL_S}
102 102
103## 103##
104## (5) link settings 104## (5) link settings
105## 105##
106LOADADDRESS?= 0xF0000000 106LOADADDRESS?= 0xF0000000
107LINKFLAGS_NORMAL= -X 107LINKFLAGS_NORMAL= -X
108# Strip ARM mapping symbols from the kernel image, as they interfere 108# Strip ARM mapping symbols from the kernel image, as they interfere
109# with ddb, but don't strip them in netbsd.gdb. 109# with ddb, but don't strip them in netbsd.gdb. See Makefile.kern.inc.
110ARM_STRIP_SYMBOLS= --strip-symbol='[$$][atd]' \ 110ARCH_STRIP_SYMBOLS= --strip-symbol='[$$][atd]' \
111 --strip-symbol='[$$][atd]\.*' 111 --strip-symbol='[$$][atd]\.*'
112.if (defined(DEBUG) && !empty(DEBUG:M-g*)) || (!defined(DEBUG) && \ 
113 (${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes")) 
114OBJCOPY_STRIPFLAGS= -g -w ${ARM_STRIP_SYMBOLS} 
115.else 
116SYSTEM_LD_TAIL= @${OBJCOPY} -w ${ARM_STRIP_SYMBOLS} $@ 
117.endif 
118 112
119## 113##
120## (6) port specific target dependencies 114## (6) port specific target dependencies
121## 115##
122 116
123# depend on CPU configuration 117# depend on CPU configuration
124cpufunc.o cpufunc_asm.o: Makefile 118cpufunc.o cpufunc_asm.o: Makefile
125 119
126# depend on DIAGNOSTIC etc. 120# depend on DIAGNOSTIC etc.
127cpuswitch.o fault.o machdep.o: Makefile 121cpuswitch.o fault.o machdep.o: Makefile
128 122
129# various assembly files that depend on assym.h 123# various assembly files that depend on assym.h
130atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 124atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
131exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h 125exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h
132spl.o vectors.o: assym.h 126spl.o vectors.o: assym.h
133 127
134## 128##
135## (7) misc settings 129## (7) misc settings
136## 130##
137 131
138## 132##
139## (8) config(8) generated machinery 133## (8) config(8) generated machinery
140## 134##
141%INCLUDES 135%INCLUDES
142 136
143%OBJS 137%OBJS
144 138
145%CFILES 139%CFILES
146 140
147%SFILES 141%SFILES
148 142
149%LOAD 143%LOAD
150 144
151%RULES 145%RULES
152 146
153## 147##
154## (9) after the config file is inserted 148## (9) after the config file is inserted
155## 149##
156 150
157.for f in ${SFILES:T:Mcpufunc_asm*} 151.for f in ${SFILES:T:Mcpufunc_asm*}
158AFLAGS.${f}+=-marm 152AFLAGS.${f}+=-marm
159.endfor 153.endfor
160 154
161## 155##
162## (10) port independent kernel machinery 156## (10) port independent kernel machinery
163## 157##
164 158
165.include "$S/conf/Makefile.kern.inc" 159.include "$S/conf/Makefile.kern.inc"
166 160
167## 161##
168## (11) Appending make options. 162## (11) Appending make options.
169## 163##
170%MAKEOPTIONSAPPEND 164%MAKEOPTIONSAPPEND

cvs diff -r1.298 -r1.299 src/sys/conf/Makefile.kern.inc (switch to unified diff)

--- src/sys/conf/Makefile.kern.inc 2023/07/26 03:39:55 1.298
+++ src/sys/conf/Makefile.kern.inc 2023/07/28 02:41:31 1.299
@@ -1,585 +1,595 @@ @@ -1,585 +1,595 @@
1# $NetBSD: Makefile.kern.inc,v 1.298 2023/07/26 03:39:55 rin Exp $ 1# $NetBSD: Makefile.kern.inc,v 1.299 2023/07/28 02:41:31 rin Exp $
2# 2#
3# This file contains common `MI' targets and definitions and it is included 3# This file contains common `MI' targets and definitions and it is included
4# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}. 4# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
5# 5#
6# Each target in this file should be protected with `if !target(target)' 6# Each target in this file should be protected with `if !target(target)'
7# or `if !commands(target)' and each variable should only be conditionally 7# or `if !commands(target)' and each variable should only be conditionally
8# assigned `VAR ?= VALUE', so that everything can be overridden. 8# assigned `VAR ?= VALUE', so that everything can be overridden.
9# 9#
10# DEBUG is set to -g if debugging. 10# DEBUG is set to -g if debugging.
11# PROF is set to -pg if profiling. 11# PROF is set to -pg if profiling.
12# 12#
13# To specify debugging, add the config line: makeoptions DEBUG="-g" 13# To specify debugging, add the config line: makeoptions DEBUG="-g"
14# A better way is to specify -g only for a few files. 14# A better way is to specify -g only for a few files.
15# 15#
16# makeoptions DEBUGLIST="uvm* trap if_*" 16# makeoptions DEBUGLIST="uvm* trap if_*"
17# 17#
18# all ports are expected to include bsd.own.mk for toolchain settings 18# all ports are expected to include bsd.own.mk for toolchain settings
19 19
20# Default DEBUG to -g if kernel debug info is requested by MKDEBUGKERNEL=yes 20# Default DEBUG to -g if kernel debug info is requested by MKDEBUGKERNEL=yes
21.if ${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes" 21.if ${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes"
22DEBUG?=-g 22DEBUG?=-g
23.else 23.else
24DEBUG?= 24DEBUG?=
25.endif 25.endif
26 26
27## 27##
28## (0) toolchain settings for things that aren't part of the standard 28## (0) toolchain settings for things that aren't part of the standard
29## toolchain 29## toolchain
30## 30##
31HOST_SH?= sh 31HOST_SH?= sh
32DBSYM?= dbsym 32DBSYM?= dbsym
33MKDEP?= mkdep 33MKDEP?= mkdep
34STRIP?= strip 34STRIP?= strip
35OBJCOPY?= objcopy 35OBJCOPY?= objcopy
36OBJDUMP?= objdump 36OBJDUMP?= objdump
37CSCOPE?= cscope 37CSCOPE?= cscope
38MKID?= mkid 38MKID?= mkid
39UUDECODE?= ${TOOL_UUDECODE:Uuudecode} 39UUDECODE?= ${TOOL_UUDECODE:Uuudecode}
40HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump} 40HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump}
41GENASSYM?= ${TOOL_GENASSYM:Ugenassym} 41GENASSYM?= ${TOOL_GENASSYM:Ugenassym}
42.MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated 42.MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated
43 43
44_MKMSG?= @\# 44_MKMSG?= @\#
45_MKSHMSG?= echo 45_MKSHMSG?= echo
46_MKSHECHO?= echo 46_MKSHECHO?= echo
47_MKSHNOECHO= : 47_MKSHNOECHO= :
48_MKMSG_CREATE?= : 48_MKMSG_CREATE?= :
49_MKTARGET_COMPILE?= : 49_MKTARGET_COMPILE?= :
50_MKTARGET_CREATE?= : 50_MKTARGET_CREATE?= :
51 51
52## 52##
53## (1) port independent source tree identification 53## (1) port independent source tree identification
54## 54##
55# source tree is located via $S relative to the compilation directory 55# source tree is located via $S relative to the compilation directory
56.ifndef S 56.ifndef S
57S!= cd ../../../.. && pwd 57S!= cd ../../../.. && pwd
58.endif 58.endif
59 59
60## 60##
61## (2) compile settings 61## (2) compile settings
62## 62##
63## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile 63## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile
64## 64##
65INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \ 65INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \
66 -I$S -nostdinc 66 -I$S -nostdinc
67CPPFLAGS+= ${INCLUDES} ${IDENT} -D_KERNEL -D_KERNEL_OPT 67CPPFLAGS+= ${INCLUDES} ${IDENT} -D_KERNEL -D_KERNEL_OPT
68.if !defined(COVERITY_TOP_CONFIG) 68.if !defined(COVERITY_TOP_CONFIG)
69CPPFLAGS+= -std=gnu99 69CPPFLAGS+= -std=gnu99
70.endif 70.endif
71.if ${KERNEL_DIR:Uno} == "yes" 71.if ${KERNEL_DIR:Uno} == "yes"
72CPPFLAGS+= -DKERNEL_DIR 72CPPFLAGS+= -DKERNEL_DIR
73.endif 73.endif
74DEFCOPTS?= -O2 74DEFCOPTS?= -O2
75COPTS?= ${DEFCOPTS} 75COPTS?= ${DEFCOPTS}
76DBG= # might contain unwanted -Ofoo 76DBG= # might contain unwanted -Ofoo
77CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith 77CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith
78CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes 78CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
79CWARNFLAGS+= -Wold-style-definition 79CWARNFLAGS+= -Wold-style-definition
80CWARNFLAGS+= -Wswitch -Wshadow 80CWARNFLAGS+= -Wswitch -Wshadow
81CWARNFLAGS+= -Wcast-qual -Wwrite-strings 81CWARNFLAGS+= -Wcast-qual -Wwrite-strings
82CWARNFLAGS+= -Wno-unreachable-code 82CWARNFLAGS+= -Wno-unreachable-code
83#CWARNFLAGS+= -Wc++-compat -Wno-error=c++-compat 83#CWARNFLAGS+= -Wc++-compat -Wno-error=c++-compat
84CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes 84CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes
85CWARNFLAGS+= -Wno-type-limits 85CWARNFLAGS+= -Wno-type-limits
86. if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \ 86. if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
87 ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep" 87 ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
88CWARNFLAGS+= -Wextra -Wno-unused-parameter 88CWARNFLAGS+= -Wextra -Wno-unused-parameter
89. endif 89. endif
90. if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" 90. if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
91CWARNFLAGS+= -Wold-style-definition 91CWARNFLAGS+= -Wold-style-definition
92. endif 92. endif
93# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, 93# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3,
94# but our sources aren't up for it yet. 94# but our sources aren't up for it yet.
95CWARNFLAGS+= -Wno-sign-compare 95CWARNFLAGS+= -Wno-sign-compare
96 96
97CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \ 97CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \
98 -Wno-self-assign \ 98 -Wno-self-assign \
99 -Wno-error=constant-conversion 99 -Wno-error=constant-conversion
100CWARNFLAGS+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 100CWARNFLAGS+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
101 101
102CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \ 102CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \
103 -Wno-shift-count-negative -Wno-shift-count-overflow:} 103 -Wno-shift-count-negative -Wno-shift-count-overflow:}
104 104
105CWARNFLAGS.ioconf.c= ${${ACTIVE_CC} == "clang":? -Wno-unused-const-variable :} 105CWARNFLAGS.ioconf.c= ${${ACTIVE_CC} == "clang":? -Wno-unused-const-variable :}
106 106
107CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss 107CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss
108CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :} 108CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
109CFLAGS+= ${DEBUG} ${COPTS} 109CFLAGS+= ${DEBUG} ${COPTS}
110AFLAGS+= -D_LOCORE -Wa,--fatal-warnings 110AFLAGS+= -D_LOCORE -Wa,--fatal-warnings
111 111
112# example usage to find largest stack users in kernel compile directory: 112# example usage to find largest stack users in kernel compile directory:
113# find . -name \*.su | xargs awk '{ printf "%6d %s\n", $2, $1 }' | sort -n 113# find . -name \*.su | xargs awk '{ printf "%6d %s\n", $2, $1 }' | sort -n
114.if ${MACHINE} != "vax" 114.if ${MACHINE} != "vax"
115# GCC/vax 8.4 does not support -fstack-usage. 115# GCC/vax 8.4 does not support -fstack-usage.
116CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fstack-usage -Wstack-usage=3584 :} 116CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fstack-usage -Wstack-usage=3584 :}
117.endif 117.endif
118CWARNFLAGS+= -Walloca 118CWARNFLAGS+= -Walloca
119 119
120# XXX 120# XXX
121.if defined(HAVE_GCC) || defined(HAVE_LLVM) 121.if defined(HAVE_GCC) || defined(HAVE_LLVM)
122CFLAGS+= -fno-strict-aliasing 122CFLAGS+= -fno-strict-aliasing
123CFLAGS+= -fno-common 123CFLAGS+= -fno-common
124.endif 124.endif
125 125
126# Use the per-source COPTS variables to add -g to just those 126# Use the per-source COPTS variables to add -g to just those
127# files that match the shell patterns given in ${DEBUGLIST} 127# files that match the shell patterns given in ${DEBUGLIST}
128# 128#
129.for i in ${DEBUGLIST} 129.for i in ${DEBUGLIST}
130. for j in ${ALLFILES:M*.c:T:M$i.c} 130. for j in ${ALLFILES:M*.c:T:M$i.c}
131COPTS.${j}+=-g 131COPTS.${j}+=-g
132. endfor 132. endfor
133.endfor 133.endfor
134 134
135# Always compile debugsyms.c with debug information. 135# Always compile debugsyms.c with debug information.
136# This allows gdb to use type informations. 136# This allows gdb to use type informations.
137# 137#
138COPTS.debugsyms.c+= -g 138COPTS.debugsyms.c+= -g
139 139
140# Add CTF sections for DTrace 140# Add CTF sections for DTrace
141.if defined(CTFCONVERT) 141.if defined(CTFCONVERT)
142COMPILE_CTFCONVERT= ${_MKSHECHO}\ 142COMPILE_CTFCONVERT= ${_MKSHECHO}\
143 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \ 143 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
144 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 144 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
145.else 145.else
146COMPILE_CTFCONVERT= ${_MKSHNOECHO} 146COMPILE_CTFCONVERT= ${_MKSHNOECHO}
147.endif 147.endif
148 148
149KCOMPILE.c= ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ 149KCOMPILE.c= ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
150KCOMPILE.s= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@ 150KCOMPILE.s= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@
151KLINK.o= ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC} 151KLINK.o= ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC}
152 152
153# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 153# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
154# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 154# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
155NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ 155NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
156 ${_MKSHECHO} ${KCOMPILE.c} ${PROF} && \ 156 ${_MKSHECHO} ${KCOMPILE.c} ${PROF} && \
157 ${KCOMPILE.c} ${PROF} && \ 157 ${KCOMPILE.c} ${PROF} && \
158 ${COMPILE_CTFCONVERT} 158 ${COMPILE_CTFCONVERT}
159NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ 159NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
160 ${_MKSHECHO} ${KCOMPILE.c} && \ 160 ${_MKSHECHO} ${KCOMPILE.c} && \
161 ${KCOMPILE.c} && \ 161 ${KCOMPILE.c} && \
162 ${COMPILE_CTFCONVERT} 162 ${COMPILE_CTFCONVERT}
163NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ 163NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
164 ${_MKSHECHO} ${KCOMPILE.s} && \ 164 ${_MKSHECHO} ${KCOMPILE.s} && \
165 ${KCOMPILE.s} 165 ${KCOMPILE.s}
166  166
167# link rules:  167# link rules:
168LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \ 168LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \
169 ${_MKSHECHO} ${KLINK.o} && \ 169 ${_MKSHECHO} ${KLINK.o} && \
170 ${KLINK.o} 170 ${KLINK.o}
171 171
172## 172##
173## (3) libkern 173## (3) libkern
174## 174##
175## Set OPT_MODULAR in the port Makefile if module(7) is enabled, 175## Set OPT_MODULAR in the port Makefile if module(7) is enabled,
176## as documented in $S/lib/libkern/Makefile.inc. 176## as documented in $S/lib/libkern/Makefile.inc.
177## 177##
178 178
179### find out what to use for libkern 179### find out what to use for libkern
180.include "$S/lib/libkern/Makefile.inc" 180.include "$S/lib/libkern/Makefile.inc"
181.ifndef PROF 181.ifndef PROF
182LIBKERN?= ${KERNLIB} 182LIBKERN?= ${KERNLIB}
183.else 183.else
184LIBKERN?= ${KERNLIB_PROF} 184LIBKERN?= ${KERNLIB_PROF}
185.endif 185.endif
186 186
187LIBKERNLN?= ${KERNLIBLN} 187LIBKERNLN?= ${KERNLIBLN}
188 188
189## 189##
190## (4) local objects, compile rules, and dependencies 190## (4) local objects, compile rules, and dependencies
191## 191##
192## Each port should have a corresponding section with settings for 192## Each port should have a corresponding section with settings for
193## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same. 193## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
194## 194##
195 195
196.if !defined(___USE_SUFFIX_RULES___) 196.if !defined(___USE_SUFFIX_RULES___)
197_MD_OBJS= ${MD_OBJS:T} 197_MD_OBJS= ${MD_OBJS:T}
198.else 198.else
199_MD_OBJS= ${MD_OBJS} 199_MD_OBJS= ${MD_OBJS}
200.endif 200.endif
201 201
202## 202##
203## (5) link settings 203## (5) link settings
204## 204##
205## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS 205## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS
206## must be set in the port's Makefile. The port specific definitions for 206## must be set in the port's Makefile. The port specific definitions for
207## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS 207## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
208## depending on the value of DEBUG. 208## depending on the value of DEBUG.
209## 209##
210# load lines for config "xxx" will be emitted as: 210# load lines for config "xxx" will be emitted as:
211# xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel 211# xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
212 212
213SYSTEM_LIB= ${MD_LIBS} ${LIBKERN} 213SYSTEM_LIB= ${MD_LIBS} ${LIBKERN}
214SYSTEM_OBJ?= ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB} 214SYSTEM_OBJ?= ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
215SYSTEM_DEP+= Makefile ${SYSTEM_OBJ:O} 215SYSTEM_DEP+= Makefile ${SYSTEM_OBJ:O}
216.if defined(CTFMERGE) 216.if defined(CTFMERGE)
217SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o 217SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
218.else 218.else
219SYSTEM_CTFMERGE= ${_MKSHECHO} 219SYSTEM_CTFMERGE= ${_MKSHECHO}
220.endif 220.endif
221 221
222REMOVE_SWAP= [@] 222REMOVE_SWAP= [@]
223.for k in ${KERNELS} 223.for k in ${KERNELS}
224REMOVE_SWAP:= ${REMOVE_SWAP}:Nswap${k}.o 224REMOVE_SWAP:= ${REMOVE_SWAP}:Nswap${k}.o
225.endfor 225.endfor
226 226
227SYSTEM_LD_HEAD?=@rm -f $@ 227SYSTEM_LD_HEAD?=@rm -f $@
228SYSTEM_LD?= ${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \ 228SYSTEM_LD?= ${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \
229 ${_MKSHECHO}\ 229 ${_MKSHECHO}\
230 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \ 230 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
231 '$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \ 231 '$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \
232 ${OBJS:M*swap${.TARGET}.o}; \ 232 ${OBJS:M*swap${.TARGET}.o}; \
233 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \ 233 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
234 ${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \ 234 ${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \
235 ${OBJS:M*swap${.TARGET}.o} 235 ${OBJS:M*swap${.TARGET}.o}
236 236
237TEXTADDR?= ${LOADADDRESS} # backwards compatibility 237TEXTADDR?= ${LOADADDRESS} # backwards compatibility
238LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/} 238LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/}
239LINKDATA?= ${DATAADDR:C/.+/-Tdata &/} 239LINKDATA?= ${DATAADDR:C/.+/-Tdata &/}
240ENTRYPOINT?= start 240ENTRYPOINT?= start
241LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/} 241LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/}
242LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \ 242LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
243 ${EXTRA_LINKFLAGS} 243 ${EXTRA_LINKFLAGS}
244 244
245LINKFLAGS_DEBUG?= -X 245LINKFLAGS_DEBUG?= -X
246KERNEL_CONFIG?= ${KERNEL_BUILD:T} 246KERNEL_CONFIG?= ${KERNEL_BUILD:T}
247 247
248SYSTEM_LD_TAIL?= @${_MKSHECHO} 248SYSTEM_LD_TAIL?= @${_MKSHECHO}
249SYSTEM_LD_TAIL+= && ${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \ 249OBJCOPY_STRIPFLAGS?= -g
250 ${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@ 
251SYSTEM_LD_TAIL+= && runit() { echo $$@; $$@; } 
252 250
253OBJCOPY_STRIPFLAGS?= -g 251# Strip some architecture-defined symbols from kernel image, while
 252# keep them in netbsd.gdb.
 253.if defined(ARCH_STRIP_SYMBOLS)
 254.if empty(DEBUG:M-g*)
 255SYSTEM_LD_TAIL+= && ${OBJCOPY} -w ${ARCH_STRIP_SYMBOLS} $@
 256.endif
 257OBJCOPY_STRIPFLAGS+= -w ${ARCH_STRIP_SYMBOLS}
 258.endif
 259
 260SYSTEM_LD_TAIL+= && ${TOOL_SED} \
 261 '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
 262 ${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@ && \
 263 runit() { echo $$@; $$@; }
254 264
255SYSTEM_LD_TAIL_DEBUG?=&& \ 265SYSTEM_LD_TAIL_DEBUG?=&& \
256 runit mv -f $@ $@.gdb && \ 266 runit mv -f $@ $@.gdb && \
257 runit ${OBJCOPY} --only-keep-debug $@.gdb $@-${KERNEL_CONFIG}.debug && \ 267 runit ${OBJCOPY} --only-keep-debug $@.gdb $@-${KERNEL_CONFIG}.debug && \
258 runit ${OBJCOPY} ${OBJCOPY_STRIPFLAGS} -p -R .gnu_debuglink \ 268 runit ${OBJCOPY} ${OBJCOPY_STRIPFLAGS} -p -R .gnu_debuglink \
259 --add-gnu-debuglink=$@-${KERNEL_CONFIG}.debug $@.gdb $@ && \ 269 --add-gnu-debuglink=$@-${KERNEL_CONFIG}.debug $@.gdb $@ && \
260 runit chmod 755 $@ $@.gdb $@-${KERNEL_CONFIG}.debug 270 runit chmod 755 $@ $@.gdb $@-${KERNEL_CONFIG}.debug
261 271
262LINKFLAGS_NORMAL?= -S 272LINKFLAGS_NORMAL?= -S
263STRIPFLAGS?= -g 273STRIPFLAGS?= -g
264 274
265.if !empty(DEBUG:M-g*) 275.if !empty(DEBUG:M-g*)
266SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG} 276SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
267LINKFLAGS+= ${LINKFLAGS_DEBUG} 277LINKFLAGS+= ${LINKFLAGS_DEBUG}
268EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@} 278EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
269CTFFLAGS+= -g 279CTFFLAGS+= -g
270TARGETSFX= .gdb 280TARGETSFX= .gdb
271.elifndef PROF 281.elifndef PROF
272LINKFLAGS+= ${LINKFLAGS_NORMAL} 282LINKFLAGS+= ${LINKFLAGS_NORMAL}
273.endif 283.endif
274 284
275.if ${MKDEBUG:Uno} == "yes" 285.if ${MKDEBUG:Uno} == "yes"
276# XXX: KERNEL_DIR? 286# XXX: KERNEL_DIR?
277debuginstall: install-kernel-debug 287debuginstall: install-kernel-debug
278.for k in ${KERNELS} 288.for k in ${KERNELS}
279install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug 289install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug
280 290
281${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug 291${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug
282 ${_MKTARGET_INSTALL} 292 ${_MKTARGET_INSTALL}
283 ${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET} 293 ${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET}
284.endfor 294.endfor
285.else 295.else
286debuginstall: 296debuginstall:
287.endif 297.endif
288 298
289SYSTEM_LD_HEAD+= ${SYSTEM_LD_HEAD_EXTRA} 299SYSTEM_LD_HEAD+= ${SYSTEM_LD_HEAD_EXTRA}
290SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL} 300SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL}
291SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL} 301SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL}
292.if defined(COPY_SYMTAB) 302.if defined(COPY_SYMTAB)
293SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@ 303SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@
294.if !empty(DEBUG:M-g) 304.if !empty(DEBUG:M-g)
295SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@.gdb 305SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@.gdb
296.endif 306.endif
297.endif 307.endif
298SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA} 308SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA}
299 309
300## 310##
301## (6) port independent targets and dependencies: assym.h, vers.o 311## (6) port independent targets and dependencies: assym.h, vers.o
302## 312##
303 313
304.if !defined(___USE_SUFFIX_RULES___) 314.if !defined(___USE_SUFFIX_RULES___)
305 315
306# Generate list of *.o files to pass to ${LD}, preserving order. 316# Generate list of *.o files to pass to ${LD}, preserving order.
307# x/y/z/a.[csS] -> a.[csS] 317# x/y/z/a.[csS] -> a.[csS]
308# a.[csS] -> a.o 318# a.[csS] -> a.o
309OBJS= ${ALLFILES:C|^.*/([^/]*\.[csS])$|\1|:C|^(.*)\.[csS]$|\1.o|} 319OBJS= ${ALLFILES:C|^.*/([^/]*\.[csS])$|\1|:C|^(.*)\.[csS]$|\1.o|}
310 320
311CFILES= ${ALLFILES:M*.c} 321CFILES= ${ALLFILES:M*.c}
312SFILES= ${ALLFILES:M*.[sS]} 322SFILES= ${ALLFILES:M*.[sS]}
313OFILES= ${ALLFILES:M*.o} 323OFILES= ${ALLFILES:M*.o}
314# absolute, generated (build directory), relative (under $S) 324# absolute, generated (build directory), relative (under $S)
315_CFILES=${CFILES:M/*} ${CFILES:N/*:N*/*} ${CFILES:N/*:M*/*:C|^|$S/|} 325_CFILES=${CFILES:M/*} ${CFILES:N/*:N*/*} ${CFILES:N/*:M*/*:C|^|$S/|}
316_SFILES=${SFILES:M/*} ${SFILES:N/*:N*/*} ${SFILES:N/*:M*/*:C|^|$S/|} 326_SFILES=${SFILES:M/*} ${SFILES:N/*:N*/*} ${SFILES:N/*:M*/*:C|^|$S/|}
317_MD_CFILES=${MD_CFILES} 327_MD_CFILES=${MD_CFILES}
318_MD_SFILES=${MD_SFILES} 328_MD_SFILES=${MD_SFILES}
319CSRCS= ${_MD_CFILES} ${_CFILES} 329CSRCS= ${_MD_CFILES} ${_CFILES}
320SSRCS= ${_MD_SFILES} ${_SFILES} 330SSRCS= ${_MD_SFILES} ${_SFILES}
321SRCS= ${CSRCS} ${SSRCS} 331SRCS= ${CSRCS} ${SSRCS}
322 332
323.else # ___USE_SUFFIX_RULES___ 333.else # ___USE_SUFFIX_RULES___
324OBJS= ${ALLFILES:C|\.[csS]$|.o|} 334OBJS= ${ALLFILES:C|\.[csS]$|.o|}
325SRCS= ${ALLFILES:M*.[csS]} 335SRCS= ${ALLFILES:M*.[csS]}
326.endif # ___USE_SUFFIX_RULES___ 336.endif # ___USE_SUFFIX_RULES___
327 337
328.if !defined(___USE_SUFFIX_RULES___) 338.if !defined(___USE_SUFFIX_RULES___)
329.for _s in ${_CFILES} 339.for _s in ${_CFILES}
330.if !commands(${_s:T:R}.o) 340.if !commands(${_s:T:R}.o)
331${_s:T:R}.o: ${_s} 341${_s:T:R}.o: ${_s}
332 ${NORMAL_C} 342 ${NORMAL_C}
333.endif 343.endif
334.endfor 344.endfor
335 345
336.for _s in ${_SFILES} 346.for _s in ${_SFILES}
337.if !commands(${_s:T:R}.o) 347.if !commands(${_s:T:R}.o)
338${_s:T:R}.o: ${_s} 348${_s:T:R}.o: ${_s}
339 ${NORMAL_S} 349 ${NORMAL_S}
340.endif 350.endif
341.endfor 351.endfor
342.endif # !___USE_SUFFIX_RULES___ 352.endif # !___USE_SUFFIX_RULES___
343 353
344.include "${S}/conf/ldscript.mk" 354.include "${S}/conf/ldscript.mk"
345.include "${S}/conf/assym.mk" 355.include "${S}/conf/assym.mk"
346.include "${S}/conf/newvers.mk" 356.include "${S}/conf/newvers.mk"
347.include "${S}/dev/splash/splash.mk" 357.include "${S}/dev/splash/splash.mk"
348.include "${S}/conf/mdroot.mk" 358.include "${S}/conf/mdroot.mk"
349.include "${S}/conf/lint.mk" 359.include "${S}/conf/lint.mk"
350.include "${S}/conf/cscope.mk" 360.include "${S}/conf/cscope.mk"
351.include "${S}/conf/gdbinit.mk" 361.include "${S}/conf/gdbinit.mk"
352.include "${S}/conf/ssp.mk" 362.include "${S}/conf/ssp.mk"
353.if "${_SKIP_DTS}" != "yes" 363.if "${_SKIP_DTS}" != "yes"
354.include "${S}/conf/dts.mk" 364.include "${S}/conf/dts.mk"
355.endif 365.endif
356.include "${S}/conf/copts.mk" 366.include "${S}/conf/copts.mk"
357 367
358## 368##
359## (7) misc targets: install, clean(dir), depend(all), lint, links, tags, 369## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
360## cscope, mkid 370## cscope, mkid
361## 371##
362## Any ports that have other stuff to be cleaned up should fill in 372## Any ports that have other stuff to be cleaned up should fill in
363## EXTRA_CLEAN. Some ports may want different settings for 373## EXTRA_CLEAN. Some ports may want different settings for
364## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS. 374## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
365## 375##
366 376
367## 377##
368## clean 378## clean
369## 379##
370 380
371.if !target(__CLEANKERNEL) 381.if !target(__CLEANKERNEL)
372__CLEANKERNEL: .USE 382__CLEANKERNEL: .USE
373 ${_MKMSG} "${.TARGET}ing the kernel objects" 383 ${_MKMSG} "${.TARGET}ing the kernel objects"
374 rm -f ${KERNELS} *.map *.[io] *.ko *.ln [a-z]*.s *.su vers.c \ 384 rm -f ${KERNELS} *.map *.[io] *.ko *.ln [a-z]*.s *.su vers.c \
375 eddep tags [Ee]rrs linterrs makelinks assym.h.tmp assym.h \ 385 eddep tags [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
376 ${EXTRA_KERNELS} ${EXTRA_CLEAN} 386 ${EXTRA_KERNELS} ${EXTRA_CLEAN}
377.endif 387.endif
378 388
379.if !target(kernelnames) 389.if !target(kernelnames)
380kernelnames: 390kernelnames:
381 @echo "${KERNELS} ${EXTRA_KERNELS}" 391 @echo "${KERNELS} ${EXTRA_KERNELS}"
382.endif 392.endif
383 393
384.if !target(__CLEANDEPEND) 394.if !target(__CLEANDEPEND)
385__CLEANDEPEND: .USE 395__CLEANDEPEND: .USE
386 echo .depend ${DEPS} | xargs rm -f -- 396 echo .depend ${DEPS} | xargs rm -f --
387.endif 397.endif
388 398
389# do not !target these, the kern and compat Makefiles augment them 399# do not !target these, the kern and compat Makefiles augment them
390cleandir distclean: __CLEANKERNEL __CLEANDEPEND 400cleandir distclean: __CLEANKERNEL __CLEANDEPEND
391clean: __CLEANKERNEL 401clean: __CLEANKERNEL
392depend: .depend 402depend: .depend
393dependall: depend .WAIT all 403dependall: depend .WAIT all
394 404
395## 405##
396## depend 406## depend
397## 407##
398 408
399.if !target(.depend) 409.if !target(.depend)
400MKDEP_AFLAGS?= ${AFLAGS} 410MKDEP_AFLAGS?= ${AFLAGS}
401MKDEP_CFLAGS?= ${CFLAGS} 411MKDEP_CFLAGS?= ${CFLAGS}
402.if !defined(___USE_SUFFIX_RULES___) 412.if !defined(___USE_SUFFIX_RULES___)
403DEPS+= ${SRCS:T:R:S/$/.d/g} 413DEPS+= ${SRCS:T:R:S/$/.d/g}
404.else 414.else
405DEPS+= ${SRCS:R:S/$/.d/g} 415DEPS+= ${SRCS:R:S/$/.d/g}
406.endif 416.endif
407 417
408.if !defined(___USE_SUFFIX_RULES___) 418.if !defined(___USE_SUFFIX_RULES___)
409.for _s in ${SSRCS} 419.for _s in ${SSRCS}
410.if !commands(${_s:T:R}.d) 420.if !commands(${_s:T:R}.d)
411${_s:T:R}.d: ${_s} 421${_s:T:R}.d: ${_s}
412 ${_MKTARGET_CREATE} 422 ${_MKTARGET_CREATE}
413 ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \ 423 ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \
414 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} 424 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
415 mv -f ${.TARGET}.tmp ${.TARGET} 425 mv -f ${.TARGET}.tmp ${.TARGET}
416.endif 426.endif
417.endfor 427.endfor
418 428
419.for _s in ${CSRCS} 429.for _s in ${CSRCS}
420.if !commands(${_s:T:R}.d) 430.if !commands(${_s:T:R}.d)
421${_s:T:R}.d: ${_s} 431${_s:T:R}.d: ${_s}
422 ${_MKTARGET_CREATE} 432 ${_MKTARGET_CREATE}
423 ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \ 433 ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \
424 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} 434 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
425 mv -f ${.TARGET}.tmp ${.TARGET} 435 mv -f ${.TARGET}.tmp ${.TARGET}
426.endif 436.endif
427.endfor 437.endfor
428.endif # !___USE_SUFFIX_RULES___ 438.endif # !___USE_SUFFIX_RULES___
429 439
430.depend: ${DEPS:O} 440.depend: ${DEPS:O}
431 ${_MKTARGET_CREATE} 441 ${_MKTARGET_CREATE}
432 echo "${.ALLSRC}" | ${MKDEP} -D 442 echo "${.ALLSRC}" | ${MKDEP} -D
433.endif 443.endif
434 444
435## 445##
436## install 446## install
437## 447##
438 448
439# List of kernel images that will be installed into the root file system. 449# List of kernel images that will be installed into the root file system.
440# Some platforms may need to install more than one (e.g. a netbsd.aout file 450# Some platforms may need to install more than one (e.g. a netbsd.aout file
441# to be loaded directly by the firmware), so this can be overridden by them. 451# to be loaded directly by the firmware), so this can be overridden by them.
442KERNIMAGES?= netbsd 452KERNIMAGES?= netbsd
443 453
444.if !target(install) 454.if !target(install)
445# The install target can be redefined by putting a 455# The install target can be redefined by putting a
446# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 456# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
447MACHINE_NAME!= uname -n 457MACHINE_NAME!= uname -n
448install: install-kernel-${MACHINE_NAME} 458install: install-kernel-${MACHINE_NAME}
449.if !target(install-kernel-${MACHINE_NAME}) 459.if !target(install-kernel-${MACHINE_NAME})
450install-kernel-${MACHINE_NAME}: 460install-kernel-${MACHINE_NAME}:
451.for _K in ${KERNIMAGES} 461.for _K in ${KERNIMAGES}
452.if ${KERNEL_DIR:Uno} == "yes" 462.if ${KERNEL_DIR:Uno} == "yes"
453 rm -fr ${DESTDIR}/o${_K} 463 rm -fr ${DESTDIR}/o${_K}
454 mv ${DESTDIR}/${_K} ${DESTDIR}/o${_K} 464 mv ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
455 mkdir -p ${DESTDIR}/${_K} 465 mkdir -p ${DESTDIR}/${_K}
456 cp ${_K} ${DESTDIR}/${_K}/kernel 466 cp ${_K} ${DESTDIR}/${_K}/kernel
457.else 467.else
458 rm -f ${DESTDIR}/o${_K} 468 rm -f ${DESTDIR}/o${_K}
459 ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K} 469 ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
460 cp ${_K} ${DESTDIR}/n${_K} 470 cp ${_K} ${DESTDIR}/n${_K}
461 mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K} 471 mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
462.endif 472.endif
463.endfor 473.endfor
464.endif 474.endif
465.endif 475.endif
466 476
467## 477##
468## the kernel 478## the kernel
469## 479##
470 480
471AFLAGS+= ${AOPTS.${.IMPSRC:T}} 481AFLAGS+= ${AOPTS.${.IMPSRC:T}}
472CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} 482CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
473CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} 483CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
474CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} 484CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
475 485
476.for _v in COPTS CPPFLAGS CWARNFLAGS 486.for _v in COPTS CPPFLAGS CWARNFLAGS
477.for _c in ${CSRCS} 487.for _c in ${CSRCS}
478${_v}.${_c:T}+=${OPT.${_c:T}:@.o.@${${_v}.${.o.}}@} 488${_v}.${_c:T}+=${OPT.${_c:T}:@.o.@${${_v}.${.o.}}@}
479.endfor 489.endfor
480.endfor 490.endfor
481 491
482.MAIN: all 492.MAIN: all
483all: .gdbinit 493all: .gdbinit
484.for k in ${KERNELS} 494.for k in ${KERNELS}
485all: .WAIT ${k} 495all: .WAIT ${k}
486${k}: ${SYSTEM_DEP:O} swap${k}.o vers.o build_kernel #${MKLINT:Myes:%=lint} 496${k}: ${SYSTEM_DEP:O} swap${k}.o vers.o build_kernel #${MKLINT:Myes:%=lint}
487.endfor 497.endfor
488 498
489.if !defined(COPY_SYMTAB) 499.if !defined(COPY_SYMTAB)
490build_kernel: .USE 500build_kernel: .USE
491 ${SYSTEM_LD_HEAD} 501 ${SYSTEM_LD_HEAD}
492 ${SYSTEM_LD} 502 ${SYSTEM_LD}
493 ${SYSTEM_LD_TAIL_STAGE2} 503 ${SYSTEM_LD_TAIL_STAGE2}
494.else 504.else
495.for k in ${KERNELS} 505.for k in ${KERNELS}
496${k}: $S/kern/kern_ksyms_buf.c 506${k}: $S/kern/kern_ksyms_buf.c
497.endfor 507.endfor
498build_kernel: .USE 508build_kernel: .USE
499 ${CC} ${CFLAGS} ${CPPFLAGS} \ 509 ${CC} ${CFLAGS} ${CPPFLAGS} \
500 -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o 510 -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
501 ${SYSTEM_LD_HEAD} 511 ${SYSTEM_LD_HEAD}
502 ${SYSTEM_LD} kern_ksyms_buf.o 512 ${SYSTEM_LD} kern_ksyms_buf.o
503 ${SYSTEM_LD_TAIL_STAGE1} 513 ${SYSTEM_LD_TAIL_STAGE1}
504 ${CC} ${CFLAGS} ${CPPFLAGS} \ 514 ${CC} ${CFLAGS} ${CPPFLAGS} \
505 -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \ 515 -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
506 -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o 516 -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
507 ${SYSTEM_LD_HEAD} 517 ${SYSTEM_LD_HEAD}
508 ${SYSTEM_LD} kern_ksyms_buf_real.o 518 ${SYSTEM_LD} kern_ksyms_buf_real.o
509 ${SYSTEM_LD_TAIL_STAGE2} 519 ${SYSTEM_LD_TAIL_STAGE2}
510.endif 520.endif
511 521
512.include <bsd.files.mk> 522.include <bsd.files.mk>
513.include <bsd.clang-analyze.mk> 523.include <bsd.clang-analyze.mk>
514 524
515## 525##
516## suffix rules 526## suffix rules
517## 527##
518 528
519.if defined(___USE_SUFFIX_RULES___) 529.if defined(___USE_SUFFIX_RULES___)
520.SUFFIXES: .s .d 530.SUFFIXES: .s .d
521.s.d: 531.s.d:
522 ${_MKTARGET_CREATE} 532 ${_MKTARGET_CREATE}
523 ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $< 533 ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
524 mv -f $@.tmp $@ 534 mv -f $@.tmp $@
525 535
526.SUFFIXES: .S .d 536.SUFFIXES: .S .d
527.S.d: 537.S.d:
528 ${_MKTARGET_CREATE} 538 ${_MKTARGET_CREATE}
529 ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $< 539 ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
530 mv -f $@.tmp $@ 540 mv -f $@.tmp $@
531 541
532.SUFFIXES: .c .d 542.SUFFIXES: .c .d
533.c.d: 543.c.d:
534 ${_MKTARGET_CREATE} 544 ${_MKTARGET_CREATE}
535 ${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $< 545 ${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
536 mv -f $@.tmp $@ 546 mv -f $@.tmp $@
537 547
538.SUFFIXES: .c .o .go .po 548.SUFFIXES: .c .o .go .po
539.c.o: 549.c.o:
540 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 550 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
541 @${_MKSHECHO} ${KCOMPILE.c} 551 @${_MKSHECHO} ${KCOMPILE.c}
542 @${KCOMPILE.c} 552 @${KCOMPILE.c}
543 @${COMPILE_CTFCONVERT} 553 @${COMPILE_CTFCONVERT}
544.c.go: 554.c.go:
545 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 555 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
546 @${_MKSHECHO} ${KCOMPILE.c} -g 556 @${_MKSHECHO} ${KCOMPILE.c} -g
547 @${KCOMPILE.c} -g 557 @${KCOMPILE.c} -g
548 @${COMPILE_CTFCONVERT} 558 @${COMPILE_CTFCONVERT}
549.c.po: 559.c.po:
550 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 560 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
551 @${_MKSHECHO} ${KCOMPILE.c} -pg 561 @${_MKSHECHO} ${KCOMPILE.c} -pg
552 @${KCOMPILE.c} -pg 562 @${KCOMPILE.c} -pg
553 @${COMPILE_CTFCONVERT} 563 @${COMPILE_CTFCONVERT}
554 564
555.SUFFIXES: .s .o .go .po 565.SUFFIXES: .s .o .go .po
556.s.o: 566.s.o:
557 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 567 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
558 @${_MKSHECHO} ${KCOMPILE.s} 568 @${_MKSHECHO} ${KCOMPILE.s}
559 @${KCOMPILE.s} 569 @${KCOMPILE.s}
560.s.go: 570.s.go:
561 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 571 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
562 @${_MKSHECHO} ${KCOMPILE.s} -g 572 @${_MKSHECHO} ${KCOMPILE.s} -g
563 @${KCOMPILE.s} -g 573 @${KCOMPILE.s} -g
564.s.po: 574.s.po:
565 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 575 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
566 @${_MKSHECHO} ${KCOMPILE.s} -pg 576 @${_MKSHECHO} ${KCOMPILE.s} -pg
567 @${KCOMPILE.s} -pg 577 @${KCOMPILE.s} -pg
568 578
569.S.o: 579.S.o:
570 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 580 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
571 @${_MKSHECHO} ${KCOMPILE.s} 581 @${_MKSHECHO} ${KCOMPILE.s}
572 @${KCOMPILE.s} 582 @${KCOMPILE.s}
573.S.go: 583.S.go:
574 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 584 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
575 @${_MKSHECHO} ${KCOMPILE.s} -g 585 @${_MKSHECHO} ${KCOMPILE.s} -g
576 @${KCOMPILE.s} -g 586 @${KCOMPILE.s} -g
577.S.po: 587.S.po:
578 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" 588 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
579 @${_MKSHECHO} ${KCOMPILE.s} -pg 589 @${_MKSHECHO} ${KCOMPILE.s} -pg
580 @${KCOMPILE.s} -pg 590 @${KCOMPILE.s} -pg
581.endif # ___USE_SUFFIX_RULES___ 591.endif # ___USE_SUFFIX_RULES___
582 592
583## 593##
584## the end 594## the end
585## 595##