forked from megaease/easeprobe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (29 loc) · 879 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
SHELL:=/bin/sh
.PHONY: all build test clean
export GO111MODULE=on
# Path Related
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(MKFILE_PATH))
RELEASE_DIR := ${MKFILE_DIR}/build/bin
# Version
RELEASE?=v0.1.0
# Git Related
GIT_REPO_INFO=$(shell cd ${MKFILE_DIR} && git config --get remote.origin.url)
ifndef GIT_COMMIT
GIT_COMMIT := git-$(shell git rev-parse --short HEAD)
endif
# go source files, ignore vendor directory
SOURCE = $(shell find ${MKFILE_DIR} -type f -name "*.go")
TARGET = ${RELEASE_DIR}/easeprobe
all: ${TARGET}
${TARGET}: ${SOURCE}
mkdir -p ${RELEASE_DIR}
go mod tidy
go build -gcflags=-G=3 -o ${TARGET} ${MKFILE_DIR}/cmd/easeprobe
build: all
test:
go test -race -count=1 ./...
docker:
sudo docker build -t megaease/easeprobe -f ${MKFILE_DIR}/resources/Dockerfile ${MKFILE_DIR}
clean:
@rm -rf ${MKFILE_DIR}/build