-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
40 lines (31 loc) · 1.62 KB
/
Makefile
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
28
29
30
31
32
33
34
35
36
37
38
39
40
# author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2024, deadc0de6
GOBIN=$(shell pwd)/bin
BIN=$(GOBIN)/gocatcli
RELEASES=dist/
CGO=0
GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
GITCOMMIT=$(shell git rev-parse --short HEAD)
SRC="./cmd/gocatcli"
INSTALL_FLAG=-v -ldflags "-s -w"
all: build
build:
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(INSTALL_FLAG) -o $(BIN) $(SRC)
build-linux:
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=linux GOARCH=arm go build $(INSTALL_FLAG) -o $(BIN)-linux-arm $(SRC)
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=linux GOARCH=arm64 go build $(INSTALL_FLAG) -o $(BIN)-linux-arm64 $(SRC)
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=linux GOARCH=386 go build $(INSTALL_FLAG) -o $(BIN)-linux-386 $(SRC)
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=linux GOARCH=amd64 go build $(INSTALL_FLAG) -o $(BIN)-linux-amd64 $(SRC)
build-windows:
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=windows GOARCH=arm go build $(INSTALL_FLAG) -o $(BIN)-windows-arm $(SRC)
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=windows GOARCH=386 go build $(INSTALL_FLAG) -o $(BIN)-windows-386 $(SRC)
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=windows GOARCH=amd64 go build $(INSTALL_FLAG) -o $(BIN)-windows-amd64 $(SRC)
build-darwin:
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=darwin GOARCH=amd64 go build $(INSTALL_FLAG) -o $(BIN)-darwin-amd64 $(SRC)
CGO_ENABLED=$(CGO) GO111MODULE=on GOOS=darwin GOARCH=arm64 go build $(INSTALL_FLAG) -o $(BIN)-darwin-arm64 $(SRC)
build-all: build-linux build-windows build-darwin
clean:
@rm -rf $(GOBIN)
@rm -rf $(RELEASES)
.PHONY: build build-linux build-windows build-darwin clean all