Makefile.rump revision 1.108
11.108Spooka# $NetBSD: Makefile.rump,v 1.108 2015/04/23 10:52:18 pooka Exp $ 21.1Spooka# 31.1Spooka 41.95Spooka.if !defined(_RUMP_MK) 51.95Spooka_RUMP_MK= #defined 61.95Spooka 71.33SlukemWARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet 81.10SpookaNOLINT= # kernel code 91.1Spooka 101.20Spooka.include <bsd.own.mk> 111.20Spooka 121.90Spooka# Use NetBSD kernel ABI by default on x86 archs. Performance-related 131.90Spooka# compile-time options may override this at a later date. 141.92Spooka.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") 151.90Spooka_RUMP_NATIVEABI= yes 161.90Spooka.else 171.90Spooka_RUMP_NATIVEABI= no 181.18SpookaCPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 191.92SpookaCPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern 201.18Spooka.endif 211.18Spooka 221.99Salnsn# Define baseline cpu for mips ports, required for 231.99Salnsn# rumpcomp_sync_icache() hypercall. 241.99Salnsn.if !empty(MACHINE_ARCH:Mmips*) 251.99Salnsn.if !empty(MACHINE_ARCH:Mmips64*) 261.99SalnsnCPPFLAGS+= -DMIPS64=1 271.99Salnsn.else 281.99SalnsnCPPFLAGS+= -DMIPS1=1 291.99Salnsn.endif 301.99Salnsn.endif 311.99Salnsn 321.108SpookaRUMP_COMPAT?= 60 70 331.104SpookaCPPFLAGS+= ${RUMP_COMPAT:C/[1-9]0/-DCOMPAT_&/g} 341.104Spooka 351.66SpookaCPPFLAGS+= -DMAXUSERS=32 361.66Spooka 371.66SpookaCPPFLAGS+= -nostdinc 381.22SpookaCFLAGS+= -ffreestanding -fno-strict-aliasing 391.66Spooka 401.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 411.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 421.38SpookaCPPFLAGS+= -DDEBUGPRINT 431.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 441.65SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include 451.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 461.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 471.65Spooka 481.103SpookaSHLIB_MAJOR?= 0 491.103SpookaSHLIB_MINOR?= 0 501.103Spooka 511.65Spooka.ifdef NEED_ISYSTEM 521.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/../arch 531.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/.. 541.65Spooka.else 551.65SpookaCPPFLAGS+= -I${RUMPTOP}/../arch 561.65SpookaCPPFLAGS+= -I${RUMPTOP}/.. 571.65Spooka.endif 581.65Spooka 591.93SpookaRUMP_LDSCRIPT?= GNU 601.79Spooka.if ${RUMP_LDSCRIPT} != "no" 611.72Spooka# my ld or yours? 621.97Spooka.if ${RUMP_LDSCRIPT} == "sun" 631.72SpookaLDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 641.72SpookaSRCS+= linksyms_sun.c 651.74Spooka.PATH: ${RUMPTOP} 661.93Spooka.elif ${RUMP_LDSCRIPT} == "GNU" 671.93SpookaLDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump 681.96Spooka.elif ${RUMP_LDSCRIPT} == "ctor" 691.96SpookaCPPFLAGS+= -DRUMP_USE_CTOR 701.72Spooka.else 711.93Spooka.error Unknown ldscript ${RUMP_LDSCRIPT} 721.73Spooka.endif 731.79Spooka.endif 741.62Spooka 751.94Spooka.if defined(RUMP_CURLWP) 761.94Spooka.if ${RUMP_CURLWP} == "hypercall" 771.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL 781.94Spooka.elif ${RUMP_CURLWP} == "__thread" 791.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP___THREAD 801.94Spooka.elif ${RUMP_CURLWP} == "register" 811.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_REGISTER 821.94Spooka.else 831.94Spooka.error Unsupported curlwp scheme: ${RUMP_CURLWP} 841.94Spooka.endif 851.94Spooka.endif 861.94Spooka 871.62SpookaRUMP_DIAGNOSTIC?=yes 881.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 891.62SpookaCPPFLAGS+= -DDIAGNOSTIC 901.62Spooka.endif 911.62Spooka 921.62Spooka.ifdef RUMP_DEBUG 931.62SpookaCPPFLAGS+= -DDEBUG 941.62Spooka.endif 951.1Spooka 961.59Spooka.ifdef RUMP_LOCKDEBUG 971.59SpookaCPPFLAGS+= -DLOCKDEBUG 981.59Spooka.endif 991.59Spooka 1001.89SpookaRUMP_KTRACE?=yes 1011.89Spooka.if ${RUMP_KTRACE} == "yes" 1021.89SpookaCPPFLAGS+= -DKTRACE 1031.89Spooka.endif 1041.89Spooka 1051.42Spooka# kernel libs should not get linked against libc 1061.43Spooka# XXX: actually, we would like to enable this but cannot, since it 1071.43Spooka# also leaves out libgcc, it causes problems on some platforms. 1081.43Spooka# revisit some day. 1091.43Spooka#LDFLAGS+= -nodefaultlibs 1101.42Spooka 1111.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 1121.67Spooka# also, give those builds a way to undef the local compiler's macros 1131.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 1141.39Spooka 1151.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 1161.11Spooka 1171.13Spooka# workaround: evbppc is not a well-defined arch 1181.13Spooka.if (${MACHINE} == "evbppc") 1191.16SpookaCPPFLAGS+= -DPPC_OEA 1201.13Spooka.endif 1211.13Spooka 1221.25Spooka# If this file changes, we need a full rebuild 1231.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 1241.24Spooka 1251.24Spooka# 1261.69Spooka# Support for component-specific hypercalls 1271.69Spooka# 1281.69Spooka 1291.101Spooka# no easy way to get WARNS out of bsd.sys.mk 1301.102SpookaRUMPCOMP_USER_WARNFLAGS= -Wall -Wextra -Wno-unused-parameter 1311.102SpookaRUMPCOMP_USER_WARNFLAGS+= -Wstrict-prototypes -Wmissing-prototypes 1321.75Schristos 1331.91Spooka.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) 1341.75Schristos.if empty(DESTDIR) 1351.75SchristosDESTDIR=/ 1361.75Schristos.endif 1371.75SchristosBUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 1381.82SpookaRUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 1391.91Spooka.for rcusrc in ${RUMPCOMP_USER_SRCS:R} 1401.91Spooka${rcusrc}.d: ${rcusrc}.c 1411.69Spooka ${_MKTARGET_CREATE} 1421.91Spooka ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} 1431.69Spooka 1441.91Spooka${rcusrc}.o: ${rcusrc}.c 1451.69Spooka ${_MKTARGET_COMPILE} 1461.101Spooka ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} 1471.69Spooka 1481.91Spooka${rcusrc}.pico: ${rcusrc}.c 1491.69Spooka ${_MKTARGET_COMPILE} 1501.101Spooka ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} 1511.69Spooka 1521.91Spooka${rcusrc}.po: ${rcusrc}.c 1531.69Spooka ${_MKTARGET_COMPILE} 1541.101Spooka ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c} 1551.69Spooka 1561.91SpookaRUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po 1571.91SpookaSRCS+=${rcusrc}.c 1581.91Spooka.endfor 1591.69Spooka.endif 1601.69Spooka 1611.69Spooka# 1621.24Spooka# Rename library symbols before use. If a symbol does not already belong 1631.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1641.24Spooka# avoids accidentally linking any kernel symbol against host platform 1651.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1661.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1671.24Spooka# 1681.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1691.29Spooka# satisfied by the toolchain itself when the program is linked. 1701.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1711.29Spooka# the toolchain. Worse, they vary from platform to platform and 1721.29Spooka# toolchain to toolchain. The good news, however, is that this will 1731.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1741.29Spooka# a quirktable here. 1751.46Spooka# 1761.46Spooka# We also allow calling ourselves externally with e.g.: 1771.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1781.46Spooka# 1791.29Spooka.if ${MACHINE_CPU} == "mips" 1801.29Spooka_SYMQUIRK='|_gp_disp' 1811.29Spooka.elif ${MACHINE_CPU} == "hppa" 1821.29Spooka_SYMQUIRK='|\$$\$$' 1831.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1841.55Smrg_SYMQUIRK="|PF_funcs" 1851.55Smrg.endif 1861.55Smrg 1871.55Smrg# 1881.55Smrg# Prefix quirks. At least one toolchain generates global 1891.55Smrg# symbols with prefixes which really need to remain as prefixes 1901.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1911.55Smrg# way to know if you have the problem is if you get later 1921.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1931.55Smrg# the 'X' part was added by the toolchain and will need to 1941.55Smrg# be mentioned here. 1951.55Smrg# 1961.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1971.55Smrg_PQ="\.?" 1981.55Smrg.else 1991.55Smrg_PQ= 2001.29Spooka.endif 2011.46Spooka 2021.46Spookarump_symren: __archivebuild 2031.46Spooka.if !defined(RUMP_SYMREN) 2041.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 2051.46Spooka @false 2061.46Spooka.endif 2071.46Spooka 2081.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 2091.46Spooka# build the arrrrchive. otherwise just rename symbols. 2101.24Spooka__archivebuild: .USE 2111.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 2121.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 2131.46Spooka @false 2141.46Spooka.endif 2151.46Spooka.if defined(RUMP_SYMREN) 2161.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 2171.46Spooka.else 2181.24Spooka ${_MKTARGET_BUILD} 2191.24Spooka rm -f ${.TARGET} 2201.46Spooka.endif 2211.91Spooka for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ 2221.91Spooka ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ 2231.98Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \ 2241.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 2251.91Spooka | sort | uniq > renametab.$${renameobj}; \ 2261.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 2271.91Spooka renametab.$${renameobj} $${renameobj}; \ 2281.91Spooka rm -f renametab.$${renameobj}; \ 2291.69Spooka done 2301.46Spooka.if !defined(RUMP_SYMREN) 2311.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 2321.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 2331.46Spooka.endif 2341.47Spooka 2351.53Spooka_BSD_IOCONF_MK_USER_=1 2361.53Spooka.include <bsd.ioconf.mk> 2371.47Spooka 2381.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 2391.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 2401.95Spooka 2411.95Spooka.endif # _RUMP_MK 242