Makefile.rump revision 1.59
11.59Spooka# $NetBSD: Makefile.rump,v 1.59 2011/01/06 11:22:54 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.59Spooka.ifdef RUMP_LOCKDEBUG 341.59SpookaCPPFLAGS+= -DLOCKDEBUG 351.59Spooka.endif 361.59Spooka 371.42Spooka# kernel libs should not get linked against libc 381.43Spooka# XXX: actually, we would like to enable this but cannot, since it 391.43Spooka# also leaves out libgcc, it causes problems on some platforms. 401.43Spooka# revisit some day. 411.43Spooka#LDFLAGS+= -nodefaultlibs 421.42Spooka 431.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 441.39SpookaCPPFLAGS+= -D__NetBSD__ 451.39Spooka 461.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 471.11Spooka 481.13Spooka# workaround: evbppc is not a well-defined arch 491.13Spooka.if (${MACHINE} == "evbppc") 501.16SpookaCPPFLAGS+= -DPPC_OEA 511.13Spooka.endif 521.13Spooka 531.25Spooka# If this file changes, we need a full rebuild 541.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 551.24Spooka 561.24Spooka# 571.24Spooka# Rename library symbols before use. If a symbol does not already belong 581.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 591.24Spooka# avoids accidentally linking any kernel symbol against host platform 601.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 611.24Spooka# the GOT, which are more a property of the compiler than the kernel. 621.24Spooka# 631.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 641.29Spooka# satisfied by the toolchain itself when the program is linked. 651.29Spooka# Unfortunately, we do not know which of the symbols are generated by 661.29Spooka# the toolchain. Worse, they vary from platform to platform and 671.29Spooka# toolchain to toolchain. The good news, however, is that this will 681.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 691.29Spooka# a quirktable here. 701.46Spooka# 711.46Spooka# We also allow calling ourselves externally with e.g.: 721.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 731.46Spooka# 741.29Spooka.if ${MACHINE_CPU} == "mips" 751.29Spooka_SYMQUIRK='|_gp_disp' 761.29Spooka.elif ${MACHINE_CPU} == "hppa" 771.29Spooka_SYMQUIRK='|\$$\$$' 781.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 791.55Smrg_SYMQUIRK="|PF_funcs" 801.55Smrg.endif 811.55Smrg 821.55Smrg# 831.55Smrg# Prefix quirks. At least one toolchain generates global 841.55Smrg# symbols with prefixes which really need to remain as prefixes 851.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 861.55Smrg# way to know if you have the problem is if you get later 871.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 881.55Smrg# the 'X' part was added by the toolchain and will need to 891.55Smrg# be mentioned here. 901.55Smrg# 911.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 921.55Smrg_PQ="\.?" 931.55Smrg.else 941.55Smrg_PQ= 951.29Spooka.endif 961.46Spooka 971.46Spookarump_symren: __archivebuild 981.46Spooka.if !defined(RUMP_SYMREN) 991.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1001.46Spooka @false 1011.46Spooka.endif 1021.46Spooka 1031.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1041.46Spooka# build the arrrrchive. otherwise just rename symbols. 1051.24Spooka__archivebuild: .USE 1061.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1071.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1081.46Spooka @false 1091.46Spooka.endif 1101.46Spooka.if defined(RUMP_SYMREN) 1111.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1121.46Spooka.else 1131.24Spooka ${_MKTARGET_BUILD} 1141.24Spooka rm -f ${.TARGET} 1151.34Spooka ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 1161.46Spooka.endif 1171.46Spooka ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \ 1181.55Smrg $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1191.55Smrg {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \ 1201.24Spooka | sort | uniq > renametab.${.TARGET} 1211.37Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1221.46Spooka renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}} 1231.24Spooka rm -f renametab.${.TARGET} 1241.46Spooka.if !defined(RUMP_SYMREN) 1251.36Sperry ${AR} ${_ARRANFL} ${.TARGET} 1261.46Spooka.endif 1271.47Spooka 1281.53Spooka_BSD_IOCONF_MK_USER_=1 1291.53Spooka.include <bsd.ioconf.mk> 1301.47Spooka 1311.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 1321.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 133