Makefile.rump revision 1.53
1# $NetBSD: Makefile.rump,v 1.53 2010/03/21 06:55:44 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} 13.endif 14 15CFLAGS+= -ffreestanding -fno-strict-aliasing 16CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 17CPPFLAGS+= -D_RUMPKERNEL 18CPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 19CPPFLAGS+= -DMAXUSERS=32 20CPPFLAGS+= -DDIAGNOSTIC 21CPPFLAGS+= -DCOMPAT_50 22CPPFLAGS+= -DDEBUGPRINT 23CPPFLAGS+= -I${.CURDIR} -I. 24CPPFLAGS+= -I${RUMPTOP}/../../common/include -I${RUMPTOP}/../arch 25CPPFLAGS+= -I${RUMPTOP}/include 26CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 27CPPFLAGS+= -nostdinc -I${RUMPTOP}/.. 28LDFLAGS+= -T ${RUMPTOP}/ldscript.rump 29#CPPFLAGS+= -DDEBUG 30 31# kernel libs should not get linked against libc 32# XXX: actually, we would like to enable this but cannot, since it 33# also leaves out libgcc, it causes problems on some platforms. 34# revisit some day. 35#LDFLAGS+= -nodefaultlibs 36 37# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 38CPPFLAGS+= -D__NetBSD__ 39 40RUMPKERNEL= This is NetBSD and I am the rump. Good evening. 41 42# workaround: evbppc is not a well-defined arch 43.if (${MACHINE} == "evbppc") 44CPPFLAGS+= -DPPC_OEA 45.endif 46 47# If this file changes, we need a full rebuild 48DPSRCS+= ${RUMPTOP}/Makefile.rump 49 50# 51# Rename library symbols before use. If a symbol does not already belong 52# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 53# avoids accidentally linking any kernel symbol against host platform 54# libraries. The only non-renamed symbols are linkset delimiters and 55# the GOT, which are more a property of the compiler than the kernel. 56# 57# Some toolchains generate unresolved symbols which are supposed to be 58# satisfied by the toolchain itself when the program is linked. 59# Unfortunately, we do not know which of the symbols are generated by 60# the toolchain. Worse, they vary from platform to platform and 61# toolchain to toolchain. The good news, however, is that this will 62# be detected by a compile-time failure, so we can fairly easily manage 63# a quirktable here. 64# 65# We also allow calling ourselves externally with e.g.: 66# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 67# 68.if ${MACHINE_CPU} == "mips" 69_SYMQUIRK='|_gp_disp' 70.elif ${MACHINE_CPU} == "hppa" 71_SYMQUIRK='|\$$\$$' 72.endif 73 74rump_symren: __archivebuild 75.if !defined(RUMP_SYMREN) 76 @echo "Must supply RUMP_SYMREN for target rump_symren" 77 @false 78.endif 79 80# if we are called from lib build (RUMP_SYMREN is not specified), 81# build the arrrrchive. otherwise just rename symbols. 82__archivebuild: .USE 83.if defined(RUMP_SYMREN) && defined(RUMPTOP) 84 @echo "ERROR: RUMP_SYMREN can only be used standalone" 85 @false 86.endif 87.if defined(RUMP_SYMREN) 88 ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 89.else 90 ${_MKTARGET_BUILD} 91 rm -f ${.TARGET} 92 ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 93.endif 94 ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \ 95 $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 96 {printf "%s rumpns_%s\n", $$NF, $$NF}' \ 97 | sort | uniq > renametab.${.TARGET} 98 ${OBJCOPY} --preserve-dates --redefine-syms \ 99 renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}} 100 rm -f renametab.${.TARGET} 101.if !defined(RUMP_SYMREN) 102 ${AR} ${_ARRANFL} ${.TARGET} 103.endif 104 105_BSD_IOCONF_MK_USER_=1 106.include <bsd.ioconf.mk> 107 108.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 109.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 110