Makefile.rump revision 1.60
1# $NetBSD: Makefile.rump,v 1.60 2011/02/01 01:15:51 matt Exp $ 2# 3 4WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet 5NOLINT= # kernel code 6 7.include <bsd.own.mk> 8 9# If RUMPKMOD is _not_ set (only on capable archs, from bsd.own.mk), 10# use rump ABI instead of the NetBSD kernel ABI. 11.ifndef RUMPKMOD 12CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 13CPPFLAGS+= -D_RUMPKERNEL 14.else 15CPPFLAGS+= -D_RUMP_NATIVE_ABI 16.endif 17 18CFLAGS+= -ffreestanding -fno-strict-aliasing 19CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 20CPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 21CPPFLAGS+= -DMAXUSERS=32 22CPPFLAGS+= -DDIAGNOSTIC 23CPPFLAGS+= -DCOMPAT_50=1 24CPPFLAGS+= -DDEBUGPRINT 25CPPFLAGS+= -I${.CURDIR} -I. 26CPPFLAGS+= -I${RUMPTOP}/../../common/include -isystem ${RUMPTOP}/../arch 27CPPFLAGS+= -I${RUMPTOP}/include 28CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 29CPPFLAGS+= -nostdinc -isystem ${RUMPTOP}/.. 30LDFLAGS+= -T ${RUMPTOP}/ldscript.rump 31#CPPFLAGS+= -DDEBUG 32 33.ifdef RUMP_LOCKDEBUG 34CPPFLAGS+= -DLOCKDEBUG 35.endif 36 37# kernel libs should not get linked against libc 38# XXX: actually, we would like to enable this but cannot, since it 39# also leaves out libgcc, it causes problems on some platforms. 40# revisit some day. 41#LDFLAGS+= -nodefaultlibs 42 43# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 44CPPFLAGS+= -D__NetBSD__ 45 46RUMPKERNEL= This is NetBSD and I am the rump. Good evening. 47 48# workaround: evbppc is not a well-defined arch 49.if (${MACHINE} == "evbppc") 50CPPFLAGS+= -DPPC_OEA 51.endif 52 53# If this file changes, we need a full rebuild 54DPSRCS+= ${RUMPTOP}/Makefile.rump 55 56# 57# Rename library symbols before use. If a symbol does not already belong 58# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 59# avoids accidentally linking any kernel symbol against host platform 60# libraries. The only non-renamed symbols are linkset delimiters and 61# the GOT, which are more a property of the compiler than the kernel. 62# 63# Some toolchains generate unresolved symbols which are supposed to be 64# satisfied by the toolchain itself when the program is linked. 65# Unfortunately, we do not know which of the symbols are generated by 66# the toolchain. Worse, they vary from platform to platform and 67# toolchain to toolchain. The good news, however, is that this will 68# be detected by a compile-time failure, so we can fairly easily manage 69# a quirktable here. 70# 71# We also allow calling ourselves externally with e.g.: 72# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 73# 74.if ${MACHINE_CPU} == "mips" 75_SYMQUIRK='|_gp_disp' 76.elif ${MACHINE_CPU} == "hppa" 77_SYMQUIRK='|\$$\$$' 78.elif ${MACHINE_ARCH} == "powerpc64" 79_SYMQUIRK="|PF_funcs" 80.endif 81 82# 83# Prefix quirks. At least one toolchain generates global 84# symbols with prefixes which really need to remain as prefixes 85# (i.e. the '.' on the front of some ppc64 globals). The 86# way to know if you have the problem is if you get later 87# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 88# the 'X' part was added by the toolchain and will need to 89# be mentioned here. 90# 91.if ${MACHINE_ARCH} == "powerpc64" 92_PQ="\.?" 93.else 94_PQ= 95.endif 96 97rump_symren: __archivebuild 98.if !defined(RUMP_SYMREN) 99 @echo "Must supply RUMP_SYMREN for target rump_symren" 100 @false 101.endif 102 103# if we are called from lib build (RUMP_SYMREN is not specified), 104# build the arrrrchive. otherwise just rename symbols. 105__archivebuild: .USE 106.if defined(RUMP_SYMREN) && defined(RUMPTOP) 107 @echo "ERROR: RUMP_SYMREN can only be used standalone" 108 @false 109.endif 110.if defined(RUMP_SYMREN) 111 ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 112.else 113 ${_MKTARGET_BUILD} 114 rm -f ${.TARGET} 115 ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 116.endif 117 ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \ 118 $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 119 {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \ 120 | sort | uniq > renametab.${.TARGET} 121 ${OBJCOPY} --preserve-dates --redefine-syms \ 122 renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}} 123 rm -f renametab.${.TARGET} 124.if !defined(RUMP_SYMREN) 125 ${AR} ${_ARRANFL} ${.TARGET} 126.endif 127 128_BSD_IOCONF_MK_USER_=1 129.include <bsd.ioconf.mk> 130 131.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 132.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 133