Makefile.rump revision 1.33
11.33Slukem#	$NetBSD: Makefile.rump,v 1.33 2009/02/12 13:23:17 lukem Exp $
21.1Spooka#
31.1Spooka
41.33SlukemWARNS?=		3	# XXX: src/sys won't compile with -Wsign-compare yet
51.10SpookaNOLINT=		# kernel code
61.1Spooka
71.20Spooka.include <bsd.own.mk>
81.20Spooka
91.18Spooka# use kernel ABI instead of rump ABI (needs md code)
101.31She.ifndef RUMPKMOD
111.18SpookaCPPFLAGS:=	-I${RUMPTOP}/include ${CPPFLAGS}
121.18Spooka.endif
131.18Spooka
141.22SpookaCFLAGS+=	-ffreestanding -fno-strict-aliasing
151.32SpookaCPPFLAGS+=	-D_RUMPKERNEL
161.23SpookaCPPFLAGS+=	-D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR
171.21SpookaCPPFLAGS+=	-DMAXUSERS=32
181.17SpookaCPPFLAGS+=	-DDIAGNOSTIC
191.32SpookaCPPFLAGS+=	-DCOMPAT_50
201.15SpookaCPPFLAGS+=	-I${.CURDIR} -I.
211.14SpookaCPPFLAGS+=	-I${RUMPTOP}/../../common/include -I${RUMPTOP}/../arch
221.18SpookaCPPFLAGS+=	-I${RUMPTOP}/include
231.21SpookaCPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern/opt
241.10SpookaCPPFLAGS+=	-nostdinc -I${RUMPTOP}/..
251.10Spooka#CPPFLAGS+=	-DDEBUG
261.1Spooka
271.11SpookaRUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
281.11Spooka
291.13Spooka# workaround: evbppc is not a well-defined arch
301.13Spooka.if (${MACHINE} == "evbppc")
311.16SpookaCPPFLAGS+=	-DPPC_OEA
321.13Spooka.endif
331.13Spooka
341.25Spooka# If this file changes, we need a full rebuild
351.25SpookaDPSRCS+=	${RUMPTOP}/Makefile.rump
361.24Spooka
371.24Spooka#
381.24Spooka# Rename library symbols before use.  If a symbol does not already belong
391.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
401.24Spooka# avoids accidentally linking any kernel symbol against host platform
411.24Spooka# libraries.  The only non-renamed symbols are linkset delimiters and
421.24Spooka# the GOT, which are more a property of the compiler than the kernel.
431.24Spooka#
441.29Spooka# Some toolchains generate unresolved symbols which are supposed to be
451.29Spooka# satisfied by the toolchain itself when the program is linked.
461.29Spooka# Unfortunately, we do not know which of the symbols are generated by
471.29Spooka# the toolchain.  Worse, they vary from platform to platform and
481.29Spooka# toolchain to toolchain.  The good news, however, is that this will
491.29Spooka# be detected by a compile-time failure, so we can fairly easily manage
501.29Spooka# a quirktable here.
511.29Spooka.if ${MACHINE_CPU} == "mips"
521.29Spooka_SYMQUIRK='|_gp_disp'
531.29Spooka.elif ${MACHINE_CPU} == "hppa"
541.29Spooka_SYMQUIRK='|\$$\$$'
551.29Spooka.endif
561.24Spooka__archivebuild: .USE
571.24Spooka	${_MKTARGET_BUILD}
581.24Spooka	rm -f ${.TARGET}
591.24Spooka	${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
601.24Spooka	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
611.29Spooka	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
621.24Spooka	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
631.24Spooka	    | sort | uniq  > renametab.${.TARGET}
641.24Spooka	${OBJCOPY} --redefine-syms renametab.${.TARGET} ${.TARGET}
651.24Spooka	rm -f renametab.${.TARGET}
661.24Spooka	${RANLIB} ${.TARGET}
67