-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.Makefile
More file actions
27 lines (19 loc) · 715 Bytes
/
go.Makefile
File metadata and controls
27 lines (19 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# dubplate version: v0.10.1
OUTBIN ?= $(BUILD_DIR)/$(APP_NAME)
VERSION_VAR ?= main.version
LDFLAGS = -ldflags "-w -X $(VERSION_VAR)=$(VERSION)"
GOBUILD_FLAGS ?= -installsuffix cgo $(LDFLAGS) -o $(OUTBIN)
GOBUILD_ENVVARS ?= CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH)
GOBUILD_CMD ?= $(GOBUILD_ENVVARS) go build $(GOBUILD_FLAGS)
dummy:
@echo No default rule set yet
binary: $(BUILD_DIR)
$(GOBUILD_CMD) ./cmd/$(APP_NAME)
binaries: $(COMPONENTS:=-binary)
$(COMPONENTS:=-binary):
$(MAKE) binary \
APP_NAME=$(@:-binary=)
test-binary-version-output: VERSION_CMD ?= $(OUTBIN) version
test-binary-version-output:
@echo testing output of $(VERSION_CMD)
test "$(shell $(VERSION_CMD))" = "$(VERSION)" && echo PASSED