Makefile.rump revision 1.96
11.96Spooka# $NetBSD: Makefile.rump,v 1.96 2014/04/23 23:25:45 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.90SpookaCPPFLAGS+= -D_RUMP_NATIVE_ABI 171.90Spooka.else 181.90Spooka_RUMP_NATIVEABI= no 191.18SpookaCPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 201.92SpookaCPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern 211.18Spooka.endif 221.18Spooka 231.66SpookaCPPFLAGS+= -DMAXUSERS=32 241.84SpookaCPPFLAGS+= -DCOMPAT_50=1 -DCOMPAT_60=1 251.66Spooka 261.66SpookaCPPFLAGS+= -nostdinc 271.22SpookaCFLAGS+= -ffreestanding -fno-strict-aliasing 281.66Spooka 291.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 301.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 311.38SpookaCPPFLAGS+= -DDEBUGPRINT 321.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 331.65SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include 341.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 351.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 361.65Spooka 371.65Spooka.ifdef NEED_ISYSTEM 381.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/../arch 391.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/.. 401.65Spooka.else 411.65SpookaCPPFLAGS+= -I${RUMPTOP}/../arch 421.65SpookaCPPFLAGS+= -I${RUMPTOP}/.. 431.65Spooka.endif 441.65Spooka 451.93SpookaRUMP_LDSCRIPT?= GNU 461.79Spooka.if ${RUMP_LDSCRIPT} != "no" 471.72Spooka# my ld or yours? 481.93Spooka.if ${RUMP_LDSCRIPT} == "sun" || defined(HAVE_SUN_LD) 491.72SpookaLDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 501.72SpookaSRCS+= linksyms_sun.c 511.74Spooka.PATH: ${RUMPTOP} 521.93Spooka.elif ${RUMP_LDSCRIPT} == "GNU" 531.93SpookaLDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump 541.96Spooka.elif ${RUMP_LDSCRIPT} == "ctor" 551.96SpookaCPPFLAGS+= -DRUMP_USE_CTOR 561.72Spooka.else 571.93Spooka.error Unknown ldscript ${RUMP_LDSCRIPT} 581.73Spooka.endif 591.79Spooka.endif 601.62Spooka 611.94Spooka.if defined(RUMP_CURLWP) 621.94Spooka.if ${RUMP_CURLWP} == "hypercall" 631.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL 641.94Spooka.elif ${RUMP_CURLWP} == "__thread" 651.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP___THREAD 661.94Spooka.elif ${RUMP_CURLWP} == "register" 671.94SpookaCPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_REGISTER 681.94Spooka.else 691.94Spooka.error Unsupported curlwp scheme: ${RUMP_CURLWP} 701.94Spooka.endif 711.94Spooka.endif 721.94Spooka 731.62SpookaRUMP_DIAGNOSTIC?=yes 741.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 751.62SpookaCPPFLAGS+= -DDIAGNOSTIC 761.62Spooka.endif 771.62Spooka 781.62Spooka.ifdef RUMP_DEBUG 791.62SpookaCPPFLAGS+= -DDEBUG 801.62Spooka.endif 811.1Spooka 821.59Spooka.ifdef RUMP_LOCKDEBUG 831.59SpookaCPPFLAGS+= -DLOCKDEBUG 841.59Spooka.endif 851.59Spooka 861.89SpookaRUMP_KTRACE?=yes 871.89Spooka.if ${RUMP_KTRACE} == "yes" 881.89SpookaCPPFLAGS+= -DKTRACE 891.89Spooka.endif 901.89Spooka 911.42Spooka# kernel libs should not get linked against libc 921.43Spooka# XXX: actually, we would like to enable this but cannot, since it 931.43Spooka# also leaves out libgcc, it causes problems on some platforms. 941.43Spooka# revisit some day. 951.43Spooka#LDFLAGS+= -nodefaultlibs 961.42Spooka 971.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 981.67Spooka# also, give those builds a way to undef the local compiler's macros 991.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 1001.39Spooka 1011.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 1021.11Spooka 1031.13Spooka# workaround: evbppc is not a well-defined arch 1041.13Spooka.if (${MACHINE} == "evbppc") 1051.16SpookaCPPFLAGS+= -DPPC_OEA 1061.13Spooka.endif 1071.13Spooka 1081.25Spooka# If this file changes, we need a full rebuild 1091.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 1101.24Spooka 1111.24Spooka# 1121.69Spooka# Support for component-specific hypercalls 1131.69Spooka# 1141.69Spooka 1151.82Spooka# XXX: Warning flags are not in CWARNFLAGS. Manually add a few important ones. 1161.75Schristos 1171.91Spooka.ifdef RUMPCOMP_USER 1181.91Spooka.warning RUMPCOMP_USER is deprecated. Use RUMPCOMP_USER_SRCS 1191.91SpookaRUMPCOMP_USER_SRCS= rumpcomp_user.c 1201.91Spooka.endif 1211.91Spooka.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) 1221.75Schristos.if empty(DESTDIR) 1231.75SchristosDESTDIR=/ 1241.75Schristos.endif 1251.75SchristosBUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 1261.82SpookaRUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 1271.91Spooka.for rcusrc in ${RUMPCOMP_USER_SRCS:R} 1281.91Spooka${rcusrc}.d: ${rcusrc}.c 1291.69Spooka ${_MKTARGET_CREATE} 1301.91Spooka ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} 1311.69Spooka 1321.91Spooka${rcusrc}.o: ${rcusrc}.c 1331.69Spooka ${_MKTARGET_COMPILE} 1341.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} 1351.69Spooka 1361.91Spooka${rcusrc}.pico: ${rcusrc}.c 1371.69Spooka ${_MKTARGET_COMPILE} 1381.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} 1391.69Spooka 1401.91Spooka${rcusrc}.po: ${rcusrc}.c 1411.69Spooka ${_MKTARGET_COMPILE} 1421.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} 1431.69Spooka 1441.91SpookaRUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po 1451.91SpookaSRCS+=${rcusrc}.c 1461.91Spooka.endfor 1471.69Spooka.endif 1481.69Spooka 1491.69Spooka# 1501.24Spooka# Rename library symbols before use. If a symbol does not already belong 1511.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1521.24Spooka# avoids accidentally linking any kernel symbol against host platform 1531.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1541.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1551.24Spooka# 1561.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1571.29Spooka# satisfied by the toolchain itself when the program is linked. 1581.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1591.29Spooka# the toolchain. Worse, they vary from platform to platform and 1601.29Spooka# toolchain to toolchain. The good news, however, is that this will 1611.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1621.29Spooka# a quirktable here. 1631.46Spooka# 1641.46Spooka# We also allow calling ourselves externally with e.g.: 1651.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1661.46Spooka# 1671.29Spooka.if ${MACHINE_CPU} == "mips" 1681.29Spooka_SYMQUIRK='|_gp_disp' 1691.29Spooka.elif ${MACHINE_CPU} == "hppa" 1701.29Spooka_SYMQUIRK='|\$$\$$' 1711.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1721.55Smrg_SYMQUIRK="|PF_funcs" 1731.55Smrg.endif 1741.55Smrg 1751.55Smrg# 1761.55Smrg# Prefix quirks. At least one toolchain generates global 1771.55Smrg# symbols with prefixes which really need to remain as prefixes 1781.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1791.55Smrg# way to know if you have the problem is if you get later 1801.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1811.55Smrg# the 'X' part was added by the toolchain and will need to 1821.55Smrg# be mentioned here. 1831.55Smrg# 1841.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1851.55Smrg_PQ="\.?" 1861.55Smrg.else 1871.55Smrg_PQ= 1881.29Spooka.endif 1891.46Spooka 1901.46Spookarump_symren: __archivebuild 1911.46Spooka.if !defined(RUMP_SYMREN) 1921.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1931.46Spooka @false 1941.46Spooka.endif 1951.46Spooka 1961.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1971.46Spooka# build the arrrrchive. otherwise just rename symbols. 1981.24Spooka__archivebuild: .USE 1991.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 2001.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 2011.46Spooka @false 2021.46Spooka.endif 2031.46Spooka.if defined(RUMP_SYMREN) 2041.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 2051.46Spooka.else 2061.24Spooka ${_MKTARGET_BUILD} 2071.24Spooka rm -f ${.TARGET} 2081.46Spooka.endif 2091.91Spooka for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ 2101.91Spooka ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ 2111.69Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 2121.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 2131.91Spooka | sort | uniq > renametab.$${renameobj}; \ 2141.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 2151.91Spooka renametab.$${renameobj} $${renameobj}; \ 2161.91Spooka rm -f renametab.$${renameobj}; \ 2171.69Spooka done 2181.46Spooka.if !defined(RUMP_SYMREN) 2191.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 2201.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 2211.46Spooka.endif 2221.47Spooka 2231.53Spooka_BSD_IOCONF_MK_USER_=1 2241.53Spooka.include <bsd.ioconf.mk> 2251.47Spooka 2261.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 2271.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 2281.95Spooka 2291.95Spooka.endif # _RUMP_MK 230