Makefile.rump revision 1.91
1# $NetBSD: Makefile.rump,v 1.91 2014/03/13 01:34:06 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 100.warning RUMPCOMP_USER is deprecated. Use RUMPCOMP_USER_SRCS 101RUMPCOMP_USER_SRCS= rumpcomp_user.c 102.endif 103.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY) 104.if empty(DESTDIR) 105DESTDIR=/ 106.endif 107BUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR} 108RUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:} 109.for rcusrc in ${RUMPCOMP_USER_SRCS:R} 110${rcusrc}.d: ${rcusrc}.c 111 ${_MKTARGET_CREATE} 112 ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c} 113 114${rcusrc}.o: ${rcusrc}.c 115 ${_MKTARGET_COMPILE} 116 ${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*${rcusrc}.c} 117 118${rcusrc}.pico: ${rcusrc}.c 119 ${_MKTARGET_COMPILE} 120 ${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*${rcusrc}.c} 121 122${rcusrc}.po: ${rcusrc}.c 123 ${_MKTARGET_COMPILE} 124 ${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*${rcusrc}.c} 125 126RUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po 127SRCS+=${rcusrc}.c 128.endfor 129.endif 130 131# 132# Rename library symbols before use. If a symbol does not already belong 133# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This 134# avoids accidentally linking any kernel symbol against host platform 135# libraries. The only non-renamed symbols are linkset delimiters and 136# the GOT, which are more a property of the compiler than the kernel. 137# 138# Some toolchains generate unresolved symbols which are supposed to be 139# satisfied by the toolchain itself when the program is linked. 140# Unfortunately, we do not know which of the symbols are generated by 141# the toolchain. Worse, they vary from platform to platform and 142# toolchain to toolchain. The good news, however, is that this will 143# be detected by a compile-time failure, so we can fairly easily manage 144# a quirktable here. 145# 146# We also allow calling ourselves externally with e.g.: 147# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj 148# 149.if ${MACHINE_CPU} == "mips" 150_SYMQUIRK='|_gp_disp' 151.elif ${MACHINE_CPU} == "hppa" 152_SYMQUIRK='|\$$\$$' 153.elif ${MACHINE_ARCH} == "powerpc64" 154_SYMQUIRK="|PF_funcs" 155.endif 156 157# 158# Prefix quirks. At least one toolchain generates global 159# symbols with prefixes which really need to remain as prefixes 160# (i.e. the '.' on the front of some ppc64 globals). The 161# way to know if you have the problem is if you get later 162# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH'; 163# the 'X' part was added by the toolchain and will need to 164# be mentioned here. 165# 166.if ${MACHINE_ARCH} == "powerpc64" 167_PQ="\.?" 168.else 169_PQ= 170.endif 171 172rump_symren: __archivebuild 173.if !defined(RUMP_SYMREN) 174 @echo "Must supply RUMP_SYMREN for target rump_symren" 175 @false 176.endif 177 178# if we are called from lib build (RUMP_SYMREN is not specified), 179# build the arrrrchive. otherwise just rename symbols. 180__archivebuild: .USE 181.if defined(RUMP_SYMREN) && defined(RUMPTOP) 182 @echo "ERROR: RUMP_SYMREN can only be used standalone" 183 @false 184.endif 185.if defined(RUMP_SYMREN) 186 ${_MKMSG} " symbol rename " ${RUMP_SYMREN} 187.else 188 ${_MKTARGET_BUILD} 189 rm -f ${.TARGET} 190.endif 191 for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \ 192 ${NM} -go $${renameobj} | ${TOOL_AWK} ' \ 193 $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \ 194 {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\ 195 | sort | uniq > renametab.$${renameobj}; \ 196 ${OBJCOPY} --preserve-dates --redefine-syms \ 197 renametab.$${renameobj} $${renameobj}; \ 198 rm -f renametab.$${renameobj}; \ 199 done 200.if !defined(RUMP_SYMREN) 201 ${AR} ${_ARFL} ${.TARGET} \ 202 `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}` 203.endif 204 205_BSD_IOCONF_MK_USER_=1 206.include <bsd.ioconf.mk> 207 208.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc" 209.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc" 210