-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
33 lines (27 loc) · 892 Bytes
/
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
VERSION := $(shell git describe --abbrev=0)
COMMIT_REVISION := $(shell git log --pretty=%h -1)
REVISION_FLAG := "-X github.com/lintingzhen/commitizen-go/cmd.revision=${COMMIT_REVISION} -X github.com/lintingzhen/commitizen-go/cmd.version=${VERSION}"
TARGET := commitizen-go
GOFILES := $(wildcard *.go) $(wildcard cmd/*.go) $(wildcard git/*.go) $(wildcard commit/*.go)
GOARCH := $(shell go env GOARCH)
ifeq ($(OS),Windows_NT)
GOOS := windows
COPY := copy
else
COPY := cp
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
GOOS := linux
else ifeq ($(UNAME_S),Darwin)
GOOS := darwin
endif
endif
GIT_EXEC_PATH := $(shell git --exec-path)
all: ${TARGET}
install:
$(COPY) commitizen-go $(GIT_EXEC_PATH)/git-cz
clean:
rm -rf ${TARGET}
commitizen-go: $(GOFILES)
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -o $@ -ldflags ${REVISION_FLAG}
.PHONY: all install clean