Makefile.rump revision 1.75
11.75Schristos# $NetBSD: Makefile.rump,v 1.75 2013/03/16 21:38:21 christos 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.72Spooka# my ld or yours? 411.72Spooka.ifdef HAVE_SUN_LD 421.72SpookaLDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 431.72SpookaSRCS+= linksyms_sun.c 441.74Spooka.PATH: ${RUMPTOP} 451.72Spooka.else 461.68SpookaLDFLAGS+= -Wl,-T ${RUMPTOP}/ldscript.rump 471.73Spooka.endif 481.62Spooka 491.62SpookaRUMP_DIAGNOSTIC?=yes 501.62Spooka.if ${RUMP_DIAGNOSTIC} == "yes" 511.62SpookaCPPFLAGS+= -DDIAGNOSTIC 521.62Spooka.endif 531.62Spooka 541.62Spooka.ifdef RUMP_DEBUG 551.62SpookaCPPFLAGS+= -DDEBUG 561.62Spooka.endif 571.1Spooka 581.59Spooka.ifdef RUMP_LOCKDEBUG 591.59SpookaCPPFLAGS+= -DLOCKDEBUG 601.59Spooka.endif 611.59Spooka 621.42Spooka# kernel libs should not get linked against libc 631.43Spooka# XXX: actually, we would like to enable this but cannot, since it 641.43Spooka# also leaves out libgcc, it causes problems on some platforms. 651.43Spooka# revisit some day. 661.43Spooka#LDFLAGS+= -nodefaultlibs 671.42Spooka 681.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 691.67Spooka# also, give those builds a way to undef the local compiler's macros 701.67SpookaCPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 711.39Spooka 721.11SpookaRUMPKERNEL= This is NetBSD and I am the rump. Good evening. 731.11Spooka 741.13Spooka# workaround: evbppc is not a well-defined arch 751.13Spooka.if (${MACHINE} == "evbppc") 761.16SpookaCPPFLAGS+= -DPPC_OEA 771.13Spooka.endif 781.13Spooka 791.25Spooka# If this file changes, we need a full rebuild 801.25SpookaDPSRCS+= ${RUMPTOP}/Makefile.rump 811.24Spooka 821.24Spooka# 831.69Spooka# Support for component-specific hypercalls 841.69Spooka# 851.69Spooka 861.75Schristos 871.70Spooka.ifdef RUMPCOMP_USER 881.75Schristos.if empty(DESTDIR) 891.75SchristosDESTDIR=/ 901.75Schristos.endif 911.75SchristosBUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 921.70Spookarumpcomp_user.d: rumpcomp_user.c 931.69Spooka ${_MKTARGET_CREATE} 941.75Schristos ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:M*.c} 951.69Spooka 961.70Spookarumpcomp_user.o: rumpcomp_user.c 971.69Spooka ${_MKTARGET_COMPILE} 981.75Schristos ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:M*.c} 991.69Spooka 1001.70Spookarumpcomp_user.pico: rumpcomp_user.c 1011.69Spooka ${_MKTARGET_COMPILE} 1021.75Schristos ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:M*.c} 1031.69Spooka 1041.70Spookarumpcomp_user.po: rumpcomp_user.c 1051.69Spooka ${_MKTARGET_COMPILE} 1061.75Schristos ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:M*.c} 1071.69Spooka 1081.70SpookaRUMPCOMP_USEROBJ=rumpcomp_user.*o 1091.70SpookaSRCS+=rumpcomp_user.c 1101.69Spooka.endif 1111.69Spooka 1121.69Spooka# 1131.24Spooka# Rename library symbols before use. If a symbol does not already belong 1141.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 1151.24Spooka# avoids accidentally linking any kernel symbol against host platform 1161.24Spooka# libraries. The only non-renamed symbols are linkset delimiters and 1171.24Spooka# the GOT, which are more a property of the compiler than the kernel. 1181.24Spooka# 1191.29Spooka# Some toolchains generate unresolved symbols which are supposed to be 1201.29Spooka# satisfied by the toolchain itself when the program is linked. 1211.29Spooka# Unfortunately, we do not know which of the symbols are generated by 1221.29Spooka# the toolchain. Worse, they vary from platform to platform and 1231.29Spooka# toolchain to toolchain. The good news, however, is that this will 1241.29Spooka# be detected by a compile-time failure, so we can fairly easily manage 1251.29Spooka# a quirktable here. 1261.46Spooka# 1271.46Spooka# We also allow calling ourselves externally with e.g.: 1281.46Spooka# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 1291.46Spooka# 1301.29Spooka.if ${MACHINE_CPU} == "mips" 1311.29Spooka_SYMQUIRK='|_gp_disp' 1321.29Spooka.elif ${MACHINE_CPU} == "hppa" 1331.29Spooka_SYMQUIRK='|\$$\$$' 1341.54Smrg.elif ${MACHINE_ARCH} == "powerpc64" 1351.55Smrg_SYMQUIRK="|PF_funcs" 1361.55Smrg.endif 1371.55Smrg 1381.55Smrg# 1391.55Smrg# Prefix quirks. At least one toolchain generates global 1401.55Smrg# symbols with prefixes which really need to remain as prefixes 1411.55Smrg# (i.e. the '.' on the front of some ppc64 globals). The 1421.55Smrg# way to know if you have the problem is if you get later 1431.55Smrg# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 1441.55Smrg# the 'X' part was added by the toolchain and will need to 1451.55Smrg# be mentioned here. 1461.55Smrg# 1471.55Smrg.if ${MACHINE_ARCH} == "powerpc64" 1481.55Smrg_PQ="\.?" 1491.55Smrg.else 1501.55Smrg_PQ= 1511.29Spooka.endif 1521.46Spooka 1531.46Spookarump_symren: __archivebuild 1541.46Spooka.if !defined(RUMP_SYMREN) 1551.46Spooka @echo "Must supply RUMP_SYMREN for target rump_symren" 1561.46Spooka @false 1571.46Spooka.endif 1581.46Spooka 1591.46Spooka# if we are called from lib build (RUMP_SYMREN is not specified), 1601.46Spooka# build the arrrrchive. otherwise just rename symbols. 1611.24Spooka__archivebuild: .USE 1621.46Spooka.if defined(RUMP_SYMREN) && defined(RUMPTOP) 1631.46Spooka @echo "ERROR: RUMP_SYMREN can only be used standalone" 1641.46Spooka @false 1651.46Spooka.endif 1661.46Spooka.if defined(RUMP_SYMREN) 1671.46Spooka ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 1681.46Spooka.else 1691.24Spooka ${_MKTARGET_BUILD} 1701.24Spooka rm -f ${.TARGET} 1711.46Spooka.endif 1721.70Spooka for obj in ${RUMP_SYMREN:U${.ALLSRC:N${RUMPCOMP_USEROBJ}}}; do \ 1731.69Spooka ${NM} -go $${obj} | ${TOOL_AWK} ' \ 1741.69Spooka $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 1751.69Spooka {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 1761.69Spooka | sort | uniq > renametab.$${obj}; \ 1771.69Spooka ${OBJCOPY} --preserve-dates --redefine-syms \ 1781.69Spooka renametab.$${obj} $${obj}; \ 1791.69Spooka rm -f renametab.$${obj}; \ 1801.69Spooka done 1811.46Spooka.if !defined(RUMP_SYMREN) 1821.69Spooka ${AR} ${_ARFL} ${.TARGET} \ 1831.69Spooka `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 1841.46Spooka.endif 1851.47Spooka 1861.53Spooka_BSD_IOCONF_MK_USER_=1 1871.53Spooka.include <bsd.ioconf.mk> 1881.47Spooka 1891.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 1901.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 191