Makefile.rump revision 1.39
11.39Spooka#	$NetBSD: Makefile.rump,v 1.39 2009/09/07 13:02:37 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.32SpookaCPPFLAGS+=	-D_RUMPKERNEL
161.23SpookaCPPFLAGS+=	-D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR
171.21SpookaCPPFLAGS+=	-DMAXUSERS=32
181.17SpookaCPPFLAGS+=	-DDIAGNOSTIC
191.32SpookaCPPFLAGS+=	-DCOMPAT_50
201.38SpookaCPPFLAGS+=	-DDEBUGPRINT
211.15SpookaCPPFLAGS+=	-I${.CURDIR} -I.
221.14SpookaCPPFLAGS+=	-I${RUMPTOP}/../../common/include -I${RUMPTOP}/../arch
231.18SpookaCPPFLAGS+=	-I${RUMPTOP}/include
241.21SpookaCPPFLAGS+=	-I${RUMPTOP}/librump/rumpkern/opt
251.10SpookaCPPFLAGS+=	-nostdinc -I${RUMPTOP}/..
261.10Spooka#CPPFLAGS+=	-DDEBUG
271.1Spooka
281.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
291.39SpookaCPPFLAGS+=	-D__NetBSD__
301.39Spooka
311.11SpookaRUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
321.11Spooka
331.13Spooka# workaround: evbppc is not a well-defined arch
341.13Spooka.if (${MACHINE} == "evbppc")
351.16SpookaCPPFLAGS+=	-DPPC_OEA
361.13Spooka.endif
371.13Spooka
381.25Spooka# If this file changes, we need a full rebuild
391.25SpookaDPSRCS+=	${RUMPTOP}/Makefile.rump
401.24Spooka
411.24Spooka#
421.24Spooka# Rename library symbols before use.  If a symbol does not already belong
431.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
441.24Spooka# avoids accidentally linking any kernel symbol against host platform
451.24Spooka# libraries.  The only non-renamed symbols are linkset delimiters and
461.24Spooka# the GOT, which are more a property of the compiler than the kernel.
471.24Spooka#
481.29Spooka# Some toolchains generate unresolved symbols which are supposed to be
491.29Spooka# satisfied by the toolchain itself when the program is linked.
501.29Spooka# Unfortunately, we do not know which of the symbols are generated by
511.29Spooka# the toolchain.  Worse, they vary from platform to platform and
521.29Spooka# toolchain to toolchain.  The good news, however, is that this will
531.29Spooka# be detected by a compile-time failure, so we can fairly easily manage
541.29Spooka# a quirktable here.
551.29Spooka.if ${MACHINE_CPU} == "mips"
561.29Spooka_SYMQUIRK='|_gp_disp'
571.29Spooka.elif ${MACHINE_CPU} == "hppa"
581.29Spooka_SYMQUIRK='|\$$\$$'
591.29Spooka.endif
601.24Spooka__archivebuild: .USE
611.24Spooka	${_MKTARGET_BUILD}
621.24Spooka	rm -f ${.TARGET}
631.34Spooka	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
641.24Spooka	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
651.29Spooka	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
661.24Spooka	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
671.24Spooka	    | sort | uniq  > renametab.${.TARGET}
681.37Spooka	${OBJCOPY} --preserve-dates --redefine-syms \
691.37Spooka	    renametab.${.TARGET} ${.TARGET}
701.24Spooka	rm -f renametab.${.TARGET}
711.36Sperry	${AR} ${_ARRANFL} ${.TARGET}
72