Skip to content

Commit d8b302b

Browse files
authored
Merge pull request #39 from blinklabs-io/chore/compile-static
chore: compile static
2 parents 6264959 + 75d52ad commit d8b302b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,24 @@ ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
66
# Gather all .go files for use in dependencies below
77
GO_FILES=$(shell find $(ROOT_DIR) -name '*.go')
88

9-
mod-tidy:
10-
go mod tidy
11-
12-
# Build our program binary
13-
# Depends on GO_FILES to determine when rebuild is needed
14-
$(BINARY): mod-tidy $(GO_FILES)
15-
# Needed to fetch new dependencies and add them to go.mod
16-
go build -o $(BINARY) ./cmd/$(BINARY)
9+
GO_LDFLAGS=-ldflags "-s -w"
1710

1811
.PHONY: build image mod-tidy
1912

2013
# Alias for building program binary
2114
build: $(BINARY)
2215

16+
# Build our program binary
17+
# Depends on GO_FILES to determine when rebuild is needed
18+
$(BINARY): mod-tidy $(GO_FILES)
19+
CGO_ENABLED=0 go build \
20+
$(GO_LDFLAGS) \
21+
-o $(BINARY) \
22+
./cmd/$(BINARY)
23+
24+
mod-tidy:
25+
go mod tidy
26+
2327
# Build docker image
2428
image: build
2529
docker build -t $(BINARY) .

0 commit comments

Comments
 (0)