build/clang-plugin/moz.build
author Dustin J. Mitchell <dustin@mozilla.com>
Mon, 02 Oct 2017 18:22:56 +0000
changeset 399728 0f0395687d36597098e4248457ed69f092c39f8f
parent 395406 01452e6194e89296ddd6738d1d29a91597478033
child 417208 827deadecf7e43ad9f9891444637be01619a2ba8
permissions -rw-r--r--
Bug 1403519 - only build docs when necessary r=gps This marks **/docs/** as exclusively docs, and code that is autodoc'd as inclusively docs. That means that a change that purely modifies documentation files will *only* run `docs` tasks, while a change that modifies autodoc'd source code will *additionaly* run `docs` tasks. The tasks do not run by default. MozReview-Commit-ID: G9tOK0AwtrI

# -*- 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/.

SharedLibrary('clang-plugin')

SOURCES += ['!ThirdPartyPaths.cpp']

UNIFIED_SOURCES += [
    'ArithmeticArgChecker.cpp',
    'AssertAssignmentChecker.cpp',
    'CanRunScriptChecker.cpp',
    'CustomTypeAnnotation.cpp',
    'DanglingOnTemporaryChecker.cpp',
    'DiagnosticsMatcher.cpp',
    'ExplicitImplicitChecker.cpp',
    'ExplicitOperatorBoolChecker.cpp',
    'KungFuDeathGripChecker.cpp',
    'MozCheckAction.cpp',
    'MustOverrideChecker.cpp',
    'MustReturnFromCallerChecker.cpp',
    'MustUseChecker.cpp',
    'NaNExprChecker.cpp',
    'NeedsNoVTableTypeChecker.cpp',
    'NoAddRefReleaseOnReturnChecker.cpp',
    'NoAutoTypeChecker.cpp',
    'NoDuplicateRefCntMemberChecker.cpp',
    'NoExplicitMoveConstructorChecker.cpp',
    'NonMemMovableMemberChecker.cpp',
    'NonMemMovableTemplateArgChecker.cpp',
    'NonParamInsideFunctionDeclChecker.cpp',
    'OverrideBaseCallChecker.cpp',
    'OverrideBaseCallUsageChecker.cpp',
    'ParamTraitsEnumChecker.cpp',
    'RefCountedCopyConstructorChecker.cpp',
    'RefCountedInsideLambdaChecker.cpp',
    'ScopeChecker.cpp',
    'SprintfLiteralChecker.cpp',
    'TrivialCtorDtorChecker.cpp',
    'VariableUsageHelpers.cpp',
]

if CONFIG['ENABLE_MOZSEARCH_PLUGIN']:
    UNIFIED_SOURCES += [
        'mozsearch-plugin/FileOperations.cpp',
        'mozsearch-plugin/JSONFormatter.cpp',
        'mozsearch-plugin/MozsearchIndexer.cpp',
        'mozsearch-plugin/StringOperations.cpp',
    ]

GENERATED_FILES += ['ThirdPartyPaths.cpp']
third_party_paths = GENERATED_FILES['ThirdPartyPaths.cpp']
third_party_paths.script = "ThirdPartyPaths.py:generate"
third_party_paths.inputs = [
    '/tools/rewriting/ThirdPartyPaths.txt',
]

DisableStlWrapping()
NoVisibilityFlags()

# libc++ is required to build plugins against clang on OS X.
if CONFIG['HOST_OS_ARCH'] == 'Darwin':
    CXXFLAGS += ['-stdlib=libc++']
    LDFLAGS += ['-lc++']

DIRS += [
    'tests',
]


# In the current moz.build world, we need to override essentially every
# variable to limit ourselves to what we need to build the clang plugin.
if CONFIG['HOST_OS_ARCH'] == 'WINNT':
    extra_cxxflags = ['-GR-', '-EHsc']
else:
    extra_cxxflags = ['-fno-rtti', '-fno-exceptions']

if CONFIG['LLVM_CXXFLAGS']:
    COMPILE_FLAGS['OS_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags

COMPILE_FLAGS['CLANG_PLUGIN'] = []
COMPILE_FLAGS['OPTIMIZE'] = []
COMPILE_FLAGS['DEBUG'] = []
COMPILE_FLAGS['OS_COMPILE_CXXFLAGS'] = []

LINK_FLAGS['OS'] = CONFIG['LLVM_LDFLAGS'] + CONFIG['CLANG_LDFLAGS']
# The ldflags above override most other categories.
for var in ('LINKER', 'OPTIMIZE'):
    LINK_FLAGS[var] = []

if CONFIG['HOST_OS_ARCH'] == 'Linux' and CONFIG['OS_ARCH'] == 'Darwin':
    # Don't pass OSX linker arguments.
    LINK_FLAGS['FIX_LINK_PATHS'] = []