Makefile.rump revision 1.42
11.42Spooka#	$NetBSD: Makefile.rump,v 1.42 2009/11/17 16:17:06 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.42Spooka# kernel libs should not get linked against libc
301.42SpookaLDFLAGS+=	-nodefaultlibs
311.42Spooka
321.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
331.39SpookaCPPFLAGS+=	-D__NetBSD__
341.39Spooka
351.11SpookaRUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
361.11Spooka
371.13Spooka# workaround: evbppc is not a well-defined arch
381.13Spooka.if (${MACHINE} == "evbppc")
391.16SpookaCPPFLAGS+=	-DPPC_OEA
401.13Spooka.endif
411.13Spooka
421.25Spooka# If this file changes, we need a full rebuild
431.25SpookaDPSRCS+=	${RUMPTOP}/Makefile.rump
441.24Spooka
451.41Spooka.ifdef RUMP_ISMODULE
461.41Spooka.PATH:		${RUMPTOP}/librump
471.41SpookaSRCS+=		rump_module.c
481.41Spooka.endif
491.41Spooka.ifdef RUMP_ISDOMAIN
501.41Spooka.PATH:		${RUMPTOP}/librump
511.41SpookaSRCS+=		rump_domain.c
521.41Spooka.endif
531.41Spooka
541.24Spooka#
551.24Spooka# Rename library symbols before use.  If a symbol does not already belong
561.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
571.24Spooka# avoids accidentally linking any kernel symbol against host platform
581.24Spooka# libraries.  The only non-renamed symbols are linkset delimiters and
591.24Spooka# the GOT, which are more a property of the compiler than the kernel.
601.24Spooka#
611.29Spooka# Some toolchains generate unresolved symbols which are supposed to be
621.29Spooka# satisfied by the toolchain itself when the program is linked.
631.29Spooka# Unfortunately, we do not know which of the symbols are generated by
641.29Spooka# the toolchain.  Worse, they vary from platform to platform and
651.29Spooka# toolchain to toolchain.  The good news, however, is that this will
661.29Spooka# be detected by a compile-time failure, so we can fairly easily manage
671.29Spooka# a quirktable here.
681.29Spooka.if ${MACHINE_CPU} == "mips"
691.29Spooka_SYMQUIRK='|_gp_disp'
701.29Spooka.elif ${MACHINE_CPU} == "hppa"
711.29Spooka_SYMQUIRK='|\$$\$$'
721.29Spooka.endif
731.24Spooka__archivebuild: .USE
741.24Spooka	${_MKTARGET_BUILD}
751.24Spooka	rm -f ${.TARGET}
761.34Spooka	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
771.24Spooka	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
781.29Spooka	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
791.24Spooka	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
801.24Spooka	    | sort | uniq  > renametab.${.TARGET}
811.37Spooka	${OBJCOPY} --preserve-dates --redefine-syms \
821.37Spooka	    renametab.${.TARGET} ${.TARGET}
831.24Spooka	rm -f renametab.${.TARGET}
841.36Sperry	${AR} ${_ARRANFL} ${.TARGET}
85