Makefile.rump revision 1.43
11.43Spooka#	$NetBSD: Makefile.rump,v 1.43 2009/11/20 12:24:17 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.43Spooka# XXX: actually, we would like to enable this but cannot, since it
311.43Spooka# also leaves out libgcc, it causes problems on some platforms.
321.43Spooka# revisit some day.
331.43Spooka#LDFLAGS+=	-nodefaultlibs
341.42Spooka
351.39Spooka# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
361.39SpookaCPPFLAGS+=	-D__NetBSD__
371.39Spooka
381.11SpookaRUMPKERNEL=	This is NetBSD and I am the rump.  Good evening.
391.11Spooka
401.13Spooka# workaround: evbppc is not a well-defined arch
411.13Spooka.if (${MACHINE} == "evbppc")
421.16SpookaCPPFLAGS+=	-DPPC_OEA
431.13Spooka.endif
441.13Spooka
451.25Spooka# If this file changes, we need a full rebuild
461.25SpookaDPSRCS+=	${RUMPTOP}/Makefile.rump
471.24Spooka
481.41Spooka.ifdef RUMP_ISMODULE
491.41Spooka.PATH:		${RUMPTOP}/librump
501.41SpookaSRCS+=		rump_module.c
511.41Spooka.endif
521.41Spooka.ifdef RUMP_ISDOMAIN
531.41Spooka.PATH:		${RUMPTOP}/librump
541.41SpookaSRCS+=		rump_domain.c
551.41Spooka.endif
561.41Spooka
571.24Spooka#
581.24Spooka# Rename library symbols before use.  If a symbol does not already belong
591.24Spooka# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
601.24Spooka# avoids accidentally linking any kernel symbol against host platform
611.24Spooka# libraries.  The only non-renamed symbols are linkset delimiters and
621.24Spooka# the GOT, which are more a property of the compiler than the kernel.
631.24Spooka#
641.29Spooka# Some toolchains generate unresolved symbols which are supposed to be
651.29Spooka# satisfied by the toolchain itself when the program is linked.
661.29Spooka# Unfortunately, we do not know which of the symbols are generated by
671.29Spooka# the toolchain.  Worse, they vary from platform to platform and
681.29Spooka# toolchain to toolchain.  The good news, however, is that this will
691.29Spooka# be detected by a compile-time failure, so we can fairly easily manage
701.29Spooka# a quirktable here.
711.29Spooka.if ${MACHINE_CPU} == "mips"
721.29Spooka_SYMQUIRK='|_gp_disp'
731.29Spooka.elif ${MACHINE_CPU} == "hppa"
741.29Spooka_SYMQUIRK='|\$$\$$'
751.29Spooka.endif
761.24Spooka__archivebuild: .USE
771.24Spooka	${_MKTARGET_BUILD}
781.24Spooka	rm -f ${.TARGET}
791.34Spooka	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
801.24Spooka	${NM} -go ${.TARGET} | ${TOOL_AWK} '	\
811.29Spooka	    $$NF!~/^(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
821.24Spooka	      {printf "%s rumpns_%s\n", $$NF, $$NF}' \
831.24Spooka	    | sort | uniq  > renametab.${.TARGET}
841.37Spooka	${OBJCOPY} --preserve-dates --redefine-syms \
851.37Spooka	    renametab.${.TARGET} ${.TARGET}
861.24Spooka	rm -f renametab.${.TARGET}
871.36Sperry	${AR} ${_ARRANFL} ${.TARGET}
88