Skip to content

Commit

Permalink
Use processor instead of sed.
Browse files Browse the repository at this point in the history
Bazel only applies the preprocessor to .S files, not .asm files.
  • Loading branch information
drigz committed Sep 26, 2019
1 parent a83197e commit df90835
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions BUILD.boost
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_library", "hdr_list", "includes_list")

_w_no_deprecated = select({
Expand Down Expand Up @@ -82,17 +83,11 @@ config_setting(
visibility = ["//visibility:public"],
)

# TODO(https://github.com/bazelbuild/bazel-skylib/issues/191): use
# expand_template instead of `sed`.
[genrule(
name = "clean_%s_asm" % name,
outs = [
"libs/context/src/asm/%s_x86_64_ms_pe_masm_clean.asm" % name,
],
cmd = "sed 's/BOOST_CONTEXT_EXPORT//' $< > $@",
srcs = [
"libs/context/src/asm/%s_x86_64_ms_pe_masm.asm" % name,
],
# Rename .asm to .S so that it will be handled with the C preprocessor.
[copy_file(
name = "rename_%s" % name,
src = "libs/context/src/asm/%s_x86_64_ms_pe_masm.asm" % name,
out = "libs/context/src/asm/%s_x86_64_ms_pe_masm.S" % name,
) for name in ["make", "jump", "ontop"]]

BOOST_CTX_ASM_SOURCES = select({
Expand All @@ -112,9 +107,9 @@ BOOST_CTX_ASM_SOURCES = select({
"libs/context/src/asm/ontop_x86_64_sysv_macho_gas.S",
],
":windows_x86_64": [
"libs/context/src/asm/make_x86_64_ms_pe_masm_clean.asm",
"libs/context/src/asm/jump_x86_64_ms_pe_masm_clean.asm",
"libs/context/src/asm/ontop_x86_64_ms_pe_masm_clean.asm",
"libs/context/src/asm/make_x86_64_ms_pe_masm.S",
"libs/context/src/asm/jump_x86_64_ms_pe_masm.S",
"libs/context/src/asm/ontop_x86_64_ms_pe_masm.S",
],
})

Expand All @@ -136,6 +131,10 @@ boost_library(
"libs/context/src/untested.cpp",
"libs/context/src/continuation.cpp",
],
copts = select({
":windows_x86_64": ["/DBOOST_CONTEXT_EXPORT="],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = [
":assert",
Expand Down

0 comments on commit df90835

Please sign in to comment.