memory/jemalloc/moz.build
author Kris Maglione <maglione.k@gmail.com>
Mon, 15 May 2017 12:07:06 -0700
changeset 577997 f6e5056fc2de0b13b4b77e27fe88c2d4063b1445
parent 468145 6002440818d91011fb0a1753def417dba834f529
child 576034 34871b347c94fb584434d73dfc559e3bb01164c9
permissions -rw-r--r--
Bug 1365005: Cleanup async code after Task.jsm migration. r?aswan MozReview-Commit-ID: FNKSsBqq6Kf

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# When built with --enable-debug, jemalloc4 makes headers define functions that
# are normally inlined, and that prevents unified sources from working.
if CONFIG['MOZ_DEBUG']:
    maybe_unified_sources = SOURCES
else:
    maybe_unified_sources = UNIFIED_SOURCES

maybe_unified_sources += [
    'src/src/arena.c',
    'src/src/atomic.c',
    'src/src/base.c',
    'src/src/bitmap.c',
    'src/src/chunk.c',
    'src/src/chunk_dss.c',
    'src/src/chunk_mmap.c',
    'src/src/ckh.c',
    'src/src/ctl.c',
    'src/src/extent.c',
    'src/src/hash.c',
    'src/src/huge.c',
    'src/src/jemalloc.c',
    'src/src/mb.c',
    'src/src/mutex.c',
    'src/src/nstime.c',
    'src/src/pages.c',
    'src/src/prng.c',
    'src/src/prof.c',
    'src/src/quarantine.c',
    'src/src/rtree.c',
    'src/src/spin.c',
    'src/src/stats.c',
    'src/src/tcache.c',
    'src/src/ticker.c',
    'src/src/tsd.c',
    'src/src/util.c',
    'src/src/witness.c',
]

# Only OSX needs the zone allocation implementation,
# but only if replace-malloc is not enabled.
if CONFIG['OS_TARGET'] == 'Darwin' and not CONFIG['MOZ_REPLACE_MALLOC']:
    maybe_unified_sources += [
        'src/src/zone.c',
    ]

if CONFIG['MOZ_JEMALLOC4']:
    FINAL_LIBRARY = 'memory'
else:
    FINAL_LIBRARY = 'replace_jemalloc'

if CONFIG['MOZ_GLUE_IN_PROGRAM']:
    DIST_INSTALL = True

if CONFIG['_MSC_VER']:
    DEFINES['DLLEXPORT'] = True
    LOCAL_INCLUDES += ['src/include/msvc_compat']
    if not CONFIG['HAVE_INTTYPES_H']:
        LOCAL_INCLUDES += ['src/include/msvc_compat/C99']

if CONFIG['OS_TARGET'] == 'Linux':
    # For mremap
    DEFINES['_GNU_SOURCE'] = True

if CONFIG['GNU_CC']:
    CFLAGS += ['-std=gnu99']

DEFINES['abort'] = 'moz_abort'
DEFINES['JEMALLOC_ALLOC_JUNK'] = '((uint8_t)0xe4)'
DEFINES['JEMALLOC_FREE_JUNK']  = '((uint8_t)0xe5)'

LOCAL_INCLUDES += [
    '!src/include',
    'src/include',
]

# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

OS_LIBS += CONFIG['REALTIME_LIBS']