Annotation of src/sys/rump/Makefile.rump, Revision 1.57
1.57 ! pooka 1: # $NetBSD: Makefile.rump,v 1.56 2010/04/26 23:01:53 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.22 pooka 18: CFLAGS+= -ffreestanding -fno-strict-aliasing
1.50 pooka 19: CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign
1.23 pooka 20: CPPFLAGS+= -D_KERNEL -DMULTIPROCESSOR -D_MODULE -DMODULAR
1.21 pooka 21: CPPFLAGS+= -DMAXUSERS=32
1.17 pooka 22: CPPFLAGS+= -DDIAGNOSTIC
1.32 pooka 23: CPPFLAGS+= -DCOMPAT_50
1.38 pooka 24: CPPFLAGS+= -DDEBUGPRINT
1.15 pooka 25: CPPFLAGS+= -I${.CURDIR} -I.
1.14 pooka 26: CPPFLAGS+= -I${RUMPTOP}/../../common/include -I${RUMPTOP}/../arch
1.18 pooka 27: CPPFLAGS+= -I${RUMPTOP}/include
1.21 pooka 28: CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt
1.10 pooka 29: CPPFLAGS+= -nostdinc -I${RUMPTOP}/..
1.45 pooka 30: LDFLAGS+= -T ${RUMPTOP}/ldscript.rump
1.10 pooka 31: #CPPFLAGS+= -DDEBUG
1.1 pooka 32:
1.42 pooka 33: # kernel libs should not get linked against libc
1.43 pooka 34: # XXX: actually, we would like to enable this but cannot, since it
35: # also leaves out libgcc, it causes problems on some platforms.
36: # revisit some day.
37: #LDFLAGS+= -nodefaultlibs
1.42 pooka 38:
1.39 pooka 39: # make sure __NetBSD__ gets defined (for builds on non-NetBSD)
40: CPPFLAGS+= -D__NetBSD__
41:
1.11 pooka 42: RUMPKERNEL= This is NetBSD and I am the rump. Good evening.
43:
1.13 pooka 44: # workaround: evbppc is not a well-defined arch
45: .if (${MACHINE} == "evbppc")
1.16 pooka 46: CPPFLAGS+= -DPPC_OEA
1.13 pooka 47: .endif
48:
1.25 pooka 49: # If this file changes, we need a full rebuild
50: DPSRCS+= ${RUMPTOP}/Makefile.rump
1.24 pooka 51:
52: #
53: # Rename library symbols before use. If a symbol does not already belong
54: # to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This
55: # avoids accidentally linking any kernel symbol against host platform
56: # libraries. The only non-renamed symbols are linkset delimiters and
57: # the GOT, which are more a property of the compiler than the kernel.
58: #
1.29 pooka 59: # Some toolchains generate unresolved symbols which are supposed to be
60: # satisfied by the toolchain itself when the program is linked.
61: # Unfortunately, we do not know which of the symbols are generated by
62: # the toolchain. Worse, they vary from platform to platform and
63: # toolchain to toolchain. The good news, however, is that this will
64: # be detected by a compile-time failure, so we can fairly easily manage
65: # a quirktable here.
1.46 pooka 66: #
67: # We also allow calling ourselves externally with e.g.:
68: # make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj
69: #
1.29 pooka 70: .if ${MACHINE_CPU} == "mips"
71: _SYMQUIRK='|_gp_disp'
72: .elif ${MACHINE_CPU} == "hppa"
73: _SYMQUIRK='|\$$\$$'
1.54 mrg 74: .elif ${MACHINE_ARCH} == "powerpc64"
1.55 mrg 75: _SYMQUIRK="|PF_funcs"
76: .endif
77:
78: #
79: # Prefix quirks. At least one toolchain generates global
80: # symbols with prefixes which really need to remain as prefixes
81: # (i.e. the '.' on the front of some ppc64 globals). The
82: # way to know if you have the problem is if you get later
83: # complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH';
84: # the 'X' part was added by the toolchain and will need to
85: # be mentioned here.
86: #
87: .if ${MACHINE_ARCH} == "powerpc64"
88: _PQ="\.?"
89: .else
90: _PQ=
1.29 pooka 91: .endif
1.46 pooka 92:
93: rump_symren: __archivebuild
94: .if !defined(RUMP_SYMREN)
95: @echo "Must supply RUMP_SYMREN for target rump_symren"
96: @false
97: .endif
98:
99: # if we are called from lib build (RUMP_SYMREN is not specified),
100: # build the arrrrchive. otherwise just rename symbols.
1.24 pooka 101: __archivebuild: .USE
1.46 pooka 102: .if defined(RUMP_SYMREN) && defined(RUMPTOP)
103: @echo "ERROR: RUMP_SYMREN can only be used standalone"
104: @false
105: .endif
106: .if defined(RUMP_SYMREN)
107: ${_MKMSG} " symbol rename " ${RUMP_SYMREN}
108: .else
1.24 pooka 109: ${_MKTARGET_BUILD}
110: rm -f ${.TARGET}
1.34 pooka 111: ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.46 pooka 112: .endif
113: ${NM} -go ${RUMP_SYMREN:U${.TARGET}} | ${TOOL_AWK} ' \
1.55 mrg 114: $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}')/ \
115: {s = $$NF; sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}' \
1.24 pooka 116: | sort | uniq > renametab.${.TARGET}
1.37 pooka 117: ${OBJCOPY} --preserve-dates --redefine-syms \
1.46 pooka 118: renametab.${.TARGET} ${RUMP_SYMREN:U${.TARGET}}
1.24 pooka 119: rm -f renametab.${.TARGET}
1.46 pooka 120: .if !defined(RUMP_SYMREN)
1.36 perry 121: ${AR} ${_ARRANFL} ${.TARGET}
1.46 pooka 122: .endif
1.47 pooka 123:
1.53 pooka 124: _BSD_IOCONF_MK_USER_=1
125: .include <bsd.ioconf.mk>
1.47 pooka 126:
1.44 pooka 127: .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
128: .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"
CVSweb <webmaster@jp.NetBSD.org>