Makefile.rump revision 1.94
11.94Spooka# $NetBSD: Makefile.rump,v 1.94 2014/03/16 15:31:03 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.90Spooka# Use NetBSD kernel ABI by default on x86 archs. Performance-related 101.90Spooka# compile-time options may override this at a later date. 111.92Spooka.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") 121.90Spooka_RUMP_NATIVEABI= yes 131.90SpookaCPPFLAGS+= -D_RUMP_NATIVE_ABI 141.90Spooka.else 151.90Spooka_RUMP_NATIVEABI= no 161.18SpookaCPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 171.92SpookaCPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern 181.18Spooka.endif 191.18Spooka 201.66SpookaCPPFLAGS+= -DMAXUSERS=32 211.84SpookaCPPFLAGS+= -DCOMPAT_50=1 -DCOMPAT_60=1 221.66Spooka 231.66SpookaCPPFLAGS+= -nostdinc 241.22SpookaCFLAGS+= -ffreestanding -fno-strict-aliasing 251.66Spooka 261.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 271.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 281.38SpookaCPPFLAGS+= -DDEBUGPRINT 291.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 301.65SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include 311.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 321.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 331.65Spooka 341.65Spooka.ifdef NEED_ISYSTEM 351.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/../arch 361.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/.. 371.65Spooka.else 381.65SpookaCPPFLAGS+= -I${RUMPTOP}/../arch 391.65SpookaCPPFLAGS+= -I${RUMPTOP}/.. 401.65Spooka.endif 411.65Spooka 421.93SpookaRUMP_LDSCRIPT?= GNU 431.79Spooka.if ${RUMP_LDSCRIPT} != "no" 441.72Spooka# my ld or yours? 451.93Spooka.if ${RUMP_LDSCRIPT} == "sun" || defined(HAVE_SUN_LD) 461.72SpookaLDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 471.72SpookaSRCS+= linksyms_sun.c 481.74Spooka.PATH: ${RUMPTOP} 491.93Spooka.elif ${RUMP_LDSCRIPT} == "GNU" 501.93SpookaLDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump 511.72Spooka.else 521.93Spooka.error Unknown ldscript ${RUMP_LDSCRIPT} 531.73Spooka.endif 541.79Spooka.endif 551.62Spooka 561.94Spooka.if defined(RUMP_CURLWP) 571.94Spooka.if ${RUMP_CURLWP} == "hypercall" 581.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL 591.94Spooka.elif ${RUMP_CURLWP} == "__thread" 601.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP___THREAD 611.94Spooka.elif ${RUMP_CURLWP} == "register" 621.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_REGISTER 631.94Spooka.else 641.94Spooka.error Unsupported curlwp scheme: ${RUMP_CURLWP} 651.94Spooka.endif 661.94Spooka.endif 671.94Spooka 681.62SpookaRUMP_DIAGNOSTIC?=yes 691.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 701.62SpookaCPPFLAGS+= -DDIAGNOSTIC 711.62Spooka.endif 721.62Spooka 731.62Spooka.ifdef RUMP_DEBUG 741.62SpookaCPPFLAGS+= -DDEBUG 751.62Spooka.endif 761.1Spooka 771.59Spooka.ifdef RUMP_LOCKDEBUG 781.59SpookaCPPFLAGS+= -DLOCKDEBUG 791.59Spooka.endif 801.59Spooka 811.89SpookaRUMP_KTRACE?=yes 821.89Spooka.if ${RUMP_KTRACE} == "yes" 831.89SpookaCPPFLAGS+= -DKTRACE 841.89Spooka.endif 851.89Spooka 861.42Spooka# kernel libs should not get linked against libc 871.43Spooka# XXX: actually, we would like to enable this but cannot, since it 881.43Spooka# also leaves out libgcc, it causes problems on some platforms. 891.43Spooka# revisit some day. 901.43Spooka#LDFLAGS+= -nodefaultlibs 911.42Spooka 921.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 931.67Spooka# also, give those builds a way to undef the local compiler's macros 941.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 951.39Spooka 961.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 971.11Spooka 981.13Spooka# workaround: evbppc is not a well-defined arch 991.13Spooka.if (${MACHINE} == "evbppc") 1001.16SpookaCPPFLAGS+= -DPPC_OEA 1011.13Spooka.endif 1021.13Spooka 1031.25Spooka# If this file changes, we need a full rebuild 1041.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 1051.24Spooka 1061.24Spooka# 1071.69Spooka# Support for component-specific hypercalls 1081.69Spooka# 1091.69Spooka 1101.82Spooka# XXX: Warning flags are not in CWARNFLAGS. Manually add a few important ones. 1111.75Schristos 1121.91Spooka.ifdef RUMPCOMP_USER 1131.91Spooka.warning RUMPCOMP_USER is deprecated. Use RUMPCOMP_USER_SRCS 1141.91SpookaRUMPCOMP_USER_SRCS= rumpcomp_user.c 1151.91Spooka.endif 1161.91Spooka.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) 1171.75Schristos.if empty(DESTDIR) 1181.75SchristosDESTDIR=/ 1191.75Schristos.endif 1201.75SchristosBUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 1211.82SpookaRUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 1221.91Spooka.for rcusrc in ${RUMPCOMP_USER_SRCS:R} 1231.91Spooka${rcusrc}.d: ${rcusrc}.c 1241.69Spooka ${_MKTARGET_CREATE} 1251.91Spooka ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} 1261.69Spooka 1271.91Spooka${rcusrc}.o: ${rcusrc}.c 1281.69Spooka ${_MKTARGET_COMPILE} 1291.91Spooka ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} -Wall -Wmissing-prototypes ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} 1301.69Spooka 1311.91Spooka${rcusrc}.pico: ${rcusrc}.c 1321.69Spooka ${_MKTARGET_COMPILE} 1331.91Spooka ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} -Wall -Wmissing-prototypes ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} 1341.69Spooka 1351.91Spooka${rcusrc}.po: ${rcusrc}.c 1361.69Spooka ${_MKTARGET_COMPILE} 1371.91Spooka ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} -Wall -Wmissing-prototypes ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} 1381.69Spooka 1391.91SpookaRUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po 1401.91SpookaSRCS+=${rcusrc}.c 1411.91Spooka.endfor 1421.69Spooka.endif 1431.69Spooka 1441.69Spooka# 1451.24Spooka# Rename library symbols before use. If a symbol does not already belong 1461.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1471.24Spooka# avoids accidentally linking any kernel symbol against host platform 1481.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1491.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1501.24Spooka# 1511.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1521.29Spooka# satisfied by the toolchain itself when the program is linked. 1531.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1541.29Spooka# the toolchain. Worse, they vary from platform to platform and 1551.29Spooka# toolchain to toolchain. The good news, however, is that this will 1561.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1571.29Spooka# a quirktable here. 1581.46Spooka# 1591.46Spooka# We also allow calling ourselves externally with e.g.: 1601.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1611.46Spooka# 1621.29Spooka.if ${MACHINE_CPU} == "mips" 1631.29Spooka_SYMQUIRK='|_gp_disp' 1641.29Spooka.elif ${MACHINE_CPU} == "hppa" 1651.29Spooka_SYMQUIRK='|\$$\$$' 1661.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1671.55Smrg_SYMQUIRK="|PF_funcs" 1681.55Smrg.endif 1691.55Smrg 1701.55Smrg# 1711.55Smrg# Prefix quirks. At least one toolchain generates global 1721.55Smrg# symbols with prefixes which really need to remain as prefixes 1731.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1741.55Smrg# way to know if you have the problem is if you get later 1751.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1761.55Smrg# the 'X' part was added by the toolchain and will need to 1771.55Smrg# be mentioned here. 1781.55Smrg# 1791.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1801.55Smrg_PQ="\.?" 1811.55Smrg.else 1821.55Smrg_PQ= 1831.29Spooka.endif 1841.46Spooka 1851.46Spookarump_symren: __archivebuild 1861.46Spooka.if !defined(RUMP_SYMREN) 1871.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1881.46Spooka @false 1891.46Spooka.endif 1901.46Spooka 1911.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1921.46Spooka# build the arrrrchive. otherwise just rename symbols. 1931.24Spooka__archivebuild: .USE 1941.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1951.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1961.46Spooka @false 1971.46Spooka.endif 1981.46Spooka.if defined(RUMP_SYMREN) 1991.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 2001.46Spooka.else 2011.24Spooka ${_MKTARGET_BUILD} 2021.24Spooka rm -f ${.TARGET} 2031.46Spooka.endif 2041.91Spooka for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ 2051.91Spooka ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ 2061.69Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 2071.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 2081.91Spooka | sort | uniq > renametab.$${renameobj}; \ 2091.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 2101.91Spooka renametab.$${renameobj} $${renameobj}; \ 2111.91Spooka rm -f renametab.$${renameobj}; \ 2121.69Spooka done 2131.46Spooka.if !defined(RUMP_SYMREN) 2141.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 2151.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 2161.46Spooka.endif 2171.47Spooka 2181.53Spooka_BSD_IOCONF_MK_USER_=1 2191.53Spooka.include <bsd.ioconf.mk> 2201.47Spooka 2211.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 2221.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 223