Makefile.rump revision 1.91
11.91Spooka# $NetBSD: Makefile.rump,v 1.91 2014/03/13 01:34:06 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.90Spooka.if ${MACHINE_ARCH} == "i386" || \ 121.90Spooka ${MACHINE_ARCH} == "x86_64" 131.90Spooka_RUMP_NATIVEABI= yes 141.90SpookaCPPFLAGS+= -D_RUMP_NATIVE_ABI 151.90Spooka.else 161.90Spooka_RUMP_NATIVEABI= no 171.18SpookaCPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 181.57SpookaCPPFLAGS+= -D_RUMPKERNEL 191.18Spooka.endif 201.18Spooka 211.66SpookaCPPFLAGS+= -DMAXUSERS=32 221.84SpookaCPPFLAGS+= -DCOMPAT_50=1 -DCOMPAT_60=1 231.66Spooka 241.66SpookaCPPFLAGS+= -nostdinc 251.22SpookaCFLAGS+= -ffreestanding -fno-strict-aliasing 261.66Spooka 271.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 281.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 291.38SpookaCPPFLAGS+= -DDEBUGPRINT 301.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 311.65SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include 321.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 331.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 341.65Spooka 351.65Spooka.ifdef NEED_ISYSTEM 361.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/../arch 371.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/.. 381.65Spooka.else 391.65SpookaCPPFLAGS+= -I${RUMPTOP}/../arch 401.65SpookaCPPFLAGS+= -I${RUMPTOP}/.. 411.65Spooka.endif 421.65Spooka 431.79SpookaRUMP_LDSCRIPT?=yes 441.79Spooka.if ${RUMP_LDSCRIPT} != "no" 451.72Spooka# my ld or yours? 461.72Spooka.ifdef HAVE_SUN_LD 471.72SpookaLDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 481.72SpookaSRCS+= linksyms_sun.c 491.74Spooka.PATH: ${RUMPTOP} 501.72Spooka.else 511.85SjoergLDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump 521.73Spooka.endif 531.79Spooka.endif 541.62Spooka 551.62SpookaRUMP_DIAGNOSTIC?=yes 561.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 571.62SpookaCPPFLAGS+= -DDIAGNOSTIC 581.62Spooka.endif 591.62Spooka 601.62Spooka.ifdef RUMP_DEBUG 611.62SpookaCPPFLAGS+= -DDEBUG 621.62Spooka.endif 631.1Spooka 641.59Spooka.ifdef RUMP_LOCKDEBUG 651.59SpookaCPPFLAGS+= -DLOCKDEBUG 661.59Spooka.endif 671.59Spooka 681.89SpookaRUMP_KTRACE?=yes 691.89Spooka.if ${RUMP_KTRACE} == "yes" 701.89SpookaCPPFLAGS+= -DKTRACE 711.89Spooka.endif 721.89Spooka 731.42Spooka# kernel libs should not get linked against libc 741.43Spooka# XXX: actually, we would like to enable this but cannot, since it 751.43Spooka# also leaves out libgcc, it causes problems on some platforms. 761.43Spooka# revisit some day. 771.43Spooka#LDFLAGS+= -nodefaultlibs 781.42Spooka 791.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 801.67Spooka# also, give those builds a way to undef the local compiler's macros 811.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 821.39Spooka 831.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 841.11Spooka 851.13Spooka# workaround: evbppc is not a well-defined arch 861.13Spooka.if (${MACHINE} == "evbppc") 871.16SpookaCPPFLAGS+= -DPPC_OEA 881.13Spooka.endif 891.13Spooka 901.25Spooka# If this file changes, we need a full rebuild 911.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 921.24Spooka 931.24Spooka# 941.69Spooka# Support for component-specific hypercalls 951.69Spooka# 961.69Spooka 971.82Spooka# XXX: Warning flags are not in CWARNFLAGS. Manually add a few important ones. 981.75Schristos 991.91Spooka.ifdef RUMPCOMP_USER 1001.91Spooka.warning RUMPCOMP_USER is deprecated. Use RUMPCOMP_USER_SRCS 1011.91SpookaRUMPCOMP_USER_SRCS= rumpcomp_user.c 1021.91Spooka.endif 1031.91Spooka.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) 1041.75Schristos.if empty(DESTDIR) 1051.75SchristosDESTDIR=/ 1061.75Schristos.endif 1071.75SchristosBUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 1081.82SpookaRUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 1091.91Spooka.for rcusrc in ${RUMPCOMP_USER_SRCS:R} 1101.91Spooka${rcusrc}.d: ${rcusrc}.c 1111.69Spooka ${_MKTARGET_CREATE} 1121.91Spooka ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} 1131.69Spooka 1141.91Spooka${rcusrc}.o: ${rcusrc}.c 1151.69Spooka ${_MKTARGET_COMPILE} 1161.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} 1171.69Spooka 1181.91Spooka${rcusrc}.pico: ${rcusrc}.c 1191.69Spooka ${_MKTARGET_COMPILE} 1201.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} 1211.69Spooka 1221.91Spooka${rcusrc}.po: ${rcusrc}.c 1231.69Spooka ${_MKTARGET_COMPILE} 1241.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} 1251.69Spooka 1261.91SpookaRUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po 1271.91SpookaSRCS+=${rcusrc}.c 1281.91Spooka.endfor 1291.69Spooka.endif 1301.69Spooka 1311.69Spooka# 1321.24Spooka# Rename library symbols before use. If a symbol does not already belong 1331.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1341.24Spooka# avoids accidentally linking any kernel symbol against host platform 1351.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1361.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1371.24Spooka# 1381.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1391.29Spooka# satisfied by the toolchain itself when the program is linked. 1401.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1411.29Spooka# the toolchain. Worse, they vary from platform to platform and 1421.29Spooka# toolchain to toolchain. The good news, however, is that this will 1431.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1441.29Spooka# a quirktable here. 1451.46Spooka# 1461.46Spooka# We also allow calling ourselves externally with e.g.: 1471.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1481.46Spooka# 1491.29Spooka.if ${MACHINE_CPU} == "mips" 1501.29Spooka_SYMQUIRK='|_gp_disp' 1511.29Spooka.elif ${MACHINE_CPU} == "hppa" 1521.29Spooka_SYMQUIRK='|\$$\$$' 1531.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1541.55Smrg_SYMQUIRK="|PF_funcs" 1551.55Smrg.endif 1561.55Smrg 1571.55Smrg# 1581.55Smrg# Prefix quirks. At least one toolchain generates global 1591.55Smrg# symbols with prefixes which really need to remain as prefixes 1601.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1611.55Smrg# way to know if you have the problem is if you get later 1621.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1631.55Smrg# the 'X' part was added by the toolchain and will need to 1641.55Smrg# be mentioned here. 1651.55Smrg# 1661.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1671.55Smrg_PQ="\.?" 1681.55Smrg.else 1691.55Smrg_PQ= 1701.29Spooka.endif 1711.46Spooka 1721.46Spookarump_symren: __archivebuild 1731.46Spooka.if !defined(RUMP_SYMREN) 1741.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1751.46Spooka @false 1761.46Spooka.endif 1771.46Spooka 1781.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1791.46Spooka# build the arrrrchive. otherwise just rename symbols. 1801.24Spooka__archivebuild: .USE 1811.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1821.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1831.46Spooka @false 1841.46Spooka.endif 1851.46Spooka.if defined(RUMP_SYMREN) 1861.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1871.46Spooka.else 1881.24Spooka ${_MKTARGET_BUILD} 1891.24Spooka rm -f ${.TARGET} 1901.46Spooka.endif 1911.91Spooka for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ 1921.91Spooka ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ 1931.69Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1941.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 1951.91Spooka | sort | uniq > renametab.$${renameobj}; \ 1961.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1971.91Spooka renametab.$${renameobj} $${renameobj}; \ 1981.91Spooka rm -f renametab.$${renameobj}; \ 1991.69Spooka done 2001.46Spooka.if !defined(RUMP_SYMREN) 2011.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 2021.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 2031.46Spooka.endif 2041.47Spooka 2051.53Spooka_BSD_IOCONF_MK_USER_=1 2061.53Spooka.include <bsd.ioconf.mk> 2071.47Spooka 2081.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 2091.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 210