Makefile.rump revision 1.92
11.92Spooka# $NetBSD: Makefile.rump,v 1.92 2014/03/15 15:15:26 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.79SpookaRUMP_LDSCRIPT?=yes 431.79Spooka.if ${RUMP_LDSCRIPT} != "no" 441.72Spooka# my ld or yours? 451.72Spooka.ifdef HAVE_SUN_LD 461.72SpookaLDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 471.72SpookaSRCS+= linksyms_sun.c 481.74Spooka.PATH: ${RUMPTOP} 491.72Spooka.else 501.85SjoergLDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump 511.73Spooka.endif 521.79Spooka.endif 531.62Spooka 541.62SpookaRUMP_DIAGNOSTIC?=yes 551.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 561.62SpookaCPPFLAGS+= -DDIAGNOSTIC 571.62Spooka.endif 581.62Spooka 591.62Spooka.ifdef RUMP_DEBUG 601.62SpookaCPPFLAGS+= -DDEBUG 611.62Spooka.endif 621.1Spooka 631.59Spooka.ifdef RUMP_LOCKDEBUG 641.59SpookaCPPFLAGS+= -DLOCKDEBUG 651.59Spooka.endif 661.59Spooka 671.89SpookaRUMP_KTRACE?=yes 681.89Spooka.if ${RUMP_KTRACE} == "yes" 691.89SpookaCPPFLAGS+= -DKTRACE 701.89Spooka.endif 711.89Spooka 721.42Spooka# kernel libs should not get linked against libc 731.43Spooka# XXX: actually, we would like to enable this but cannot, since it 741.43Spooka# also leaves out libgcc, it causes problems on some platforms. 751.43Spooka# revisit some day. 761.43Spooka#LDFLAGS+= -nodefaultlibs 771.42Spooka 781.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 791.67Spooka# also, give those builds a way to undef the local compiler's macros 801.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 811.39Spooka 821.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 831.11Spooka 841.13Spooka# workaround: evbppc is not a well-defined arch 851.13Spooka.if (${MACHINE} == "evbppc") 861.16SpookaCPPFLAGS+= -DPPC_OEA 871.13Spooka.endif 881.13Spooka 891.25Spooka# If this file changes, we need a full rebuild 901.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 911.24Spooka 921.24Spooka# 931.69Spooka# Support for component-specific hypercalls 941.69Spooka# 951.69Spooka 961.82Spooka# XXX: Warning flags are not in CWARNFLAGS. Manually add a few important ones. 971.75Schristos 981.91Spooka.ifdef RUMPCOMP_USER 991.91Spooka.warning RUMPCOMP_USER is deprecated. Use RUMPCOMP_USER_SRCS 1001.91SpookaRUMPCOMP_USER_SRCS= rumpcomp_user.c 1011.91Spooka.endif 1021.91Spooka.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) 1031.75Schristos.if empty(DESTDIR) 1041.75SchristosDESTDIR=/ 1051.75Schristos.endif 1061.75SchristosBUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 1071.82SpookaRUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 1081.91Spooka.for rcusrc in ${RUMPCOMP_USER_SRCS:R} 1091.91Spooka${rcusrc}.d: ${rcusrc}.c 1101.69Spooka ${_MKTARGET_CREATE} 1111.91Spooka ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} 1121.69Spooka 1131.91Spooka${rcusrc}.o: ${rcusrc}.c 1141.69Spooka ${_MKTARGET_COMPILE} 1151.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} 1161.69Spooka 1171.91Spooka${rcusrc}.pico: ${rcusrc}.c 1181.69Spooka ${_MKTARGET_COMPILE} 1191.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} 1201.69Spooka 1211.91Spooka${rcusrc}.po: ${rcusrc}.c 1221.69Spooka ${_MKTARGET_COMPILE} 1231.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} 1241.69Spooka 1251.91SpookaRUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po 1261.91SpookaSRCS+=${rcusrc}.c 1271.91Spooka.endfor 1281.69Spooka.endif 1291.69Spooka 1301.69Spooka# 1311.24Spooka# Rename library symbols before use. If a symbol does not already belong 1321.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1331.24Spooka# avoids accidentally linking any kernel symbol against host platform 1341.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1351.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1361.24Spooka# 1371.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1381.29Spooka# satisfied by the toolchain itself when the program is linked. 1391.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1401.29Spooka# the toolchain. Worse, they vary from platform to platform and 1411.29Spooka# toolchain to toolchain. The good news, however, is that this will 1421.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1431.29Spooka# a quirktable here. 1441.46Spooka# 1451.46Spooka# We also allow calling ourselves externally with e.g.: 1461.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1471.46Spooka# 1481.29Spooka.if ${MACHINE_CPU} == "mips" 1491.29Spooka_SYMQUIRK='|_gp_disp' 1501.29Spooka.elif ${MACHINE_CPU} == "hppa" 1511.29Spooka_SYMQUIRK='|\$$\$$' 1521.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1531.55Smrg_SYMQUIRK="|PF_funcs" 1541.55Smrg.endif 1551.55Smrg 1561.55Smrg# 1571.55Smrg# Prefix quirks. At least one toolchain generates global 1581.55Smrg# symbols with prefixes which really need to remain as prefixes 1591.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1601.55Smrg# way to know if you have the problem is if you get later 1611.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1621.55Smrg# the 'X' part was added by the toolchain and will need to 1631.55Smrg# be mentioned here. 1641.55Smrg# 1651.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1661.55Smrg_PQ="\.?" 1671.55Smrg.else 1681.55Smrg_PQ= 1691.29Spooka.endif 1701.46Spooka 1711.46Spookarump_symren: __archivebuild 1721.46Spooka.if !defined(RUMP_SYMREN) 1731.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1741.46Spooka @false 1751.46Spooka.endif 1761.46Spooka 1771.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1781.46Spooka# build the arrrrchive. otherwise just rename symbols. 1791.24Spooka__archivebuild: .USE 1801.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1811.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1821.46Spooka @false 1831.46Spooka.endif 1841.46Spooka.if defined(RUMP_SYMREN) 1851.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1861.46Spooka.else 1871.24Spooka ${_MKTARGET_BUILD} 1881.24Spooka rm -f ${.TARGET} 1891.46Spooka.endif 1901.91Spooka for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ 1911.91Spooka ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ 1921.69Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1931.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 1941.91Spooka | sort | uniq > renametab.$${renameobj}; \ 1951.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1961.91Spooka renametab.$${renameobj} $${renameobj}; \ 1971.91Spooka rm -f renametab.$${renameobj}; \ 1981.69Spooka done 1991.46Spooka.if !defined(RUMP_SYMREN) 2001.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 2011.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 2021.46Spooka.endif 2031.47Spooka 2041.53Spooka_BSD_IOCONF_MK_USER_=1 2051.53Spooka.include <bsd.ioconf.mk> 2061.47Spooka 2071.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 2081.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 209