Makefile.rump revision 1.40
11.40Spooka#	$NetBSD: Makefile.rump,v 1.40 2009/09/08 20:24:08 pooka 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.40SpookaCWARNFLAGS+=	-Wno-format-zero-length
161.32SpookaCPPFLAGS+=	-D_RUMPKERNEL
171.23SpookaCPPFLAGS+=	-D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR
181.21SpookaCPPFLAGS+=	-DMAXUSERS=32
191.17SpookaCPPFLAGS+=	-DDIAGNOSTIC
201.32SpookaCPPFLAGS+=	-DCOMPAT_50
211.38SpookaCPPFLAGS+=	-DDEBUGPRINT
221.15SpookaCPPFLAGS+=	-I${.CURDIR} -I.
231.14SpookaCPPFLAGS+=	-I${RUMPTOP}/../../common/include -I${RUMPTOP}/../arch
241.18SpookaCPPFLAGS+=	-I${RUMPTOP}/include
251.21SpookaCPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern/opt
261.10SpookaCPPFLAGS+=	-nostdinc -I${RUMPTOP}/..
271.10Spooka#CPPFLAGS+=	-DDEBUG
281.1Spooka
291.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
301.39SpookaCPPFLAGS+=	-D__NetBSD__
311.39Spooka
321.11SpookaRUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
331.11Spooka
341.13Spooka# workaround: evbppc is not a well-defined arch
351.13Spooka.if (${MACHINE} == "evbppc")
361.16SpookaCPPFLAGS+=	-DPPC_OEA
371.13Spooka.endif
381.13Spooka
391.25Spooka# If this file changes, we need a full rebuild
401.25SpookaDPSRCS+=	${RUMPTOP}/Makefile.rump
411.24Spooka
421.24Spooka#
431.24Spooka# Rename library symbols before use.  If a symbol does not already belong
441.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
451.24Spooka# avoids accidentally linking any kernel symbol against host platform
461.24Spooka# libraries.  The only non-renamed symbols are linkset delimiters and
471.24Spooka# the GOT, which are more a property of the compiler than the kernel.
481.24Spooka#
491.29Spooka# Some toolchains generate unresolved symbols which are supposed to be
501.29Spooka# satisfied by the toolchain itself when the program is linked.
511.29Spooka# Unfortunately, we do not know which of the symbols are generated by
521.29Spooka# the toolchain.  Worse, they vary from platform to platform and
531.29Spooka# toolchain to toolchain.  The good news, however, is that this will
541.29Spooka# be detected by a compile-time failure, so we can fairly easily manage
551.29Spooka# a quirktable here.
561.29Spooka.if ${MACHINE_CPU} == "mips"
571.29Spooka_SYMQUIRK='|_gp_disp'
581.29Spooka.elif ${MACHINE_CPU} == "hppa"
591.29Spooka_SYMQUIRK='|\$$\$$'
601.29Spooka.endif
611.24Spooka__archivebuild: .USE
621.24Spooka	${_MKTARGET_BUILD}
631.24Spooka	rm -f ${.TARGET}
641.34Spooka	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
651.24Spooka	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
661.29Spooka	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
671.24Spooka	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
681.24Spooka	    | sort | uniq  > renametab.${.TARGET}
691.37Spooka	${OBJCOPY} --preserve-dates --redefine-syms \
701.37Spooka	    renametab.${.TARGET} ${.TARGET}
711.24Spooka	rm -f renametab.${.TARGET}
721.36Sperry	${AR} ${_ARRANFL} ${.TARGET}
73