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