Makefile.rump revision 1.32
1#	$NetBSD: Makefile.rump,v 1.32 2009/01/23 19:14:30 pooka Exp $
2#
3
4WARNS?=		4
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
15CPPFLAGS+=	-D_RUMPKERNEL
16CPPFLAGS+=	-D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR
17CPPFLAGS+=	-DMAXUSERS=32
18CPPFLAGS+=	-DDIAGNOSTIC
19CPPFLAGS+=	-DCOMPAT_50
20CPPFLAGS+=	-I${.CURDIR} -I.
21CPPFLAGS+=	-I${RUMPTOP}/../../common/include -I${RUMPTOP}/../arch
22CPPFLAGS+=	-I${RUMPTOP}/include
23CPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern/opt
24CPPFLAGS+=	-nostdinc -I${RUMPTOP}/..
25#CPPFLAGS+=	-DDEBUG
26
27RUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
28
29# workaround: evbppc is not a well-defined arch
30.if (${MACHINE} == "evbppc")
31CPPFLAGS+=	-DPPC_OEA
32.endif
33
34# If this file changes, we need a full rebuild
35DPSRCS+=	${RUMPTOP}/Makefile.rump
36
37#
38# Rename library symbols before use.  If a symbol does not already belong
39# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
40# avoids accidentally linking any kernel symbol against host platform
41# libraries.  The only non-renamed symbols are linkset delimiters and
42# the GOT, which are more a property of the compiler than the kernel.
43#
44# Some toolchains generate unresolved symbols which are supposed to be
45# satisfied by the toolchain itself when the program is linked.
46# Unfortunately, we do not know which of the symbols are generated by
47# the toolchain.  Worse, they vary from platform to platform and
48# toolchain to toolchain.  The good news, however, is that this will
49# be detected by a compile-time failure, so we can fairly easily manage
50# a quirktable here.
51.if ${MACHINE_CPU} == "mips"
52_SYMQUIRK='|_gp_disp'
53.elif ${MACHINE_CPU} == "hppa"
54_SYMQUIRK='|\$$\$$'
55.endif
56__archivebuild: .USE
57	${_MKTARGET_BUILD}
58	rm -f ${.TARGET}
59	${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
60	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
61	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
62	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
63	    | sort | uniq  > renametab.${.TARGET}
64	${OBJCOPY} --redefine-syms renametab.${.TARGET} ${.TARGET}
65	rm -f renametab.${.TARGET}
66	${RANLIB} ${.TARGET}
67