-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
41 lines (29 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
34
35
36
37
38
39
40
41
ROOT_DIR = $(CURDIR)
OUTPUT_DIR = $(ROOT_DIR)/_output
BIN_DIR = $(OUTPUT_DIR)/bin
REPO_PREFIX = yunion.io/x/git-tools
GO_BUILD := go build
CMDS := $(shell find $(ROOT_DIR)/cmd -mindepth 1 -maxdepth 1 -type d)
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
build: clean
@for CMD in $(CMDS); do \
echo build $$CMD; \
$(GO_BUILD) -o $(BIN_DIR)/`basename $${CMD}` $$CMD; \
done
prepare_dir:
@mkdir -p $(BIN_DIR)
test:
go test -v ./...
cmd/%: prepare_dir
$(GO_BUILD) -o $(BIN_DIR)/$(shell basename $@) $(REPO_PREFIX)/$@
clean:
@rm -rf $(BIN_DIR)
# @rm -rf $(OUTPUT_DIR)/changelog/release-*
gen:
./_output/bin/changelog-gen run -c ./config/changelog.yaml
gen-v36:
./_output/bin/changelog-gen run -c ./config/changelog-v36.yaml
%:
@:
.PHONY: build clean