Makefile.rump revision 1.62
11.62Spooka# $NetBSD: Makefile.rump,v 1.62 2012/08/05 15:37:39 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.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.60SmattCPPFLAGS+= -DCOMPAT_50=1 281.38SpookaCPPFLAGS+= -DDEBUGPRINT 291.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 301.58SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include -isystem ${RUMPTOP}/../arch 311.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 321.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 331.58SpookaCPPFLAGS+= -nostdinc -isystem ${RUMPTOP}/.. 341.45SpookaLDFLAGS+= -T ${RUMPTOP}/ldscript.rump 351.62Spooka 361.62SpookaRUMP_DIAGNOSTIC?=yes 371.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 381.62SpookaCPPFLAGS+= -DDIAGNOSTIC 391.62Spooka.endif 401.62Spooka 411.62Spooka.ifdef RUMP_DEBUG 421.62SpookaCPPFLAGS+= -DDEBUG 431.62Spooka.endif 441.1Spooka 451.59Spooka.ifdef RUMP_LOCKDEBUG 461.59SpookaCPPFLAGS+= -DLOCKDEBUG 471.59Spooka.endif 481.59Spooka 491.42Spooka# kernel libs should not get linked against libc 501.43Spooka# XXX: actually, we would like to enable this but cannot, since it 511.43Spooka# also leaves out libgcc, it causes problems on some platforms. 521.43Spooka# revisit some day. 531.43Spooka#LDFLAGS+= -nodefaultlibs 541.42Spooka 551.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 561.39SpookaCPPFLAGS+= -D__NetBSD__ 571.39Spooka 581.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 591.11Spooka 601.13Spooka# workaround: evbppc is not a well-defined arch 611.13Spooka.if (${MACHINE} == "evbppc") 621.16SpookaCPPFLAGS+= -DPPC_OEA 631.13Spooka.endif 641.13Spooka 651.25Spooka# If this file changes, we need a full rebuild 661.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 671.24Spooka 681.24Spooka# 691.24Spooka# Rename library symbols before use. If a symbol does not already belong 701.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 711.24Spooka# avoids accidentally linking any kernel symbol against host platform 721.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 731.24Spooka# the GOT, which are more a property of the compiler than the kernel. 741.24Spooka# 751.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 761.29Spooka# satisfied by the toolchain itself when the program is linked. 771.29Spooka# Unfortunately, we do not know which of the symbols are generated by 781.29Spooka# the toolchain. Worse, they vary from platform to platform and 791.29Spooka# toolchain to toolchain. The good news, however, is that this will 801.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 811.29Spooka# a quirktable here. 821.46Spooka# 831.46Spooka# We also allow calling ourselves externally with e.g.: 841.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 851.46Spooka# 861.29Spooka.if ${MACHINE_CPU} == "mips" 871.29Spooka_SYMQUIRK='|_gp_disp' 881.29Spooka.elif ${MACHINE_CPU} == "hppa" 891.29Spooka_SYMQUIRK='|\$$\$$' 901.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 911.55Smrg_SYMQUIRK="|PF_funcs" 921.55Smrg.endif 931.55Smrg 941.55Smrg# 951.55Smrg# Prefix quirks. At least one toolchain generates global 961.55Smrg# symbols with prefixes which really need to remain as prefixes 971.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 981.55Smrg# way to know if you have the problem is if you get later 991.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1001.55Smrg# the 'X' part was added by the toolchain and will need to 1011.55Smrg# be mentioned here. 1021.55Smrg# 1031.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1041.55Smrg_PQ="\.?" 1051.55Smrg.else 1061.55Smrg_PQ= 1071.29Spooka.endif 1081.46Spooka 1091.46Spookarump_symren: __archivebuild 1101.46Spooka.if !defined(RUMP_SYMREN) 1111.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1121.46Spooka @false 1131.46Spooka.endif 1141.46Spooka 1151.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1161.46Spooka# build the arrrrchive. otherwise just rename symbols. 1171.24Spooka__archivebuild: .USE 1181.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1191.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1201.46Spooka @false 1211.46Spooka.endif 1221.46Spooka.if defined(RUMP_SYMREN) 1231.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1241.46Spooka.else 1251.24Spooka ${_MKTARGET_BUILD} 1261.24Spooka rm -f ${.TARGET} 1271.34Spooka ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 1281.46Spooka.endif 1291.46Spooka ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \ 1301.55Smrg $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1311.55Smrg {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \ 1321.24Spooka | sort | uniq > renametab.${.TARGET} 1331.37Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1341.46Spooka renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}} 1351.24Spooka rm -f renametab.${.TARGET} 1361.46Spooka.if !defined(RUMP_SYMREN) 1371.36Sperry ${AR} ${_ARRANFL} ${.TARGET} 1381.46Spooka.endif 1391.47Spooka 1401.53Spooka_BSD_IOCONF_MK_USER_=1 1411.53Spooka.include <bsd.ioconf.mk> 1421.47Spooka 1431.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 1441.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 145