-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
47 lines (35 loc) · 1.38 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
41
42
43
44
45
46
TARGET_SYSTEM ?= $(OS)
EXT =
ifndef GOOS
ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
EXT =.exe
endif
else
ifeq ($(GOOS),windows)
EXT = .exe
endif
endif
GO_FLAGS ?=
NAME := typioca
OUTPUT_BIN ?= execs/$(NAME)$(ARCH)$(EXT)
PACKAGE := github.com/bloznelis/$(NAME)
GIT_REV = $(shell git rev-parse --short HEAD)
VERSION = $(shell git describe --abbrev=0 --tags)
default: help
build-win-amd: ## Builds the win-amd64 CLI
@env GOOS=windows GOARCH=amd64 ARCH=-win-amd64 make build
build-win-arm: ## Builds the win-arm64 CLI
@env GOOS=windows GOARCH=arm64 ARCH=-win-arm64 make build
build-mac-amd: ## Builds the mac-amd64 CLI
@env GOOS=darwin GOARCH=amd64 ARCH=-mac-amd64 make build
build-mac-arm: ## Builds the mac-arm64 CLI
@env GOOS=darwin GOARCH=arm64 ARCH=-mac-arm64 make build
build-linux-amd: ## Builds the linux-amd64 CLI
@env GOOS=linux GOARCH=amd64 ARCH=-linux-amd64 make build
build: ## Builds the CLI
@go build -trimpath ${GO_FLAGS} \
-ldflags "-w -s -X 'github.com/bloznelis/typioca/cmd.Version=${VERSION}'" \
-a -tags netgo -o ${OUTPUT_BIN}
build-all: build-win-amd build-win-arm build-mac-amd build-mac-arm build-linux-amd ## Builds execs for all architectures
help: ## This message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[38;5;69m%-30s\033[38;5;38m %s\033[0m\n", $$1, $$2}'