Unverified Commit 4e951d2c authored by Vihang Mehta's avatar Vihang Mehta Committed by Copybara
Browse files

Cleanup the top level makefile

Summary: TSIA

Test Plan: Ran `make help`

Reviewers: zasgar, michelle

Reviewed By: michelle

Differential Revision: https://phab.corp.pixielabs.ai/D8463

GitOrigin-RevId: b8b8dc5c409122b324e61511056bfb3e2a3cfea5
parent aa4d76f6
Showing with 23 additions and 22 deletions
+23 -22
...@@ -21,42 +21,45 @@ ...@@ -21,42 +21,45 @@
## Bazel command to use. ## Bazel command to use.
BAZEL := bazel BAZEL := bazel
## Minikube command to use. # make-lazy converts a recursive variable, which is evaluated every time it's
MINIKUBE := minikube # referenced, to a lazy variable, which is evaluated only the first time it's
# used. See: http://blog.jgc.org/2016/07/lazy-gnu-make-variables.html
WORKSPACE := $$(bazel info workspace) override make-lazy = $(eval $1 = $$(eval $1 := $(value $1))$$($1))
## Skaffold command to use. # Color support.
SKAFFOLD := skaffold yellow = $(shell { tput setaf 3 || tput AF 3; } 2>/dev/null)
cyan = $(shell { tput setaf 6 || tput AF 6; } 2>/dev/null)
SKAFFOLD_DIR := $(WORKSPACE)/skaffold term-reset = $(shell { tput sgr0 || tput me; } 2>/dev/null)
$(call make-lazy,yellow)
$(call make-lazy,cyan)
$(call make-lazy,term-reset)
.PHONY: clean .PHONY: clean
clean: clean: ## Remove the bazel build directories.
$(BAZEL) clean $(BAZEL) clean
.PHONY: pristine .PHONY: pristine
pristine: pristine: ## Remove the bazel build directories and purge the build cache.
$(BAZEL) clean --expunge $(BAZEL) clean --expunge
.PHONY: build .PHONY: build
build: ## Run the full build (except UI). build: ## Run the full build.
$(BAZEL) build //... $(BAZEL) build //...
.PHONY: test .PHONY: test
test: ## Run all the tests (except UI). test: ## Run all the tests.
$(BAZEL) test //... ${BAZEL_TEST_EXTRA_ARGS} $(BAZEL) test //... ${BAZEL_TEST_EXTRA_ARGS}
.PHONY: test-opt .PHONY: test-opt
test-opt: ## Run all the tests (except UI), optimized build. test-opt: ## Run all the tests, optimized build.
$(BAZEL) test -c opt //... ${BAZEL_TEST_EXTRA_ARGS} $(BAZEL) test -c opt //... ${BAZEL_TEST_EXTRA_ARGS}
.PHONY: test-asan .PHONY: test-asan
test-asan: ## Run all the tests (except UI), with address sanitizer. test-asan: ## Run all the tests, with address sanitizer.
$(BAZEL) test --config=asan //... ${BAZEL_TEST_EXTRA_ARGS} $(BAZEL) test --config=asan //... ${BAZEL_TEST_EXTRA_ARGS}
.PHONY: test-tsan .PHONY: test-tsan
test-tsan: ## Run all the tests (except UI), with thread sanitizer. test-tsan: ## Run all the tests, with thread sanitizer.
$(BAZEL) test --config=tsan //... ${BAZEL_TEST_EXTRA_ARGS} $(BAZEL) test --config=tsan //... ${BAZEL_TEST_EXTRA_ARGS}
.PHONY: go-mod-tidy .PHONY: go-mod-tidy
...@@ -68,22 +71,22 @@ go-mod-ensure: ## Ensure that go dependencies exist. ...@@ -68,22 +71,22 @@ go-mod-ensure: ## Ensure that go dependencies exist.
go mod download go mod download
.PHONY: gazelle-repos .PHONY: gazelle-repos
gazelle-repos: go.mod gazelle-repos: go.mod ## Run gazelle and generate build rules for new deps in go.mod, and go.sum.
$(BAZEL) run //:gazelle -- update-repos -from_file=go.mod -prune -to_macro=go_deps.bzl%pl_go_dependencies $(BAZEL) run //:gazelle -- update-repos -from_file=go.mod -prune -to_macro=go_deps.bzl%pl_go_dependencies
.PHONY: gazelle .PHONY: gazelle
gazelle: gazelle-repos gazelle: gazelle-repos ## Run gazelle and autofix bazel dependencies for go targets.
$(BAZEL) run //:gazelle -- fix $(BAZEL) run //:gazelle -- fix
.PHONY: buildifier .PHONY: buildifier
buildifier: buildifier: ## Run bazel buildtools buildifier to format build files.
$(BAZEL) run //:buildifier $(BAZEL) run //:buildifier
.PHONY: go-setup .PHONY: go-setup
go-setup: go-mod-tidy go-mod-ensure gazelle ## Run go setup to regenrate modules/build files. go-setup: go-mod-tidy go-mod-ensure gazelle ## Run go setup to regenrate modules/build files.
dev-env-start: ## Start K8s dev environment. dev-env-start: ## Start K8s dev environment.
$(WORKSPACE)/scripts/setup_dev_k8s.sh ./scripts/setup_dev_k8s.sh
dev-env-stop: ## Stop dev environment. dev-env-stop: ## Stop dev environment.
$(MINIKUBE) stop $(MINIKUBE) stop
......
...@@ -27,8 +27,6 @@ if [ $# -ne 0 ]; then ...@@ -27,8 +27,6 @@ if [ $# -ne 0 ]; then
has_minikube_profile=true has_minikube_profile=true
fi fi
workspace=$(bazel info workspace)
profile_args_str="" profile_args_str=""
if [ "${has_minikube_profile}" = true ]; then if [ "${has_minikube_profile}" = true ]; then
profile_args_str="-p $profile" profile_args_str="-p $profile"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment