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