Makefile.rump revision 1.69
11.69Spooka# $NetBSD: Makefile.rump,v 1.69 2013/03/01 14:05:43 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.51Spooka# If RUMPKMOD is _not_ set (only on capable archs, from bsd.own.mk), 101.51Spooka# use rump ABI instead of the NetBSD kernel ABI. 111.31She.ifndef RUMPKMOD 121.18SpookaCPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 131.57SpookaCPPFLAGS+= -D_RUMPKERNEL 141.56Spooka.else 151.56SpookaCPPFLAGS+= -D_RUMP_NATIVE_ABI 161.18Spooka.endif 171.18Spooka 181.66SpookaCPPFLAGS+= -DMAXUSERS=32 191.66SpookaCPPFLAGS+= -DCOMPAT_50=1 201.66Spooka 211.66SpookaCPPFLAGS+= -nostdinc 221.22SpookaCFLAGS+= -ffreestanding -fno-strict-aliasing 231.66Spooka 241.50SpookaCWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 251.23SpookaCPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 261.38SpookaCPPFLAGS+= -DDEBUGPRINT 271.15SpookaCPPFLAGS+= -I${.CURDIR} -I. 281.65SpookaCPPFLAGS+= -I${RUMPTOP}/../../common/include 291.18SpookaCPPFLAGS+= -I${RUMPTOP}/include 301.21SpookaCPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 311.65Spooka 321.65Spooka.ifdef NEED_ISYSTEM 331.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/../arch 341.65SpookaCPPFLAGS+= -isystem ${RUMPTOP}/.. 351.65Spooka.else 361.65SpookaCPPFLAGS+= -I${RUMPTOP}/../arch 371.65SpookaCPPFLAGS+= -I${RUMPTOP}/.. 381.65Spooka.endif 391.65Spooka 401.68SpookaLDFLAGS+= -Wl,-T ${RUMPTOP}/ldscript.rump 411.62Spooka 421.62SpookaRUMP_DIAGNOSTIC?=yes 431.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 441.62SpookaCPPFLAGS+= -DDIAGNOSTIC 451.62Spooka.endif 461.62Spooka 471.62Spooka.ifdef RUMP_DEBUG 481.62SpookaCPPFLAGS+= -DDEBUG 491.62Spooka.endif 501.1Spooka 511.59Spooka.ifdef RUMP_LOCKDEBUG 521.59SpookaCPPFLAGS+= -DLOCKDEBUG 531.59Spooka.endif 541.59Spooka 551.42Spooka# kernel libs should not get linked against libc 561.43Spooka# XXX: actually, we would like to enable this but cannot, since it 571.43Spooka# also leaves out libgcc, it causes problems on some platforms. 581.43Spooka# revisit some day. 591.43Spooka#LDFLAGS+= -nodefaultlibs 601.42Spooka 611.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 621.67Spooka# also, give those builds a way to undef the local compiler's macros 631.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 641.39Spooka 651.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 661.11Spooka 671.13Spooka# workaround: evbppc is not a well-defined arch 681.13Spooka.if (${MACHINE} == "evbppc") 691.16SpookaCPPFLAGS+= -DPPC_OEA 701.13Spooka.endif 711.13Spooka 721.25Spooka# If this file changes, we need a full rebuild 731.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 741.24Spooka 751.24Spooka# 761.69Spooka# Support for component-specific hypercalls 771.69Spooka# 781.69Spooka 791.69Spooka.ifdef RUMPUSER_COMPONENT 801.69Spookarumpuser_component.d: rumpuser_component.c 811.69Spooka ${_MKTARGET_CREATE} 821.69Spooka ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPUSER_COMPONENT_CPPFLAGS} ${.CURDIR}/rumpuser_component.c 831.69Spooka 841.69Spookarumpuser_component.o: rumpuser_component.c 851.69Spooka ${_MKTARGET_COMPILE} 861.69Spooka ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPUSER_COMPONENT_CPPFLAGS} ${RUMPUSER_COMPONENT_CFLAGS} -c ${.CURDIR}/rumpuser_component.c 871.69Spooka 881.69Spookarumpuser_component.pico: rumpuser_component.c 891.69Spooka ${_MKTARGET_COMPILE} 901.69Spooka ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPUSER_COMPONENT_CPPFLAGS} ${RUMPUSER_COMPONENT_CFLAGS} -c ${.CURDIR}/rumpuser_component.c 911.69Spooka 921.69Spookarumpuser_component.po: rumpuser_component.c 931.69Spooka ${_MKTARGET_COMPILE} 941.69Spooka ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${BUILDRUMP_CFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPUSER_COMPONENT_CPPFLAGS} ${RUMPUSER_COMPONENT_CFLAGS} -c ${.CURDIR}/rumpuser_component.c 951.69Spooka 961.69SpookaRUMPUSER_OBJ=rumpuser_component.*o 971.69SpookaSRCS+=rumpuser_component.c 981.69Spooka.endif 991.69Spooka 1001.69Spooka# 1011.24Spooka# Rename library symbols before use. If a symbol does not already belong 1021.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1031.24Spooka# avoids accidentally linking any kernel symbol against host platform 1041.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1051.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1061.24Spooka# 1071.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1081.29Spooka# satisfied by the toolchain itself when the program is linked. 1091.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1101.29Spooka# the toolchain. Worse, they vary from platform to platform and 1111.29Spooka# toolchain to toolchain. The good news, however, is that this will 1121.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1131.29Spooka# a quirktable here. 1141.46Spooka# 1151.46Spooka# We also allow calling ourselves externally with e.g.: 1161.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1171.46Spooka# 1181.29Spooka.if ${MACHINE_CPU} == "mips" 1191.29Spooka_SYMQUIRK='|_gp_disp' 1201.29Spooka.elif ${MACHINE_CPU} == "hppa" 1211.29Spooka_SYMQUIRK='|\$$\$$' 1221.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1231.55Smrg_SYMQUIRK="|PF_funcs" 1241.55Smrg.endif 1251.55Smrg 1261.55Smrg# 1271.55Smrg# Prefix quirks. At least one toolchain generates global 1281.55Smrg# symbols with prefixes which really need to remain as prefixes 1291.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1301.55Smrg# way to know if you have the problem is if you get later 1311.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1321.55Smrg# the 'X' part was added by the toolchain and will need to 1331.55Smrg# be mentioned here. 1341.55Smrg# 1351.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1361.55Smrg_PQ="\.?" 1371.55Smrg.else 1381.55Smrg_PQ= 1391.29Spooka.endif 1401.46Spooka 1411.46Spookarump_symren: __archivebuild 1421.46Spooka.if !defined(RUMP_SYMREN) 1431.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1441.46Spooka @false 1451.46Spooka.endif 1461.46Spooka 1471.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1481.46Spooka# build the arrrrchive. otherwise just rename symbols. 1491.24Spooka__archivebuild: .USE 1501.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1511.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1521.46Spooka @false 1531.46Spooka.endif 1541.46Spooka.if defined(RUMP_SYMREN) 1551.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1561.46Spooka.else 1571.24Spooka ${_MKTARGET_BUILD} 1581.24Spooka rm -f ${.TARGET} 1591.46Spooka.endif 1601.69Spooka for obj in ${RUMP_SYMREN:U${.ALLSRC:N${RUMPUSER_OBJ}}}; do \ 1611.69Spooka ${NM} -go $${obj} | ${TOOL_AWK} ' \ 1621.69Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1631.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 1641.69Spooka | sort | uniq > renametab.$${obj}; \ 1651.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1661.69Spooka renametab.$${obj} $${obj}; \ 1671.69Spooka rm -f renametab.$${obj}; \ 1681.69Spooka done 1691.46Spooka.if !defined(RUMP_SYMREN) 1701.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 1711.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 1721.46Spooka.endif 1731.47Spooka 1741.53Spooka_BSD_IOCONF_MK_USER_=1 1751.53Spooka.include <bsd.ioconf.mk> 1761.47Spooka 1771.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 1781.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 179