Makefile.rump revision 1.58
11.58Spooka# $NetBSD: Makefile.rump,v 1.58 2010/12/06 09:12:34 pooka Exp $ 21.1Spooka# 31.1Spooka 41.33SlukemWARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet 51.10SpookaNOLINT= # kernel code 61.1Spooka 71.20Spooka.include <bsd.own.mk> 81.20Spooka 91.51Spooka# If RUMPKMOD is _not_ set (only on capable archs, from bsd.own.mk), 101.51Spooka# use rump ABI instead of the NetBSD kernel ABI. 111.31She.ifndef RUMPKMOD 121.18SpookaCPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 131.57SpookaCPPFLAGS+= -D_RUMPKERNEL 141.56Spooka.else 151.56SpookaCPPFLAGS+= -D_RUMP_NATIVE_ABI 161.18Spooka.endif 171.18Spooka 181.22SpookaCFLAGS+= -ffreestanding -fno-strict-aliasing 191.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 201.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 211.21SpookaCPPFLAGS+= -DMAXUSERS=32 221.17SpookaCPPFLAGS+= -DDIAGNOSTIC 231.32SpookaCPPFLAGS+= -DCOMPAT_50 241.38SpookaCPPFLAGS+= -DDEBUGPRINT 251.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 261.58SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include -isystem ${RUMPTOP}/../arch 271.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 281.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 291.58SpookaCPPFLAGS+= -nostdinc -isystem ${RUMPTOP}/.. 301.45SpookaLDFLAGS+= -T ${RUMPTOP}/ldscript.rump 311.10Spooka#CPPFLAGS+= -DDEBUG 321.1Spooka 331.42Spooka# kernel libs should not get linked against libc 341.43Spooka# XXX: actually, we would like to enable this but cannot, since it 351.43Spooka# also leaves out libgcc, it causes problems on some platforms. 361.43Spooka# revisit some day. 371.43Spooka#LDFLAGS+= -nodefaultlibs 381.42Spooka 391.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 401.39SpookaCPPFLAGS+= -D__NetBSD__ 411.39Spooka 421.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 431.11Spooka 441.13Spooka# workaround: evbppc is not a well-defined arch 451.13Spooka.if (${MACHINE} == "evbppc") 461.16SpookaCPPFLAGS+= -DPPC_OEA 471.13Spooka.endif 481.13Spooka 491.25Spooka# If this file changes, we need a full rebuild 501.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 511.24Spooka 521.24Spooka# 531.24Spooka# Rename library symbols before use. If a symbol does not already belong 541.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 551.24Spooka# avoids accidentally linking any kernel symbol against host platform 561.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 571.24Spooka# the GOT, which are more a property of the compiler than the kernel. 581.24Spooka# 591.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 601.29Spooka# satisfied by the toolchain itself when the program is linked. 611.29Spooka# Unfortunately, we do not know which of the symbols are generated by 621.29Spooka# the toolchain. Worse, they vary from platform to platform and 631.29Spooka# toolchain to toolchain. The good news, however, is that this will 641.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 651.29Spooka# a quirktable here. 661.46Spooka# 671.46Spooka# We also allow calling ourselves externally with e.g.: 681.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 691.46Spooka# 701.29Spooka.if ${MACHINE_CPU} == "mips" 711.29Spooka_SYMQUIRK='|_gp_disp' 721.29Spooka.elif ${MACHINE_CPU} == "hppa" 731.29Spooka_SYMQUIRK='|\$$\$$' 741.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 751.55Smrg_SYMQUIRK="|PF_funcs" 761.55Smrg.endif 771.55Smrg 781.55Smrg# 791.55Smrg# Prefix quirks. At least one toolchain generates global 801.55Smrg# symbols with prefixes which really need to remain as prefixes 811.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 821.55Smrg# way to know if you have the problem is if you get later 831.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 841.55Smrg# the 'X' part was added by the toolchain and will need to 851.55Smrg# be mentioned here. 861.55Smrg# 871.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 881.55Smrg_PQ="\.?" 891.55Smrg.else 901.55Smrg_PQ= 911.29Spooka.endif 921.46Spooka 931.46Spookarump_symren: __archivebuild 941.46Spooka.if !defined(RUMP_SYMREN) 951.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 961.46Spooka @false 971.46Spooka.endif 981.46Spooka 991.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1001.46Spooka# build the arrrrchive. otherwise just rename symbols. 1011.24Spooka__archivebuild: .USE 1021.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1031.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1041.46Spooka @false 1051.46Spooka.endif 1061.46Spooka.if defined(RUMP_SYMREN) 1071.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1081.46Spooka.else 1091.24Spooka ${_MKTARGET_BUILD} 1101.24Spooka rm -f ${.TARGET} 1111.34Spooka ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 1121.46Spooka.endif 1131.46Spooka ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \ 1141.55Smrg $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1151.55Smrg {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \ 1161.24Spooka | sort | uniq > renametab.${.TARGET} 1171.37Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1181.46Spooka renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}} 1191.24Spooka rm -f renametab.${.TARGET} 1201.46Spooka.if !defined(RUMP_SYMREN) 1211.36Sperry ${AR} ${_ARRANFL} ${.TARGET} 1221.46Spooka.endif 1231.47Spooka 1241.53Spooka_BSD_IOCONF_MK_USER_=1 1251.53Spooka.include <bsd.ioconf.mk> 1261.47Spooka 1271.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 1281.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 129