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