Skip to content

Commit

Permalink
chore(make): reuse variables (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocnc authored Aug 29, 2024
1 parent 8b706f4 commit 2cc8a07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/make -f

include build/scripts/build.mk
include build/scripts/build.mk
include build/scripts/codegen.mk
include build/scripts/constants.mk
include build/scripts/devtools.mk
include build/scripts/devtools.mk
include build/scripts/linting.mk
include build/scripts/protobuf.mk
include build/scripts/release.mk
include build/scripts/testing.mk
include contracts/Makefile
include contracts/Makefile
include kurtosis/Makefile
include build/scripts/help.mk
include testing/forge-script/Makefile
Expand Down
17 changes: 9 additions & 8 deletions build/scripts/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ COMMIT = $(shell git log -1 --format='%H')
CURRENT_DIR = $(shell pwd)
OUT_DIR ?= $(CURDIR)/build/bin
BINDIR ?= $(GOPATH)/build/bin
TESTAPP_DIR = beacond
TESTNAME = beacon
TESTAPP = beacond
TESTAPP_FILES_DIR = testing/files
TESTAPP_CMD_DIR = $(TESTAPP_DIR)/cmd
TESTAPP_CMD_DIR = $(TESTAPP)/cmd
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)

# process build tags
Expand Down Expand Up @@ -53,8 +54,8 @@ comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=beacon \
-X github.com/cosmos/cosmos-sdk/version.AppName=beacond \
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(TESTNAME) \
-X github.com/cosmos/cosmos-sdk/version.AppName=$(TESTAPP) \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
Expand All @@ -70,7 +71,7 @@ build_tags += $(BUILD_TAGS)
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
# check for nostrip option
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
BUILD_FLAGS += -trimpath
endif

# Check for debug option
Expand All @@ -82,7 +83,7 @@ endif
BUILD_TARGETS := build install

## Build:
build: BUILD_ARGS=-o $(OUT_DIR)/beacond ## build `beacond`
build: BUILD_ARGS=-o $(OUT_DIR)/$(TESTAPP) ## build `beacond`

$(BUILD_TARGETS): $(OUT_DIR)/
@echo "Building ${TESTAPP_CMD_DIR}"
Expand All @@ -91,12 +92,12 @@ $(BUILD_TARGETS): $(OUT_DIR)/
$(OUT_DIR)/:
mkdir -p $(OUT_DIR)/

# Variables
# Variables
ARCH ?= $(shell uname -m)
ifeq ($(ARCH),)
ARCH = arm64
endif
IMAGE_NAME ?= beacond
IMAGE_NAME ?= $(TESTAPP)

# Docker Paths
DOCKERFILE = ./Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/testing.mk
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ test-unit: ## run golang unit tests
test-unit-cover: ## run golang unit tests with coverage
@echo "Running unit tests with coverage..."
@go list -f '{{.Dir}}/...' -m | xargs \
go test -race -coverprofile=test-unit-cover.txt
go test -race -coverprofile=test-unit-cover.txt

test-unit-bench: ## run golang unit benchmarks
@echo "Running unit tests with benchmarks..."
Expand Down

0 comments on commit 2cc8a07

Please sign in to comment.