Skip to content

Commit

Permalink
make: Introduce run-binary and release targets
Browse files Browse the repository at this point in the history
- Now there are multiple ways to run tdiscuss for iterative development!
- `make build` does a development build
- `make release` handles the versioned build

Change-Id: I18439f60e8a4d21858a6ea97ea373cc4e6796e40
Signed-off-by: Ian Meyer <[email protected]>
  • Loading branch information
imeyer committed Sep 17, 2024
1 parent 757cd03 commit 5f7b90c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ TARGET := tdiscuss-$(PLATFORM)-$(ARCH)

# Bazel build command
BAZEL := bazelisk
BAZEL_BUILD_ARGS := build --config=silent --stamp --workspace_status_command="$${PWD}/status.sh"
BAZEL_BUILD_ARGS := build --config=silent --workspace_status_command="$${PWD}/status.sh"
BAZEL_RELEASE_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
BAZEL_RUN_TRAILING_ARGS := -hostname discuss-dev

.PHONY: all clean

all: build
all: test build

build:
@echo "Building for $(PLATFORM)-$(ARCH)"
Expand All @@ -42,8 +43,16 @@ test:
$(BAZEL) $(BAZEL_TEST_ARGS) //...

run:
@echo "Running for $(PLATFORM)-$(ARCH)"
$(BAZEL) $(BAZEL_RUN_ARGS) //:$(TARGET) $(BAZEL_RUN_TRAILING_ARGS)
@echo "Running for $(PLATFORM)-$(ARCH) from $(BAZEL)"
$(BAZEL) $(BAZEL_RUN_ARGS) //:$(TARGET) -- $(BAZEL_RUN_TRAILING_ARGS)

run-binary:
@echo "Running for $(PLATFORM)-$(ARCH) from $(shell $(BAZEL) info bazel-bin)"
$(shell $(BAZEL) info bazel-bin)/$(TARGET)_/$(TARGET) $(BAZEL_RUN_TRAILING_ARGS)

release:
@echo "Building release for $(PLATFORM)-$(ARCH)"
$(BAZEL) $(BAZEL_RELEASE_ARGS) //:$(TARGET)

clean:
$(BAZEL) clean

0 comments on commit 5f7b90c

Please sign in to comment.