version 1.183, 2014/11/15 12:56:28 |
version 1.183.2.6, 2017/08/28 17:52:00 |
Line 52 _MKTARGET_CREATE?= : |
|
Line 52 _MKTARGET_CREATE?= : |
|
## |
## |
# source tree is located via $S relative to the compilation directory |
# source tree is located via $S relative to the compilation directory |
.ifndef S |
.ifndef S |
S!= cd ../../../..; pwd |
S!= cd ../../../.. && pwd |
.endif |
.endif |
|
|
## |
## |
Line 62 S!= cd ../../../..; pwd |
|
Line 62 S!= cd ../../../..; pwd |
|
## |
## |
INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \ |
INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \ |
-I$S -nostdinc |
-I$S -nostdinc |
CPPFLAGS+= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT |
CPPFLAGS+= ${INCLUDES} ${IDENT} -D_KERNEL -D_KERNEL_OPT |
CPPFLAGS+= -std=gnu99 |
CPPFLAGS+= -std=gnu99 |
DEFCOPTS?= -O2 |
DEFCOPTS?= -O2 |
COPTS?= ${DEFCOPTS} |
COPTS?= ${DEFCOPTS} |
DBG= # might contain unwanted -Ofoo |
DBG= # might contain unwanted -Ofoo |
DEFWARNINGS?= yes |
|
.if (${DEFWARNINGS} == "yes") |
|
CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith |
CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith |
CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes |
CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes |
CWARNFLAGS+= -Wold-style-definition |
CWARNFLAGS+= -Wold-style-definition |
Line 87 CWARNFLAGS+= -Wold-style-definition |
|
Line 85 CWARNFLAGS+= -Wold-style-definition |
|
# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, |
# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, |
# but our sources aren't up for it yet. |
# but our sources aren't up for it yet. |
CWARNFLAGS+= -Wno-sign-compare |
CWARNFLAGS+= -Wno-sign-compare |
.endif |
|
|
|
CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \ |
CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \ |
-Wno-self-assign |
-Wno-self-assign -Wno-error=address-of-packed-member \ |
|
-Wno-error=constant-conversion |
|
|
CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \ |
CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \ |
-Wno-shift-count-negative -Wno-shift-count-overflow:} |
-Wno-shift-count-negative -Wno-shift-count-overflow:} |
Line 107 CFLAGS+= -fno-strict-aliasing |
|
Line 105 CFLAGS+= -fno-strict-aliasing |
|
CFLAGS+= -fno-common |
CFLAGS+= -fno-common |
.endif |
.endif |
|
|
.if ${USE_SSP:Uno} == "yes" |
|
COPTS.kern_ssp.c+= -fno-stack-protector -D__SSP__ |
|
.endif |
|
|
|
# for multi-cpu machines, cpu_hatch() straddles the init of |
|
# __stack_chk_guard, so ensure stack protection is disabled |
|
.if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" |
|
COPTS.cpu.c+= -fno-stack-protector |
|
.endif |
|
|
|
# Use the per-source COPTS variables to add -g to just those |
# Use the per-source COPTS variables to add -g to just those |
# files that match the shell patterns given in ${DEBUGLIST} |
# files that match the shell patterns given in ${DEBUGLIST} |
# |
# |
.for i in ${DEBUGLIST} |
.for i in ${DEBUGLIST} |
. for j in ${CFILES:T:M$i.c} |
. for j in ${ALLFILES:M*.c:T:M$i.c} |
COPTS.${j}+=-g |
COPTS.${j}+=-g |
. endfor |
. endfor |
.endfor |
.endfor |
Line 140 COMPILE_CTFCONVERT= ${_MKSHECHO}\ |
|
Line 128 COMPILE_CTFCONVERT= ${_MKSHECHO}\ |
|
COMPILE_CTFCONVERT= ${_MKSHNOECHO} |
COMPILE_CTFCONVERT= ${_MKSHNOECHO} |
.endif |
.endif |
|
|
|
KCOMPILE.c= ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ |
|
KCOMPILE.s= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@ |
|
KLINK.o= ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC} |
|
|
# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or |
# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or |
# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). |
# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). |
NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ |
NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ |
${_MKSHECHO}\ |
${_MKSHECHO} ${KCOMPILE.c} ${PROF} && \ |
${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< && \ |
${KCOMPILE.c} ${PROF} && \ |
${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< && \ |
|
${COMPILE_CTFCONVERT} |
${COMPILE_CTFCONVERT} |
NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ |
NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ |
${_MKSHECHO}\ |
${_MKSHECHO} ${KCOMPILE.c} && \ |
${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< && \ |
${KCOMPILE.c} && \ |
${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< && \ |
|
${COMPILE_CTFCONVERT} |
${COMPILE_CTFCONVERT} |
NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ |
NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \ |
${_MKSHECHO}\ |
${_MKSHECHO} ${KCOMPILE.s} && \ |
${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< && \ |
${KCOMPILE.s} |
${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< |
|
|
# link rules: |
# link rules: |
|
LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \ |
LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \ |
${_MKSHECHO}\ |
${_MKSHECHO} ${KLINK.o} && \ |
${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC} && \ |
${KLINK.o} |
${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC} |
|
|
|
## |
## |
## (3) libkern and compat |
## (3) libkern and compat |
Line 196 SYSLIBCOMPATLN?= ${COMPATLIBLN} |
|
Line 184 SYSLIBCOMPATLN?= ${COMPATLIBLN} |
|
## Each port should have a corresponding section with settings for |
## Each port should have a corresponding section with settings for |
## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same. |
## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same. |
## |
## |
MI_CFILES=devsw.c ioconf.c param.c |
|
# the need for a MI_SFILES variable is dubitable at best |
|
MI_OBJS=${MI_CFILES:S/.c/.o/} |
|
|
|
param.c: $S/conf/param.c |
.if !defined(___USE_SUFFIX_RULES___) |
${_MKTARGET_CREATE} |
_MD_OBJS= ${MD_OBJS:T} |
rm -f param.c |
.else |
cp $S/conf/param.c . |
_MD_OBJS= ${MD_OBJS} |
|
.endif |
param.o: Makefile |
|
|
|
.for _cfile in ${MI_CFILES} |
|
${_cfile:T:R}.o: ${_cfile} |
|
${NORMAL_C} |
|
.endfor |
|
|
|
## |
## |
## (5) link settings |
## (5) link settings |
Line 223 ${_cfile:T:R}.o: ${_cfile} |
|
Line 202 ${_cfile:T:R}.o: ${_cfile} |
|
# load lines for config "xxx" will be emitted as: |
# load lines for config "xxx" will be emitted as: |
# xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel |
# xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel |
|
|
.if !empty(OBJS:Mnetbsd.ko) |
SYSTEM_LIB= ${MD_LIBS} ${SYSLIBCOMPAT} ${LIBKERN} |
SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN} |
SYSTEM_OBJ?= ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB} |
.else |
SYSTEM_DEP+= Makefile ${SYSTEM_OBJ:O} |
SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS:O} ${SYSLIBCOMPAT} ${LIBKERN} |
|
.endif |
|
SYSTEM_DEP+= Makefile ${SYSTEM_OBJ} .gdbinit |
|
.if defined(KERNLDSCRIPT) |
|
SYSTEM_DEP+= ${KERNLDSCRIPT} |
|
.endif |
|
.if defined(CTFMERGE) |
.if defined(CTFMERGE) |
SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o |
SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o |
.else |
.else |
SYSTEM_CTFMERGE= ${_MKSHECHO} |
SYSTEM_CTFMERGE= ${_MKSHECHO} |
.endif |
.endif |
|
|
|
REMOVE_SWAP= [@] |
|
.for k in ${KERNELS} |
|
REMOVE_SWAP:= ${REMOVE_SWAP}:Nswap${k}.o |
|
.endfor |
|
|
SYSTEM_LD_HEAD?=@rm -f $@ |
SYSTEM_LD_HEAD?=@rm -f $@ |
SYSTEM_LD?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \ |
SYSTEM_LD?= ${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \ |
${_MKSHECHO}\ |
${_MKSHECHO}\ |
${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \ |
${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \ |
${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o |
'$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \ |
|
${OBJS:M*swap${.TARGET}.o}; \ |
|
${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \ |
|
${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \ |
|
${OBJS:M*swap${.TARGET}.o} |
|
|
TEXTADDR?= ${LOADADDRESS} # backwards compatibility |
TEXTADDR?= ${LOADADDRESS} # backwards compatibility |
LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/} |
LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/} |
Line 253 LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} |
|
Line 236 LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} |
|
|
|
LINKFLAGS_DEBUG?= -X |
LINKFLAGS_DEBUG?= -X |
|
|
SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c; \ |
SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \ |
${SIZE} $@; chmod 755 $@; \ |
${SIZE} $@ && chmod 755 $@ && \ |
${SYSTEM_CTFMERGE} |
${SYSTEM_CTFMERGE} |
SYSTEM_LD_TAIL_DEBUG?=; \ |
SYSTEM_LD_TAIL_DEBUG?=&& \ |
echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ |
echo mv -f $@ $@.gdb && mv -f $@ $@.gdb && \ |
echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ |
echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb && \ |
${STRIP} ${STRIPFLAGS} -o $@ $@.gdb |
${STRIP} ${STRIPFLAGS} -o $@ $@.gdb |
LINKFLAGS_NORMAL?= -S |
LINKFLAGS_NORMAL?= -S |
STRIPFLAGS?= -g |
STRIPFLAGS?= -g |
|
|
LINKFLAGS+= ${LINKFLAGS_NORMAL} |
LINKFLAGS+= ${LINKFLAGS_NORMAL} |
.endif |
.endif |
|
|
SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA} |
SYSTEM_LD_HEAD+= ${SYSTEM_LD_HEAD_EXTRA} |
SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL} |
SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL} |
SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL} |
SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL} |
.if defined(COPY_SYMTAB) |
.if defined(COPY_SYMTAB) |
SYSTEM_LD_TAIL_STAGE2+= ; echo ${DBSYM} $@; ${DBSYM} $@ |
SYSTEM_LD_TAIL_STAGE2+= && echo ${DBSYM} $@ && ${DBSYM} $@ |
.if !empty(DEBUG:M-g) |
.if !empty(DEBUG:M-g) |
SYSTEM_LD_TAIL_STAGE2+= ; echo ${DBSYM} $@.gdb; ${DBSYM} $@.gdb |
SYSTEM_LD_TAIL_STAGE2+= && echo ${DBSYM} $@.gdb && ${DBSYM} $@.gdb |
.endif |
.endif |
.endif |
.endif |
SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA} |
SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA} |
Line 288 SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL |
|
Line 271 SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL |
|
## |
## |
## (6) port independent targets and dependencies: assym.h, vers.o |
## (6) port independent targets and dependencies: assym.h, vers.o |
## |
## |
.if !target(assym.h) |
|
assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} |
|
${_MKTARGET_CREATE} |
|
cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \ |
|
${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \ |
|
${GENASSYM_CPPFLAGS} > assym.h.tmp && \ |
|
mv -f assym.h.tmp assym.h |
|
${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h |
|
.endif |
|
|
|
MKREPRO?=no |
.if !defined(___USE_SUFFIX_RULES___) |
|
|
.if ${MKREPRO} == "yes" |
|
_NVFLAGS=${NVFLAGS} -r |
|
.else |
|
_NVFLAGS=${NVFLAGS} |
|
.endif |
|
|
|
.if !target(vers.o) |
# Generate list of *.o files to pass to ${LD}, preserving order. |
newvers: vers.o |
# x/y/z/a.[csS] -> a.[csS] |
vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh \ |
# a.[csS] -> a.o |
$S/conf/osrelease.sh ${_NETBSD_VERSION_DEPENDS} |
OBJS= ${ALLFILES:C|^.*/([^/]*\.[csS])$$|\1|:C|^(.*)\.[csS]$$|\1.o|} |
${_MKMSG_CREATE} vers.c |
|
${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS} |
CFILES= ${ALLFILES:M*.c} |
${_MKTARGET_COMPILE} |
SFILES= ${ALLFILES:M*.[sS]} |
${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c |
OFILES= ${ALLFILES:M*.o} |
${COMPILE_CTFCONVERT} |
# absolute, generated (build directory), relative (under $S) |
|
_CFILES=${CFILES:M/*} ${CFILES:N/*:N*/*} ${CFILES:N/*:M*/*:C|^|$S/|} |
|
_SFILES=${SFILES:M/*} ${SFILES:N/*:N*/*} ${SFILES:N/*:M*/*:C|^|$S/|} |
|
_MD_CFILES=${MD_CFILES} |
|
_MD_SFILES=${MD_SFILES} |
|
CSRCS= ${_MD_CFILES} ${_CFILES} |
|
SSRCS= ${_MD_SFILES} ${_SFILES} |
|
SRCS= ${CSRCS} ${SSRCS} |
|
|
|
.else # ___USE_SUFFIX_RULES___ |
|
OBJS= ${ALLFILES:C|\.[csS]$$|.o|} |
|
SRCS= ${ALLFILES:M*.[csS]} |
|
.endif # ___USE_SUFFIX_RULES___ |
|
|
|
.if !defined(___USE_SUFFIX_RULES___) |
|
.for _s in ${_CFILES} |
|
.if !commands(${_s:T:R}.o) |
|
${_s:T:R}.o: ${_s} |
|
${NORMAL_C} |
.endif |
.endif |
|
.endfor |
|
|
.if defined(MEMORY_DISK_IMAGE) |
.for _s in ${_SFILES} |
md_root_image.h: ${MEMORY_DISK_IMAGE} |
.if !commands(${_s:T:R}.o) |
${_MKTARGET_CREATE} |
${_s:T:R}.o: ${_s} |
${TOOL_HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' ${.ALLSRC} > ${.TARGET} |
${NORMAL_S} |
|
|
# XXX This is only needed when building md_root.o |
|
CPPFLAGS+= -DMEMORY_DISK_IMAGE |
|
md_root.o: md_root_image.h |
|
.endif |
.endif |
|
.endfor |
|
.endif # !___USE_SUFFIX_RULES___ |
|
|
# depend on MEMORY_DISK_IMAGE configuration |
.include "${S}/conf/ldscript.mk" |
md_root.o: Makefile |
.include "${S}/conf/assym.mk" |
|
.include "${S}/conf/newvers.mk" |
# depend on root or device configuration |
.include "${S}/dev/splash/splash.mk" |
autoconf.o conf.o: Makefile |
.include "${S}/conf/mdroot.mk" |
|
.include "${S}/conf/lint.mk" |
# depend on network or filesystem configuration |
.include "${S}/conf/cscope.mk" |
uipc_proto.o vfs_conf.o: Makefile |
.include "${S}/conf/gdbinit.mk" |
|
.include "${S}/conf/ssp.mk" |
# depend on maxusers and CPU configuration |
.include "${S}/conf/dts.mk" |
assym.h machdep.o: Makefile |
|
|
|
## |
## |
## (7) misc targets: install, clean(dir), depend(all), lint, links, tags, |
## (7) misc targets: install, clean(dir), depend(all), lint, links, tags, |
Line 347 assym.h machdep.o: Makefile |
|
Line 331 assym.h machdep.o: Makefile |
|
## EXTRA_CLEAN. Some ports may want different settings for |
## EXTRA_CLEAN. Some ports may want different settings for |
## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS. |
## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS. |
## |
## |
|
|
|
## |
|
## clean |
|
## |
|
|
.if !target(__CLEANKERNEL) |
.if !target(__CLEANKERNEL) |
__CLEANKERNEL: .USE |
__CLEANKERNEL: .USE |
${_MKMSG} "${.TARGET}ing the kernel objects" |
${_MKMSG} "${.TARGET}ing the kernel objects" |
Line 371 clean: __CLEANKERNEL |
|
Line 360 clean: __CLEANKERNEL |
|
depend: .depend |
depend: .depend |
dependall: depend .WAIT all |
dependall: depend .WAIT all |
|
|
|
## |
|
## depend |
|
## |
|
|
.if !target(.depend) |
.if !target(.depend) |
MKDEP_AFLAGS?= ${AFLAGS} |
MKDEP_AFLAGS?= ${AFLAGS} |
MKDEP_CFLAGS?= ${CFLAGS} |
MKDEP_CFLAGS?= ${CFLAGS} |
SSRCS=${MD_SFILES} ${SFILES} |
.if !defined(___USE_SUFFIX_RULES___) |
CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES} |
DEPS+= ${SRCS:T:R:S/$/.d/g} |
SRCS=${SSRCS} ${CSRCS} |
.else |
DEPS= ${SRCS:T:u:R:S/$/.d/g} |
DEPS+= ${SRCS:R:S/$/.d/g} |
|
.endif |
|
|
|
.if !defined(___USE_SUFFIX_RULES___) |
.for _s in ${SSRCS} |
.for _s in ${SSRCS} |
.if !target(${_s:T:R}.d) |
.if !commands(${_s:T:R}.d) |
${_s:T:R}.d: ${_s} assym.h |
${_s:T:R}.d: ${_s} |
${_MKTARGET_CREATE} |
${_MKTARGET_CREATE} |
${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \ |
${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \ |
${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} |
${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} |
|
mv -f ${.TARGET}.tmp ${.TARGET} |
.endif |
.endif |
.endfor |
.endfor |
|
|
.for _s in ${CSRCS} |
.for _s in ${CSRCS} |
.if !target(${_s:T:R}.d) |
.if !commands(${_s:T:R}.d) |
${_s:T:R}.d: ${_s} |
${_s:T:R}.d: ${_s} |
${_MKTARGET_CREATE} |
${_MKTARGET_CREATE} |
${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \ |
${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \ |
${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} |
${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} |
|
mv -f ${.TARGET}.tmp ${.TARGET} |
.endif |
.endif |
.endfor |
.endfor |
|
.endif # !___USE_SUFFIX_RULES___ |
|
|
assym.d: assym.h |
.depend: ${DEPS:O} |
${_MKTARGET_CREATE} |
|
cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \ |
|
${GENASSYM} -- ${MKDEP} -f assym.dep -- \ |
|
${CFLAGS:N-Wa,*} ${CPPFLAGS} ${GENASSYM_CPPFLAGS} |
|
${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET} |
|
rm -f assym.dep |
|
|
|
DEPS+= assym.d |
|
|
|
.depend: ${DEPS} |
|
${_MKTARGET_CREATE} |
${_MKTARGET_CREATE} |
echo "${.ALLSRC}" | ${MKDEP} -D |
echo "${.ALLSRC}" | ${MKDEP} -D |
.endif |
.endif |
|
|
.if !target(lint) |
## |
ALLSFILES?= ${MD_SFILES} ${SFILES} |
## install |
LINTSTUBS?= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g} |
## |
KERNLINTFLAGS?= -bcehnxzFS |
|
NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $< |
|
|
|
_lsrc=${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES} |
|
LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN} |
|
|
|
.for _sfile in ${ALLSFILES} |
|
LintStub_${_sfile:T:R}.c: ${_sfile} assym.h |
|
${_MKTARGET_COMPILE} |
|
${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${_sfile} | \ |
|
${TOOL_AWK} -f $S/kern/genlintstub.awk >${.TARGET} |
|
.endfor |
|
|
|
.for _cfile in ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES} |
|
${_cfile:T:R}.ln: ${_cfile} |
|
${_MKTARGET_COMPILE} |
|
${NORMAL_LN} |
|
.endfor |
|
|
|
lint: ${LOBJS} |
|
${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${LOBJS} |
|
.endif |
|
|
|
# Attempt to do a syntax-only compile of the entire kernel as one entity. |
|
# Alas, bugs in the GCC C frontend prevent this from completely effective |
|
# but information can be gleaned from the output. |
|
syntax-only: ${CFILES} ${MD_CFILES} |
|
${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \ |
|
${CFILES} ${MD_CFILES} |
|
|
|
# List of kernel images that will be installed into the root file system. |
# List of kernel images that will be installed into the root file system. |
# Some platforms may need to install more than one (e.g. a netbsd.aout file |
# Some platforms may need to install more than one (e.g. a netbsd.aout file |
Line 465 install-kernel-${MACHINE_NAME}: |
|
Line 425 install-kernel-${MACHINE_NAME}: |
|
.endif |
.endif |
.endif |
.endif |
|
|
.if !target(tags) |
## |
tags: |
## the kernel |
@echo "see $S/kern/Makefile for tags" |
## |
.endif |
|
|
|
EXTRA_CLEAN+= cscope.out cscope.tmp |
|
.if !target(cscope.out) |
|
cscope.out: Makefile depend |
|
${_MKTARGET_CREATE} |
|
@${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend \ |
|
| tr -s ' ' '\n' \ |
|
| ${TOOL_SED} ';s|^../../||;' \ |
|
> cscope.tmp |
|
@${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend \ |
|
| tr -s ' ' '\n' \ |
|
| ${TOOL_SED} 's|^../../||;' \ |
|
>> cscope.tmp |
|
@echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \ |
|
${CSCOPE} -k -i - -b `echo ${INCLUDES} | ${TOOL_SED} s/-nostdinc//` |
|
# cscope doesn't write cscope.out if it's uptodate, so ensure |
|
# make doesn't keep calling cscope when not needed. |
|
@rm -f cscope.tmp; touch cscope.out |
|
.endif |
|
|
|
.if !target(cscope) |
|
cscope: cscope.out |
|
@${CSCOPE} -d |
|
.endif |
|
|
|
EXTRA_CLEAN+= ID |
|
.if !target(mkid) |
|
.PHONY: mkid |
|
mkid: ID |
|
|
|
ID: Makefile depend |
|
${_MKTARGET_CREATE} |
|
@${MKID} \ |
|
`${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \ |
|
lib/kern/.depend lib/compat/.depend \ |
|
| tr ' ' '\n' \ |
|
| ${TOOL_SED} "s|^../../||" \ |
|
| sort -u` \ |
|
`${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \ |
|
.depend \ |
|
| tr ' ' '\n' \ |
|
| sort -u` |
|
|
|
.endif |
|
|
|
.include "${S}/gdbscripts/Makefile.inc" |
|
|
|
EXTRA_CLEAN+= .gdbinit |
|
.gdbinit: Makefile ${S}/gdbscripts/Makefile.inc |
|
${_MKTARGET_CREATE} |
|
rm -f .gdbinit |
|
.for __gdbinit in ${SYS_GDBINIT} |
|
echo "source ${S}/gdbscripts/${__gdbinit}" >> .gdbinit |
|
.endfor |
|
.if defined(GDBINIT) && !empty(GDBINIT) |
|
.for __gdbinit in ${GDBINIT} |
|
echo "source ${__gdbinit}" >> .gdbinit |
|
.endfor |
|
.endif |
|
|
|
# The following files use alloca(3) or variable array allocations. |
|
# Their full name is noted as documentation. |
|
VARSTACK=kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \ |
|
nfs/nfs_bio.c uvm/uvm_bio.c \ |
|
uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \ |
|
dev/ofw/ofw_subr.c |
|
|
|
.for __varstack in ${VARSTACK} |
|
COPTS.${__varstack:T} += -Wno-stack-protector |
|
.endfor |
|
|
|
AFLAGS+= ${AOPTS.${.IMPSRC:T}} |
AFLAGS+= ${AOPTS.${.IMPSRC:T}} |
CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} |
CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} |
CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} |
CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} |
CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} |
CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} |
|
|
locore.o machdep.o kern_ksyms.o: Makefile |
.MAIN: all |
|
all: .gdbinit |
.if defined(COPY_SYMTAB) |
.for k in ${KERNELS} |
CPPFLAGS.locore.S+= -DCOPY_SYMTAB |
all: .WAIT ${k} |
CPPFLAGS.machdep.c+= -DCOPY_SYMTAB |
${k}: ${SYSTEM_DEP:O} swap${k}.o vers.o build_kernel |
CPPFLAGS.kern_ksyms.c+= -DCOPY_SYMTAB |
.endfor |
CPPFLAGS.kern_ksyms_buf.c+= -DCOPY_SYMTAB |
|
.endif |
|
|
|
.if !defined(COPY_SYMTAB) |
.if !defined(COPY_SYMTAB) |
build_kernel: .USE |
build_kernel: .USE |
${SYSTEM_LD_HEAD} |
${SYSTEM_LD_HEAD} |
${SYSTEM_LD} swap${.TARGET}.o |
${SYSTEM_LD} |
${SYSTEM_LD_TAIL_STAGE2} |
${SYSTEM_LD_TAIL_STAGE2} |
.else |
.else |
|
.for k in ${KERNELS} |
|
${k}: $S/kern/kern_ksyms_buf.c |
|
.endfor |
build_kernel: .USE |
build_kernel: .USE |
${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \ |
${CC} ${CFLAGS} ${CPPFLAGS} \ |
-c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o |
-c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o |
${SYSTEM_LD_HEAD} |
${SYSTEM_LD_HEAD} |
${SYSTEM_LD} swap${.TARGET}.o kern_ksyms_buf.o |
${SYSTEM_LD} kern_ksyms_buf.o |
${SYSTEM_LD_TAIL_STAGE1} |
${SYSTEM_LD_TAIL_STAGE1} |
${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \ |
${CC} ${CFLAGS} ${CPPFLAGS} \ |
-DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \ |
-DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \ |
-c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o |
-c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o |
${SYSTEM_LD_HEAD} |
${SYSTEM_LD_HEAD} |
${SYSTEM_LD} swap${.TARGET}.o kern_ksyms_buf_real.o |
${SYSTEM_LD} kern_ksyms_buf_real.o |
${SYSTEM_LD_TAIL_STAGE2} |
${SYSTEM_LD_TAIL_STAGE2} |
.endif |
.endif |
|
|
Line 578 build_kernel: .USE |
|
Line 468 build_kernel: .USE |
|
.include <bsd.clang-analyze.mk> |
.include <bsd.clang-analyze.mk> |
|
|
## |
## |
|
## suffix rules |
|
## |
|
|
|
.if defined(___USE_SUFFIX_RULES___) |
|
.SUFFIXES: .s .d |
|
.s.d: |
|
${_MKTARGET_CREATE} |
|
${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $< |
|
mv -f $@.tmp $@ |
|
|
|
.SUFFIXES: .S .d |
|
.S.d: |
|
${_MKTARGET_CREATE} |
|
${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $< |
|
mv -f $@.tmp $@ |
|
|
|
.SUFFIXES: .c .d |
|
.c.d: |
|
${_MKTARGET_CREATE} |
|
${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $< |
|
mv -f $@.tmp $@ |
|
|
|
.SUFFIXES: .c .o .go .po |
|
.c.o: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.c} |
|
@${KCOMPILE.c} |
|
@${COMPILE_CTFCONVERT} |
|
.c.go: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.c} -g |
|
@${KCOMPILE.c} -g |
|
@${COMPILE_CTFCONVERT} |
|
.c.po: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.c} -pg |
|
@${KCOMPILE.c} -pg |
|
@${COMPILE_CTFCONVERT} |
|
|
|
.SUFFIXES: .s .o .go .po |
|
.s.o: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.s} |
|
@${KCOMPILE.s} |
|
.s.go: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.s} -g |
|
@${KCOMPILE.s} -g |
|
.s.po: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.s} -pg |
|
@${KCOMPILE.s} -pg |
|
|
|
.S.o: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.s} |
|
@${KCOMPILE.s} |
|
.S.go: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.s} -g |
|
@${KCOMPILE.s} -g |
|
.S.po: |
|
@${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" |
|
@${_MKSHECHO} ${KCOMPILE.s} -pg |
|
@${KCOMPILE.s} -pg |
|
.endif # ___USE_SUFFIX_RULES___ |
|
|
|
## |
## the end |
## the end |
## |
## |