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