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