[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.99

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

CVSweb <webmaster@jp.NetBSD.org>