Module Name: src
Committed By: uebayasi
Date: Mon Aug 24 15:50:47 UTC 2015
Modified Files:
src/sys/conf: Makefile.kern.inc
Log Message:
If a kernel linker script is provided, preprocess it by cpp(1).
Thus some constants (PAGE_SIZE, COHERENCY_UNIT, ...) can be replaced in linker
scripts without setting unnecessary temporary symbols, or doing ugly sed(1)
hacks. No headers are included yet.
To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/conf/Makefile.kern.inc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.187 src/sys/conf/Makefile.kern.inc:1.188
--- src/sys/conf/Makefile.kern.inc:1.187 Mon Aug 24 15:44:01 2015
+++ src/sys/conf/Makefile.kern.inc Mon Aug 24 15:50:47 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.kern.inc,v 1.187 2015/08/24 15:44:01 uebayasi Exp $
+# $NetBSD: Makefile.kern.inc,v 1.188 2015/08/24 15:50:47 uebayasi Exp $
#
# This file contains common `MI' targets and definitions and it is included
# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -230,8 +230,7 @@ SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJ
.endif
SYSTEM_DEP+= Makefile ${SYSTEM_OBJ} .gdbinit
.if defined(KERNLDSCRIPT)
-SYSTEM_DEP+= ${KERNLDSCRIPT}
-LINKSCRIPT= -T ${KERNLDSCRIPT}
+SYSTEM_DEP+= ${.TARGET}.ldscript
.endif
.if defined(CTFMERGE)
SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
@@ -251,6 +250,15 @@ ${KERNLDSCRIPT}: ${SYSTEM_OBJ}
.endif
.endif
+.if defined(KERNLDSCRIPT)
+.for k in ${KERNELS}
+EXTRA_CLEAN+= ${k}.ldscript
+${k}.ldscript: ${KERNLDSCRIPT}
+ ${CPP} ${KERNLDSCRIPT} | grep -v '^#' >$@
+.endfor
+LINKSCRIPT= -T ${.TARGET}.ldscript
+.endif
+
TEXTADDR?= ${LOADADDRESS} # backwards compatibility
LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/}
LINKDATA?= ${DATAADDR:C/.+/-Tdata &/}