[BACK]Return to Makefile.rump CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / rump

Annotation of src/sys/rump/Makefile.rump, Revision 1.119

1.119   ! pooka       1: #      $NetBSD: Makefile.rump,v 1.118 2015/08/24 22:52:15 pooka Exp $
1.1       pooka       2: #
                      3:
1.95      pooka       4: .if !defined(_RUMP_MK)
                      5: _RUMP_MK= #defined
                      6:
1.33      lukem       7: WARNS?=                3       # XXX: src/sys won't compile with -Wsign-compare yet
1.10      pooka       8: NOLINT=                # kernel code
1.1       pooka       9:
1.20      pooka      10: .include <bsd.own.mk>
                     11:
1.90      pooka      12: # Use NetBSD kernel ABI by default on x86 archs.  Performance-related
                     13: # compile-time options may override this at a later date.
1.92      pooka      14: .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64")
1.90      pooka      15: _RUMP_NATIVEABI= yes
                     16: .else
                     17: _RUMP_NATIVEABI= no
1.18      pooka      18: CPPFLAGS:=     -I${RUMPTOP}/include ${CPPFLAGS}
1.92      pooka      19: CPPFLAGS+=     -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern
1.18      pooka      20: .endif
                     21:
1.99      alnsn      22: # Define baseline cpu for mips ports, required for
                     23: # rumpcomp_sync_icache() hypercall.
                     24: .if !empty(MACHINE_ARCH:Mmips*)
                     25: .if !empty(MACHINE_ARCH:Mmips64*)
                     26: CPPFLAGS+=     -DMIPS64=1
                     27: .else
                     28: CPPFLAGS+=     -DMIPS1=1
                     29: .endif
                     30: .endif
                     31:
1.112     pooka      32: # which NetBSD compat to build
1.113     pooka      33: RUMP_NBCOMPAT?=default
                     34: .if ${RUMP_NBCOMPAT} == "all" || ${RUMP_NBCOMPAT} == "default"
1.112     pooka      35: RUMP_NBCOMPAT= 50 60 70
                     36: .endif
                     37: .if ${RUMP_NBCOMPAT} == "none"
                     38: RUMP_NBCOMPAT=
                     39: .endif
1.110     pooka      40: RUMP_NBCOMPAT:=        ${RUMP_NBCOMPAT:S/,/ /g}
                     41: CPPFLAGS+=     ${RUMP_NBCOMPAT:C/[1-9]0/-DCOMPAT_&/g}
1.104     pooka      42:
1.66      pooka      43: CPPFLAGS+=     -nostdinc
1.22      pooka      44: CFLAGS+=       -ffreestanding -fno-strict-aliasing
1.66      pooka      45:
1.50      pooka      46: CWARNFLAGS+=   -Wno-format-zero-length -Wno-pointer-sign
1.114     pooka      47:
                     48: CPPFLAGS+=     -imacros ${RUMPTOP}/include/opt/opt_rumpkernel.h
1.115     pooka      49: .ifdef BUILDRUMP_IMACROS
                     50: CPPFLAGS+=     -imacros ${BUILDRUMP_IMACROS}
                     51: .endif
1.114     pooka      52:
1.15      pooka      53: CPPFLAGS+=     -I${.CURDIR} -I.
1.65      pooka      54: CPPFLAGS+=     -I${RUMPTOP}/../../common/include
1.18      pooka      55: CPPFLAGS+=     -I${RUMPTOP}/include
1.117     pooka      56: CPPFLAGS+=     -I${RUMPTOP}/include/opt
1.65      pooka      57:
1.103     pooka      58: SHLIB_MAJOR?=  0
                     59: SHLIB_MINOR?=  0
                     60:
1.65      pooka      61: .ifdef NEED_ISYSTEM
                     62: CPPFLAGS+=     -isystem ${RUMPTOP}/../arch
                     63: CPPFLAGS+=     -isystem ${RUMPTOP}/..
                     64: .else
                     65: CPPFLAGS+=     -I${RUMPTOP}/../arch
                     66: CPPFLAGS+=     -I${RUMPTOP}/..
                     67: .endif
                     68:
1.93      pooka      69: RUMP_LDSCRIPT?=        GNU
1.79      pooka      70: .if ${RUMP_LDSCRIPT} != "no"
1.72      pooka      71: # my ld or yours?
1.97      pooka      72: .if ${RUMP_LDSCRIPT} == "sun"
1.72      pooka      73: LDFLAGS+=      -Wl,-M ${RUMPTOP}/ldscript_sun.rump
                     74: SRCS+=         linksyms_sun.c
1.74      pooka      75: .PATH:         ${RUMPTOP}
1.93      pooka      76: .elif ${RUMP_LDSCRIPT} == "GNU"
                     77: LDFLAGS+=      -Wl,-T,${RUMPTOP}/ldscript.rump
1.96      pooka      78: .elif ${RUMP_LDSCRIPT} == "ctor"
                     79: CPPFLAGS+=     -DRUMP_USE_CTOR
1.72      pooka      80: .else
1.93      pooka      81: .error Unknown ldscript ${RUMP_LDSCRIPT}
1.73      pooka      82: .endif
1.79      pooka      83: .endif
1.62      pooka      84:
1.94      pooka      85: .if defined(RUMP_CURLWP)
                     86: .if   ${RUMP_CURLWP} == "hypercall"
                     87: CPPFLAGS+=     -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL
                     88: .elif ${RUMP_CURLWP} == "__thread"
                     89: CPPFLAGS+=     -DRUMP_CURLWP=RUMP_CURLWP___THREAD
                     90: .elif ${RUMP_CURLWP} == "register"
                     91: CPPFLAGS+=     -DRUMP_CURLWP=RUMP_CURLWP_REGISTER
                     92: .else
                     93: .error Unsupported curlwp scheme: ${RUMP_CURLWP}
                     94: .endif
                     95: .endif
                     96:
1.62      pooka      97: RUMP_DIAGNOSTIC?=yes
                     98: .if ${RUMP_DIAGNOSTIC} == "yes"
                     99: CPPFLAGS+=     -DDIAGNOSTIC
                    100: .endif
                    101:
                    102: .ifdef RUMP_DEBUG
                    103: CPPFLAGS+=     -DDEBUG
                    104: .endif
1.1       pooka     105:
1.59      pooka     106: .ifdef RUMP_LOCKDEBUG
                    107: CPPFLAGS+=     -DLOCKDEBUG
                    108: .endif
                    109:
1.89      pooka     110: RUMP_KTRACE?=yes
                    111: .if ${RUMP_KTRACE} == "yes"
                    112: CPPFLAGS+=     -DKTRACE
                    113: .endif
                    114:
1.42      pooka     115: # kernel libs should not get linked against libc
1.43      pooka     116: # XXX: actually, we would like to enable this but cannot, since it
                    117: # also leaves out libgcc, it causes problems on some platforms.
                    118: # revisit some day.
                    119: #LDFLAGS+=     -nodefaultlibs
1.42      pooka     120:
1.39      pooka     121: # make sure __NetBSD__ gets defined (for builds on non-NetBSD)
1.67      pooka     122: # also, give those builds a way to undef the local compiler's macros
1.114     pooka     123: CPPFLAGS+=     ${RUMPKERN_UNDEF}
1.39      pooka     124:
1.11      pooka     125: RUMPKERNEL=    This is NetBSD and I am the rump.  Good evening.
                    126:
1.13      pooka     127: # workaround: evbppc is not a well-defined arch
                    128: .if (${MACHINE} == "evbppc")
1.16      pooka     129: CPPFLAGS+=     -DPPC_OEA
1.13      pooka     130: .endif
                    131:
1.114     pooka     132: # If any of these files change, we need a full rebuild
1.25      pooka     133: DPSRCS+=       ${RUMPTOP}/Makefile.rump
1.24      pooka     134:
                    135: #
1.69      pooka     136: # Support for component-specific hypercalls
                    137: #
                    138:
1.101     pooka     139: # no easy way to get WARNS out of bsd.sys.mk
1.102     pooka     140: RUMPCOMP_USER_WARNFLAGS=       -Wall -Wextra -Wno-unused-parameter
                    141: RUMPCOMP_USER_WARNFLAGS+=      -Wstrict-prototypes -Wmissing-prototypes
1.75      christos  142:
1.91      pooka     143: .ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY)
1.75      christos  144: .if empty(DESTDIR)
                    145: DESTDIR=/
                    146: .endif
                    147: BUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR}
1.82      pooka     148: RUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:}
1.91      pooka     149: .for rcusrc in ${RUMPCOMP_USER_SRCS:R}
                    150: ${rcusrc}.d: ${rcusrc}.c
1.69      pooka     151:        ${_MKTARGET_CREATE}
1.91      pooka     152:        ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c}
1.69      pooka     153:
1.91      pooka     154: ${rcusrc}.o: ${rcusrc}.c
1.69      pooka     155:        ${_MKTARGET_COMPILE}
1.101     pooka     156:        ${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
1.69      pooka     157:
1.91      pooka     158: ${rcusrc}.pico: ${rcusrc}.c
1.69      pooka     159:        ${_MKTARGET_COMPILE}
1.101     pooka     160:        ${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
1.69      pooka     161:
1.91      pooka     162: ${rcusrc}.po: ${rcusrc}.c
1.69      pooka     163:        ${_MKTARGET_COMPILE}
1.101     pooka     164:        ${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
1.69      pooka     165:
1.91      pooka     166: RUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po
                    167: SRCS+=${rcusrc}.c
                    168: .endfor
1.69      pooka     169: .endif
                    170:
                    171: #
1.24      pooka     172: # Rename library symbols before use.  If a symbol does not already belong
                    173: # to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns".  This
                    174: # avoids accidentally linking any kernel symbol against host platform
                    175: # libraries.  The only non-renamed symbols are linkset delimiters and
                    176: # the GOT, which are more a property of the compiler than the kernel.
                    177: #
1.29      pooka     178: # Some toolchains generate unresolved symbols which are supposed to be
                    179: # satisfied by the toolchain itself when the program is linked.
                    180: # Unfortunately, we do not know which of the symbols are generated by
                    181: # the toolchain.  Worse, they vary from platform to platform and
                    182: # toolchain to toolchain.  The good news, however, is that this will
                    183: # be detected by a compile-time failure, so we can fairly easily manage
                    184: # a quirktable here.
1.46      pooka     185: #
                    186: # We also allow calling ourselves externally with e.g.:
                    187: # make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj
                    188: #
1.29      pooka     189: .if ${MACHINE_CPU} == "mips"
                    190: _SYMQUIRK='|_gp_disp'
                    191: .elif ${MACHINE_CPU} == "hppa"
                    192: _SYMQUIRK='|\$$\$$'
1.54      mrg       193: .elif ${MACHINE_ARCH} == "powerpc64"
1.55      mrg       194: _SYMQUIRK="|PF_funcs"
                    195: .endif
                    196:
                    197: #
                    198: # Prefix quirks.  At least one toolchain generates global
                    199: # symbols with prefixes which really need to remain as prefixes
                    200: # (i.e. the '.' on the front of some ppc64 globals).  The
                    201: # way to know if you have the problem is if you get later
                    202: # complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH';
                    203: # the 'X' part was added by the toolchain and will need to
                    204: # be mentioned here.
                    205: #
                    206: .if ${MACHINE_ARCH} == "powerpc64"
                    207: _PQ="\.?"
                    208: .else
                    209: _PQ=
1.29      pooka     210: .endif
1.46      pooka     211:
                    212: rump_symren: __archivebuild
                    213: .if !defined(RUMP_SYMREN)
                    214:        @echo "Must supply RUMP_SYMREN for target rump_symren"
                    215:        @false
                    216: .endif
                    217:
                    218: # if we are called from lib build (RUMP_SYMREN is not specified),
                    219: # build the arrrrchive.  otherwise just rename symbols.
1.24      pooka     220: __archivebuild: .USE
1.46      pooka     221: .if defined(RUMP_SYMREN) && defined(RUMPTOP)
                    222:        @echo "ERROR: RUMP_SYMREN can only be used standalone"
                    223:        @false
                    224: .endif
                    225: .if defined(RUMP_SYMREN)
                    226:        ${_MKMSG} " symbol rename " ${RUMP_SYMREN}
                    227: .else
1.24      pooka     228:        ${_MKTARGET_BUILD}
                    229:        rm -f ${.TARGET}
1.46      pooka     230: .endif
1.91      pooka     231:        for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \
                    232:                ${NM} -go $${renameobj} | ${TOOL_AWK} ' \
1.98      pooka     233:                    $$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \
1.69      pooka     234:                      {s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\
1.91      pooka     235:                    | sort | uniq  > renametab.$${renameobj}; \
1.69      pooka     236:                ${OBJCOPY} --preserve-dates --redefine-syms \
1.91      pooka     237:                    renametab.$${renameobj} $${renameobj}; \
                    238:                rm -f renametab.$${renameobj}; \
1.69      pooka     239:        done
1.46      pooka     240: .if !defined(RUMP_SYMREN)
1.69      pooka     241:        ${AR} ${_ARFL} ${.TARGET} \
                    242:            `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.46      pooka     243: .endif
1.47      pooka     244:
1.119   ! pooka     245: COMMENT?=      (no description)
        !           246: describe: .PHONY
        !           247:        @printf '%-24s %s\n' '${LIB}' '${COMMENT}'
        !           248:
1.53      pooka     249: _BSD_IOCONF_MK_USER_=1
                    250: .include <bsd.ioconf.mk>
1.47      pooka     251:
1.44      pooka     252: .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
                    253: .-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"
1.95      pooka     254:
                    255: .endif # _RUMP_MK

CVSweb <webmaster@jp.NetBSD.org>