-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I62b7710cdfdfdba7212b59b61c05363a7a673545 Signed-off-by: Ian Meyer <[email protected]>
- Loading branch information
Showing
1 changed file
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,49 @@ | ||
# Detect OS | ||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Darwin) | ||
PLATFORM := darwin | ||
PLATFORM := darwin | ||
else ifeq ($(UNAME_S),Linux) | ||
PLATFORM := linux | ||
PLATFORM := linux | ||
else | ||
$(error Unsupported platform: $(UNAME_S)) | ||
$(error Unsupported platform: $(UNAME_S)) | ||
endif | ||
|
||
# Detect architecture | ||
UNAME_M := $(shell uname -m) | ||
ifeq ($(UNAME_M),arm64) | ||
ARCH := arm64 | ||
ARCH := arm64 | ||
else ifeq ($(UNAME_M),x86_64) | ||
ARCH := amd64 | ||
ARCH := amd64 | ||
else | ||
$(error Unsupported architecture: $(UNAME_M)) | ||
$(error Unsupported architecture: $(UNAME_M)) | ||
endif | ||
|
||
# Combine platform and architecture | ||
TARGET := tdiscuss-$(PLATFORM)-$(ARCH) | ||
|
||
# Bazel build command | ||
BAZEL := bazelisk | ||
BAZEL_ARGS := build --stamp --workspace_status_command="$${PWD}/status.sh" | ||
BAZEL_BUILD_ARGS := build --config=silent --stamp --workspace_status_command="$${PWD}/status.sh" | ||
BAZEL_TEST_ARGS := test --config=silent --build_tests_only --test_output=errors | ||
BAZEL_RUN_ARGS := run | ||
# Change the hostname to anything you wish to use for testing | ||
BAZEL_RUN_TRAILING_ARGS := -- -hostname discuss-dev | ||
|
||
.PHONY: all clean | ||
|
||
all: build | ||
|
||
build: | ||
@echo "Building for $(PLATFORM)-$(ARCH)" | ||
$(BAZEL) $(BAZEL_ARGS) //:$(TARGET) | ||
$(BAZEL) $(BAZEL_BUILD_ARGS) //:$(TARGET) | ||
|
||
test: | ||
@echo "Testing all targets" | ||
$(BAZEL) $(BAZEL_TEST_ARGS) //... | ||
|
||
run: | ||
@echo "Running for $(PLATFORM)-$(ARCH)" | ||
$(BAZEL) $(BAZEL_RUN_ARGS) //:$(TARGET) $(BAZEL_RUN_TRAILING_ARGS) | ||
|
||
clean: | ||
$(BAZEL) clean |