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