Makefile.rump revision 1.44
1#	$NetBSD: Makefile.rump,v 1.44 2009/11/27 13:36:30 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# kernel libs should not get linked against libc
30# XXX: actually, we would like to enable this but cannot, since it
31# also leaves out libgcc, it causes problems on some platforms.
32# revisit some day.
33#LDFLAGS+=	-nodefaultlibs
34
35# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
36CPPFLAGS+=	-D__NetBSD__
37
38RUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
39
40# workaround: evbppc is not a well-defined arch
41.if (${MACHINE} == "evbppc")
42CPPFLAGS+=	-DPPC_OEA
43.endif
44
45# If this file changes, we need a full rebuild
46DPSRCS+=	${RUMPTOP}/Makefile.rump
47
48.ifdef RUMP_ISMODULE
49.PATH:		${RUMPTOP}/librump
50SRCS+=		rump_module.c
51.endif
52.ifdef RUMP_ISDOMAIN
53.PATH:		${RUMPTOP}/librump
54SRCS+=		rump_domain.c
55.endif
56
57#
58# Rename library symbols before use.  If a symbol does not already belong
59# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
60# avoids accidentally linking any kernel symbol against host platform
61# libraries.  The only non-renamed symbols are linkset delimiters and
62# the GOT, which are more a property of the compiler than the kernel.
63#
64# Some toolchains generate unresolved symbols which are supposed to be
65# satisfied by the toolchain itself when the program is linked.
66# Unfortunately, we do not know which of the symbols are generated by
67# the toolchain.  Worse, they vary from platform to platform and
68# toolchain to toolchain.  The good news, however, is that this will
69# be detected by a compile-time failure, so we can fairly easily manage
70# a quirktable here.
71.if ${MACHINE_CPU} == "mips"
72_SYMQUIRK='|_gp_disp'
73.elif ${MACHINE_CPU} == "hppa"
74_SYMQUIRK='|\$$\$$'
75.endif
76__archivebuild: .USE
77	${_MKTARGET_BUILD}
78	rm -f ${.TARGET}
79	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
80	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
81	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
82	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
83	    | sort | uniq  > renametab.${.TARGET}
84	${OBJCOPY} --preserve-dates --redefine-syms \
85	    renametab.${.TARGET} ${.TARGET}
86	rm -f renametab.${.TARGET}
87	${AR} ${_ARRANFL} ${.TARGET}
88
89.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
90.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"
91