Makefile.rump revision 1.61
11.61Smatt# $NetBSD: Makefile.rump,v 1.61 2011/05/10 00:33:58 matt 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.61Smatt.if defined(HAVE_GCC) && ${HAVE_GCC} >= 3 201.61SmattCFLAGS+= -Wsign-compare 211.61SmattCFLAGS+= -Wno-pointer-sign -Wno-attributes 221.61SmattCFLAGS+= -std=gnu99 231.61Smatt.endif 241.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 251.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 261.21SpookaCPPFLAGS+= -DMAXUSERS=32 271.17SpookaCPPFLAGS+= -DDIAGNOSTIC 281.60SmattCPPFLAGS+= -DCOMPAT_50=1 291.38SpookaCPPFLAGS+= -DDEBUGPRINT 301.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 311.58SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include -isystem ${RUMPTOP}/../arch 321.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 331.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 341.58SpookaCPPFLAGS+= -nostdinc -isystem ${RUMPTOP}/.. 351.45SpookaLDFLAGS+= -T ${RUMPTOP}/ldscript.rump 361.10Spooka#CPPFLAGS+= -DDEBUG 371.1Spooka 381.59Spooka.ifdef RUMP_LOCKDEBUG 391.59SpookaCPPFLAGS+= -DLOCKDEBUG 401.59Spooka.endif 411.59Spooka 421.42Spooka# kernel libs should not get linked against libc 431.43Spooka# XXX: actually, we would like to enable this but cannot, since it 441.43Spooka# also leaves out libgcc, it causes problems on some platforms. 451.43Spooka# revisit some day. 461.43Spooka#LDFLAGS+= -nodefaultlibs 471.42Spooka 481.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 491.39SpookaCPPFLAGS+= -D__NetBSD__ 501.39Spooka 511.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 521.11Spooka 531.13Spooka# workaround: evbppc is not a well-defined arch 541.13Spooka.if (${MACHINE} == "evbppc") 551.16SpookaCPPFLAGS+= -DPPC_OEA 561.13Spooka.endif 571.13Spooka 581.25Spooka# If this file changes, we need a full rebuild 591.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 601.24Spooka 611.24Spooka# 621.24Spooka# Rename library symbols before use. If a symbol does not already belong 631.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 641.24Spooka# avoids accidentally linking any kernel symbol against host platform 651.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 661.24Spooka# the GOT, which are more a property of the compiler than the kernel. 671.24Spooka# 681.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 691.29Spooka# satisfied by the toolchain itself when the program is linked. 701.29Spooka# Unfortunately, we do not know which of the symbols are generated by 711.29Spooka# the toolchain. Worse, they vary from platform to platform and 721.29Spooka# toolchain to toolchain. The good news, however, is that this will 731.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 741.29Spooka# a quirktable here. 751.46Spooka# 761.46Spooka# We also allow calling ourselves externally with e.g.: 771.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 781.46Spooka# 791.29Spooka.if ${MACHINE_CPU} == "mips" 801.29Spooka_SYMQUIRK='|_gp_disp' 811.29Spooka.elif ${MACHINE_CPU} == "hppa" 821.29Spooka_SYMQUIRK='|\$$\$$' 831.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 841.55Smrg_SYMQUIRK="|PF_funcs" 851.55Smrg.endif 861.55Smrg 871.55Smrg# 881.55Smrg# Prefix quirks. At least one toolchain generates global 891.55Smrg# symbols with prefixes which really need to remain as prefixes 901.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 911.55Smrg# way to know if you have the problem is if you get later 921.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 931.55Smrg# the 'X' part was added by the toolchain and will need to 941.55Smrg# be mentioned here. 951.55Smrg# 961.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 971.55Smrg_PQ="\.?" 981.55Smrg.else 991.55Smrg_PQ= 1001.29Spooka.endif 1011.46Spooka 1021.46Spookarump_symren: __archivebuild 1031.46Spooka.if !defined(RUMP_SYMREN) 1041.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1051.46Spooka @false 1061.46Spooka.endif 1071.46Spooka 1081.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1091.46Spooka# build the arrrrchive. otherwise just rename symbols. 1101.24Spooka__archivebuild: .USE 1111.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1121.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1131.46Spooka @false 1141.46Spooka.endif 1151.46Spooka.if defined(RUMP_SYMREN) 1161.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1171.46Spooka.else 1181.24Spooka ${_MKTARGET_BUILD} 1191.24Spooka rm -f ${.TARGET} 1201.34Spooka ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 1211.46Spooka.endif 1221.46Spooka ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \ 1231.55Smrg $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1241.55Smrg {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \ 1251.24Spooka | sort | uniq > renametab.${.TARGET} 1261.37Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1271.46Spooka renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}} 1281.24Spooka rm -f renametab.${.TARGET} 1291.46Spooka.if !defined(RUMP_SYMREN) 1301.36Sperry ${AR} ${_ARRANFL} ${.TARGET} 1311.46Spooka.endif 1321.47Spooka 1331.53Spooka_BSD_IOCONF_MK_USER_=1 1341.53Spooka.include <bsd.ioconf.mk> 1351.47Spooka 1361.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 1371.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 138