-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
17 lines (14 loc) · 934 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
VERSION ?= v0.0.0-local
GO_VERSION ?= 1.19
GO_FILES := $(shell find ./* -iname '*.go')
GO_RUN := docker run --rm -e GO111MODULE=on -e CGO_ENABLED=0 -e VERSION=$(VERSION) -e HOME=/build/.cache -u $$(id -u $${USER}):$$(id -g $${USER}) -v $$PWD:/build -w /build golang:$(GO_VERSION)
.PHONY: build clean
build: bin/linux-amd64/sip-ping bin/windows-amd64/sip-ping.exe bin/darwin-amd64/sip-ping
bin/linux-amd64/sip-ping: $(GO_FILES)
$(GO_RUN) bash -c 'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=vendor -v -ldflags="-s -w" -o ./bin/linux-amd64/sip-ping'
bin/windows-amd64/sip-ping.exe: $(GO_FILES)
$(GO_RUN) bash -c 'CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -mod=vendor -v -ldflags="-s -w" -o ./bin/windows-amd64/sip-ping.exe'
bin/darwin-amd64/sip-ping: $(GO_FILES)
$(GO_RUN) bash -c 'CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -mod=vendor -v -ldflags="-s -w" -o ./bin/darwin-amd64/sip-ping'
clean:
rm -rf ./bin