[BACK]Return to Makefile.rump CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / rump

File: [cvs.NetBSD.org] / src / sys / rump / Makefile.rump (download)

Revision 1.64, Tue Nov 13 19:12:42 2012 UTC (17 months ago) by pooka
Branch: MAIN
Changes since 1.63: +3 -1 lines

add some -U's for linux builds

#	$NetBSD: Makefile.rump,v 1.64 2012/11/13 19:12:42 pooka Exp $

WARNS?=		3	# XXX: src/sys won't compile with -Wsign-compare yet
NOLINT=		# kernel code

.include <bsd.own.mk>

# If RUMPKMOD is _not_ set (only on capable archs, from bsd.own.mk),
# use rump ABI instead of the NetBSD kernel ABI.
.ifndef RUMPKMOD

CFLAGS+=	-ffreestanding -fno-strict-aliasing
.if (defined(HAVE_GCC) && ${HAVE_GCC} >= 3) || defined(HAVE_LLVM)
CFLAGS+=	-Wsign-compare
CFLAGS+=	-Wno-pointer-sign -Wno-attributes
CFLAGS+=	-std=gnu99
CWARNFLAGS+=	-Wno-format-zero-length -Wno-pointer-sign
CPPFLAGS+=	-I${RUMPTOP}/../../common/include -isystem ${RUMPTOP}/../arch
CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern/opt
CPPFLAGS+=	-nostdinc -isystem ${RUMPTOP}/..
LDFLAGS+=	-T ${RUMPTOP}/ldscript.rump

.if ${RUMP_DIAGNOSTIC} == "yes"



# kernel libs should not get linked against libc
# XXX: actually, we would like to enable this but cannot, since it
# also leaves out libgcc, it causes problems on some platforms.
# revisit some day.
#LDFLAGS+=	-nodefaultlibs

# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
# aaand make sure cc doesn't source files any wild ideas
CPPFLAGS+=	-Ulinux -U__linux -U__linux__ -U__gnu_linux__

RUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.

# workaround: evbppc is not a well-defined arch
.if (${MACHINE} == "evbppc")

# If this file changes, we need a full rebuild
DPSRCS+=	${RUMPTOP}/Makefile.rump

# Rename library symbols before use.  If a symbol does not already belong
# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
# avoids accidentally linking any kernel symbol against host platform
# libraries.  The only non-renamed symbols are linkset delimiters and
# the GOT, which are more a property of the compiler than the kernel.
# Some toolchains generate unresolved symbols which are supposed to be
# satisfied by the toolchain itself when the program is linked.
# Unfortunately, we do not know which of the symbols are generated by
# the toolchain.  Worse, they vary from platform to platform and
# toolchain to toolchain.  The good news, however, is that this will
# be detected by a compile-time failure, so we can fairly easily manage
# a quirktable here.
# We also allow calling ourselves externally with e.g.:
# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj
.if ${MACHINE_CPU} == "mips"
.elif ${MACHINE_CPU} == "hppa"
.elif ${MACHINE_ARCH} == "powerpc64"

# Prefix quirks.  At least one toolchain generates global
# symbols with prefixes which really need to remain as prefixes
# (i.e. the '.' on the front of some ppc64 globals).  The
# way to know if you have the problem is if you get later
# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH';
# the 'X' part was added by the toolchain and will need to
# be mentioned here.
.if ${MACHINE_ARCH} == "powerpc64"

rump_symren: __archivebuild
.if !defined(RUMP_SYMREN)
	@echo "Must supply RUMP_SYMREN for target rump_symren"

# if we are called from lib build (RUMP_SYMREN is not specified),
# build the arrrrchive.  otherwise just rename symbols.
__archivebuild: .USE
.if defined(RUMP_SYMREN) && defined(RUMPTOP)
	@echo "ERROR: RUMP_SYMREN can only be used standalone"
.if defined(RUMP_SYMREN)
	${_MKMSG} " symbol rename " ${RUMP_SYMREN}
	rm -f ${.TARGET}
	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
	${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} '	\
	    $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
	      {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \
	    | sort | uniq  > renametab.${.TARGET}
	${OBJCOPY} --preserve-dates --redefine-syms \
	    renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}}
	rm -f renametab.${.TARGET}
.if !defined(RUMP_SYMREN)

.include <bsd.ioconf.mk>

.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"