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