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