Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: retrigger external builds when CFLAGS/CXXFLAGS changes. #2534

Merged
merged 2 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def envoy_dependencies(path = "@envoy_deps//", skip_targets = []):
environ = [
"CC",
"CXX",
"CFLAGS",
"CXXFLAGS",
"LD_LIBRARY_PATH"
],
# Don't pretend we're in the sandbox, we do some evil stuff with envoy_dep_cache.
Expand Down
14 changes: 13 additions & 1 deletion ci/build_container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ CXXFLAGS ?= -ggdb3 -fno-omit-frame-pointer -O2
CFLAGS ?= -ggdb3 -fno-omit-frame-pointer -O2
CPPFLAGS ?= -DNDEBUG

# Keep track of the env vars we depend upon for $(THIRDPARTY_DEPS)/%.dep.env. If the list (captured
# above) of flags changes, this should be updated.
ENV_STR := $(CC) $(CXX) $(CXXFLAGS) $(CFLAGS) $(CPPFLAGS)

# If $(BUILD_DISTINCT) is set in the make environment, the artifacts are built and installed in
# distinct directories under $(THIRDPARTY_BUILD) and $(THIRDPARTY_SRC). They end up looking like
# $(THIRDPARTY_BUILD)/protobuf.dep/include, etc. instead of all being under
Expand Down Expand Up @@ -47,7 +51,15 @@ build-recipe = cd "$(THIRDPARTY_SRC)" && \
bash -c "time $(CURDIR)/recipe_wrapper.sh $(realpath $<)" 2>&1) > [email protected]) || (cat [email protected]; exit 1)) && \
$(build-complete)

$(THIRDPARTY_DEPS)/%.dep: $(RECIPES)/%.sh
# Simplify wildcard phony with FORCE target.
.PHONY: FORCE
FORCE:

# Capture $(ENV_STR) deps to retrigger build when they change.
$(THIRDPARTY_DEPS)/%.dep.env: FORCE
@[ "$(cat $@)" != "$(ENV_STR)" ] && echo "$(ENV_STR)" > $@

$(THIRDPARTY_DEPS)/%.dep: $(RECIPES)/%.sh $(THIRDPARTY_DEPS)/%.dep.env
@+$(call build-recipe,)

# Special support for targets that need protobuf, and hence take a dependency on protobuf.dep.
Expand Down