Makefile.rump revision 1.90
1# $NetBSD: Makefile.rump,v 1.90 2014/03/10 22:38:53 pooka Exp $ 2# 3 4WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet 5NOLINT= # kernel code 6 7.include <bsd.own.mk> 8 9# Use NetBSD kernel ABI by default on x86 archs. Performance-related 10# compile-time options may override this at a later date. 11.if ${MACHINE_ARCH} == "i386" || \ 12 ${MACHINE_ARCH} == "x86_64" 13_RUMP_NATIVEABI= yes 14CPPFLAGS+= -D_RUMP_NATIVE_ABI 15.else 16_RUMP_NATIVEABI= no 17CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 18CPPFLAGS+= -D_RUMPKERNEL 19.endif 20 21CPPFLAGS+= -DMAXUSERS=32 22CPPFLAGS+= -DCOMPAT_50=1 -DCOMPAT_60=1 23 24CPPFLAGS+= -nostdinc 25CFLAGS+= -ffreestanding -fno-strict-aliasing 26 27CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign 28CPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR 29CPPFLAGS+= -DDEBUGPRINT 30CPPFLAGS+= -I${.CURDIR} -I. 31CPPFLAGS+= -I${RUMPTOP}/../../common/include 32CPPFLAGS+= -I${RUMPTOP}/include 33CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt 34 35.ifdef NEED_ISYSTEM 36CPPFLAGS+= -isystem ${RUMPTOP}/../arch 37CPPFLAGS+= -isystem ${RUMPTOP}/.. 38.else 39CPPFLAGS+= -I${RUMPTOP}/../arch 40CPPFLAGS+= -I${RUMPTOP}/.. 41.endif 42 43RUMP_LDSCRIPT?=yes 44.if ${RUMP_LDSCRIPT} != "no" 45# my ld or yours? 46.ifdef HAVE_SUN_LD 47LDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump 48SRCS+= linksyms_sun.c 49.PATH: ${RUMPTOP} 50.else 51LDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump 52.endif 53.endif 54 55RUMP_DIAGNOSTIC?=yes 56.if ${RUMP_DIAGNOSTIC} == "yes" 57CPPFLAGS+= -DDIAGNOSTIC 58.endif 59 60.ifdef RUMP_DEBUG 61CPPFLAGS+= -DDEBUG 62.endif 63 64.ifdef RUMP_LOCKDEBUG 65CPPFLAGS+= -DLOCKDEBUG 66.endif 67 68RUMP_KTRACE?=yes 69.if ${RUMP_KTRACE} == "yes" 70CPPFLAGS+= -DKTRACE 71.endif 72 73# kernel libs should not get linked against libc 74# XXX: actually, we would like to enable this but cannot, since it 75# also leaves out libgcc, it causes problems on some platforms. 76# revisit some day. 77#LDFLAGS+= -nodefaultlibs 78 79# make sure __NetBSD__ gets defined (for builds on non-NetBSD) 80# also, give those builds a way to undef the local compiler's macros 81CPPFLAGS+= -D__NetBSD__ ${RUMPKERN_UNDEF} 82 83RUMPKERNEL= This is NetBSD and I am the rump. Good evening. 84 85# workaround: evbppc is not a well-defined arch 86.if (${MACHINE} == "evbppc") 87CPPFLAGS+= -DPPC_OEA 88.endif 89 90# If this file changes, we need a full rebuild 91DPSRCS+= ${RUMPTOP}/Makefile.rump 92 93# 94# Support for component-specific hypercalls 95# 96 97# XXX: Warning flags are not in CWARNFLAGS. Manually add a few important ones. 98 99.ifdef RUMPCOMP_USER && !defined(RUMPKERN_ONLY) 100.if empty(DESTDIR) 101DESTDIR=/ 102.endif 103BUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 104RUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 105rumpcomp_user.d: rumpcomp_user.c 106 ${_MKTARGET_CREATE} 107 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*rumpcomp_user.c} 108 109rumpcomp_user.o: rumpcomp_user.c 110 ${_MKTARGET_COMPILE} 111 ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} -Wall -Wmissing-prototypes ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*rumpcomp_user.c} 112 113rumpcomp_user.pico: rumpcomp_user.c 114 ${_MKTARGET_COMPILE} 115 ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} -Wall -Wmissing-prototypes ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*rumpcomp_user.c} 116 117rumpcomp_user.po: rumpcomp_user.c 118 ${_MKTARGET_COMPILE} 119 ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} -Wall -Wmissing-prototypes ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*rumpcomp_user.c} 120 121RUMPOBJ_NORENAME+=rumpcomp_user.*o 122SRCS+=rumpcomp_user.c 123.endif 124 125# 126# Rename library symbols before use. If a symbol does not already belong 127# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 128# avoids accidentally linking any kernel symbol against host platform 129# libraries. The only non-renamed symbols are linkset delimiters and 130# the GOT, which are more a property of the compiler than the kernel. 131# 132# Some toolchains generate unresolved symbols which are supposed to be 133# satisfied by the toolchain itself when the program is linked. 134# Unfortunately, we do not know which of the symbols are generated by 135# the toolchain. Worse, they vary from platform to platform and 136# toolchain to toolchain. The good news, however, is that this will 137# be detected by a compile-time failure, so we can fairly easily manage 138# a quirktable here. 139# 140# We also allow calling ourselves externally with e.g.: 141# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 142# 143.if ${MACHINE_CPU} == "mips" 144_SYMQUIRK='|_gp_disp' 145.elif ${MACHINE_CPU} == "hppa" 146_SYMQUIRK='|\$$\$$' 147.elif ${MACHINE_ARCH} == "powerpc64" 148_SYMQUIRK="|PF_funcs" 149.endif 150 151# 152# Prefix quirks. At least one toolchain generates global 153# symbols with prefixes which really need to remain as prefixes 154# (i.e. the '.' on the front of some ppc64 globals). The 155# way to know if you have the problem is if you get later 156# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 157# the 'X' part was added by the toolchain and will need to 158# be mentioned here. 159# 160.if ${MACHINE_ARCH} == "powerpc64" 161_PQ="\.?" 162.else 163_PQ= 164.endif 165 166rump_symren: __archivebuild 167.if !defined(RUMP_SYMREN) 168 @echo "Must supply RUMP_SYMREN for target rump_symren" 169 @false 170.endif 171 172# if we are called from lib build (RUMP_SYMREN is not specified), 173# build the arrrrchive. otherwise just rename symbols. 174__archivebuild: .USE 175.if defined(RUMP_SYMREN) && defined(RUMPTOP) 176 @echo "ERROR: RUMP_SYMREN can only be used standalone" 177 @false 178.endif 179.if defined(RUMP_SYMREN) 180 ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 181.else 182 ${_MKTARGET_BUILD} 183 rm -f ${.TARGET} 184.endif 185 for obj in ${RUMP_SYMREN:U${.ALLSRC:N${RUMPOBJ_NORENAME}}}; do \ 186 ${NM} -go $${obj} | ${TOOL_AWK} ' \ 187 $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 188 {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 189 | sort | uniq > renametab.$${obj}; \ 190 ${OBJCOPY} --preserve-dates --redefine-syms \ 191 renametab.$${obj} $${obj}; \ 192 rm -f renametab.$${obj}; \ 193 done 194.if !defined(RUMP_SYMREN) 195 ${AR} ${_ARFL} ${.TARGET} \ 196 `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 197.endif 198 199_BSD_IOCONF_MK_USER_=1 200.include <bsd.ioconf.mk> 201 202.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 203.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 204