[GN]: BUILD file housecleaning

+ Turn on precompiled headers on Mac.
+ Change the toolchains to use asmflags instead of cflags and cflags_c.
+ Remove a TODO to hardcode the Mac SDK since the location of the SDK is not always guaranteed (on bots, for example).
+ GN: .S or .asm files no longer trigger cflags or cflags_c to be written to the ninja file.

BUG=none

Review URL: https://codereview.chromium.org/1368223002

Cr-Original-Commit-Position: refs/heads/master@{#351202}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7a73be6eb4963662a1e9455dcdab0d5130324901
This commit is contained in:
andybons 2015-09-28 16:35:17 -07:00 коммит произвёл Commit bot
Родитель 4fd8860b95
Коммит 209832333a
9 изменённых файлов: 38 добавлений и 31 удалений

Просмотреть файл

@ -449,9 +449,7 @@ config("precompiled_headers") {
# then delete the precompile.c.obj file, then build again.
cflags_c = [ "/wd4206" ]
} else if (is_mac && !is_official_build && !use_goma) {
# TODO(andybons): enable this when GCC PCH support in the binary has been
# rolled.
#precompiled_header = "build/precompile.h"
#precompiled_source = "//build/precompile.h"
precompiled_header = "build/precompile.h"
precompiled_source = "//build/precompile.h"
}
}

Просмотреть файл

@ -115,6 +115,10 @@ config("compiler") {
abi_target,
]
}
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler.
asmflags = cflags
}
# This is included by reference in the //build/config/compiler:runtime_library
@ -194,6 +198,7 @@ config("runtime_library") {
config("sdk") {
if (sysroot != "") {
cflags = [ "--sysroot=" + sysroot ]
asmflags = [ "--sysroot=" + sysroot ]
ldflags = [ "--sysroot=" + sysroot ]
# Need to get some linker flags out of the sysroot.
@ -209,6 +214,7 @@ config("sdk") {
config("executable_config") {
cflags = [ "-fPIE" ]
asmflags = [ "-fPIE" ]
ldflags = [ "-pie" ]
}

Просмотреть файл

@ -93,6 +93,7 @@ config("default_include_dirs") {
# where stuff should go. Put warning related stuff in the "warnings" config.
config("compiler") {
asmflags = []
cflags = []
cflags_c = []
cflags_cc = []
@ -453,11 +454,20 @@ config("compiler") {
# Pass the same C/C++ flags to the objective C/C++ compiler.
cflags_objc += cflags_c
cflags_objcc += cflags_cc
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler. The Windows assembler takes different types of flags
# so only do so for posix platforms.
if (is_posix) {
asmflags += cflags
asmflags += cflags_c
}
}
config("compiler_arm_fpu") {
if (current_cpu == "arm" && !is_ios && !is_nacl) {
cflags = [ "-mfpu=$arm_fpu" ]
asmflags = cflags
}
}
@ -806,6 +816,7 @@ config("no_chromium_code") {
"-Wno-deprecated",
]
}
cflags += default_warning_flags
cflags_cc += default_warning_flags_cc
}
@ -1083,6 +1094,7 @@ config("symbols") {
if (use_debug_fission) {
cflags += [ "-gsplit-dwarf" ]
}
asmflags = cflags
ldflags = []
}
}
@ -1105,6 +1117,7 @@ config("minimal_symbols") {
if (use_debug_fission) {
cflags += [ "-gsplit-dwarf" ]
}
asmflags = cflags
ldflags = []
}
}
@ -1113,6 +1126,7 @@ config("minimal_symbols") {
config("no_symbols") {
if (!is_win) {
cflags = [ "-g0" ]
asmflags = cflags
}
}

Просмотреть файл

@ -12,6 +12,7 @@ config("sdk") {
"-mmacosx-version-min=$mac_deployment_target",
]
asmflags = common_flags
cflags = common_flags
ldflags = common_flags
}

Просмотреть файл

@ -34,11 +34,5 @@ find_sdk_lines =
exec_script("//build/mac/find_sdk.py", find_sdk_args, "list lines")
mac_sdk_version = find_sdk_lines[1]
if (mac_sdk_path == "") {
# TODO(brettw) http://crbug.com/335325 when everybody moves to XCode 5 we
# can remove the --print_sdk_path argument to find_sdk and instead just use
# the following two lines to get the path. Although it looks longer here, it
# saves forking a process in find_sdk.py so will be faster.
#mac_sdk_root = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX"
#mac_sdk_path = mac_sdk_root + mac_sdk_version + ".sdk"
mac_sdk_path = find_sdk_lines[0]
}

Просмотреть файл

@ -12,6 +12,14 @@ assert(is_win)
# is applied to all targets. It is here to separate out the logic that is
# Windows-only.
config("compiler") {
asmflags = [
# When /SAFESEH is specified, the linker will only produce an image if it
# can also produce a table of the image's safe exception handlers. This
# table specifies for the operating system which exception handlers are
# valid for the image.
"/SAFESEH",
]
cflags = [
"/Gy", # Enable function-level linking.
"/GS", # Enable buffer security checking.

Просмотреть файл

@ -194,7 +194,7 @@ template("gcc_toolchain") {
tool("asm") {
# For GCC we can just use the C compiler to compile assembly.
depfile = "{{output}}.d"
command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "ASM {{output}}"
outputs = [

Просмотреть файл

@ -50,10 +50,7 @@ template("mac_toolchain") {
tool("cc") {
depfile = "{{output}}.d"
# TODO(andybons): enable this when GCC PCH support in the binary has been
# rolled.
#precompiled_header_type = "gcc"
precompiled_header_type = "gcc"
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "CC {{output}}"
@ -64,10 +61,7 @@ template("mac_toolchain") {
tool("cxx") {
depfile = "{{output}}.d"
# TODO(andybons): enable this when GCC PCH support in the binary has been
# rolled.
#precompiled_header_type = "gcc"
precompiled_header_type = "gcc"
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "CXX {{output}}"
@ -79,7 +73,7 @@ template("mac_toolchain") {
tool("asm") {
# For GCC we can just use the C compiler to compile assembly.
depfile = "{{output}}.d"
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "ASM {{output}}"
outputs = [
@ -90,10 +84,7 @@ template("mac_toolchain") {
tool("objc") {
depfile = "{{output}}.d"
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objc}} -c {{source}} -o {{output}}"
# TODO(andybons): enable this when GCC PCH support in the binary has been
# rolled.
#precompiled_header_type = "gcc"
precompiled_header_type = "gcc"
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "OBJC {{output}}"
@ -105,10 +96,7 @@ template("mac_toolchain") {
tool("objcxx") {
depfile = "{{output}}.d"
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objcc}} -c {{source}} -o {{output}}"
# TODO(andybons): enable this when GCC PCH support in the binary has been
# rolled.
#precompiled_header_type = "gcc"
precompiled_header_type = "gcc"
depsformat = "gcc"
description = "OBJCXX {{output}}"
outputs = [

Просмотреть файл

@ -120,9 +120,7 @@ template("msvc_toolchain") {
}
tool("asm") {
# TODO(brettw): "/safeseh" assembler argument is hardcoded here. Extract
# assembler flags to a variable like cflags. crbug.com/418613
command = "$python_path gyp-win-tool asm-wrapper $env ml.exe {{defines}} {{include_dirs}} /safeseh /c /Fo {{output}} {{source}}"
command = "$python_path gyp-win-tool asm-wrapper $env ml.exe {{defines}} {{include_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}"
description = "ASM {{output}}"
outputs = [
"{{target_out_dir}}/{{target_output_name}}/{{source_name_part}}.obj",