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

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

CVSweb <webmaster@jp.NetBSD.org>