Makefile.rump revision 1.45
11.45Spooka#	$NetBSD: Makefile.rump,v 1.45 2009/12/12 17:10:19 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.45SpookaLDFLAGS+=	-T ${RUMPTOP}/ldscript.rump
281.10Spooka#CPPFLAGS+=	-DDEBUG
291.1Spooka
301.42Spooka# kernel libs should not get linked against libc
311.43Spooka# XXX: actually, we would like to enable this but cannot, since it
321.43Spooka# also leaves out libgcc, it causes problems on some platforms.
331.43Spooka# revisit some day.
341.43Spooka#LDFLAGS+=	-nodefaultlibs
351.42Spooka
361.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
371.39SpookaCPPFLAGS+=	-D__NetBSD__
381.39Spooka
391.11SpookaRUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
401.11Spooka
411.13Spooka# workaround: evbppc is not a well-defined arch
421.13Spooka.if (${MACHINE} == "evbppc")
431.16SpookaCPPFLAGS+=	-DPPC_OEA
441.13Spooka.endif
451.13Spooka
461.25Spooka# If this file changes, we need a full rebuild
471.25SpookaDPSRCS+=	${RUMPTOP}/Makefile.rump
481.24Spooka
491.24Spooka#
501.24Spooka# Rename library symbols before use.  If a symbol does not already belong
511.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
521.24Spooka# avoids accidentally linking any kernel symbol against host platform
531.24Spooka# libraries.  The only non-renamed symbols are linkset delimiters and
541.24Spooka# the GOT, which are more a property of the compiler than the kernel.
551.24Spooka#
561.29Spooka# Some toolchains generate unresolved symbols which are supposed to be
571.29Spooka# satisfied by the toolchain itself when the program is linked.
581.29Spooka# Unfortunately, we do not know which of the symbols are generated by
591.29Spooka# the toolchain.  Worse, they vary from platform to platform and
601.29Spooka# toolchain to toolchain.  The good news, however, is that this will
611.29Spooka# be detected by a compile-time failure, so we can fairly easily manage
621.29Spooka# a quirktable here.
631.29Spooka.if ${MACHINE_CPU} == "mips"
641.29Spooka_SYMQUIRK='|_gp_disp'
651.29Spooka.elif ${MACHINE_CPU} == "hppa"
661.29Spooka_SYMQUIRK='|\$$\$$'
671.29Spooka.endif
681.24Spooka__archivebuild: .USE
691.24Spooka	${_MKTARGET_BUILD}
701.24Spooka	rm -f ${.TARGET}
711.34Spooka	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
721.24Spooka	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
731.29Spooka	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
741.24Spooka	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
751.24Spooka	    | sort | uniq  > renametab.${.TARGET}
761.37Spooka	${OBJCOPY} --preserve-dates --redefine-syms \
771.37Spooka	    renametab.${.TARGET} ${.TARGET}
781.24Spooka	rm -f renametab.${.TARGET}
791.36Sperry	${AR} ${_ARRANFL} ${.TARGET}
801.44Spooka
811.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
821.44Spooka.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"
83