Makefile.rump revision 1.40
1#	$NetBSD: Makefile.rump,v 1.40 2009/09/08 20:24:08 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}/..
27#CPPFLAGS+=	-DDEBUG
28
29# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
30CPPFLAGS+=	-D__NetBSD__
31
32RUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
33
34# workaround: evbppc is not a well-defined arch
35.if (${MACHINE} == "evbppc")
36CPPFLAGS+=	-DPPC_OEA
37.endif
38
39# If this file changes, we need a full rebuild
40DPSRCS+=	${RUMPTOP}/Makefile.rump
41
42#
43# Rename library symbols before use.  If a symbol does not already belong
44# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
45# avoids accidentally linking any kernel symbol against host platform
46# libraries.  The only non-renamed symbols are linkset delimiters and
47# the GOT, which are more a property of the compiler than the kernel.
48#
49# Some toolchains generate unresolved symbols which are supposed to be
50# satisfied by the toolchain itself when the program is linked.
51# Unfortunately, we do not know which of the symbols are generated by
52# the toolchain.  Worse, they vary from platform to platform and
53# toolchain to toolchain.  The good news, however, is that this will
54# be detected by a compile-time failure, so we can fairly easily manage
55# a quirktable here.
56.if ${MACHINE_CPU} == "mips"
57_SYMQUIRK='|_gp_disp'
58.elif ${MACHINE_CPU} == "hppa"
59_SYMQUIRK='|\$$\$$'
60.endif
61__archivebuild: .USE
62	${_MKTARGET_BUILD}
63	rm -f ${.TARGET}
64	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
65	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
66	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
67	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
68	    | sort | uniq  > renametab.${.TARGET}
69	${OBJCOPY} --preserve-dates --redefine-syms \
70	    renametab.${.TARGET} ${.TARGET}
71	rm -f renametab.${.TARGET}
72	${AR} ${_ARRANFL} ${.TARGET}
73