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