-
Notifications
You must be signed in to change notification settings - Fork 34
/
Makefile
36 lines (27 loc) · 815 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
#https://gqlxj1987.github.io/2018/08/14/good-makefile-golang/
include .env
PROJECT=socks5lb
VERSION=$(shell date +%Y%m%d)
COMMIT_HASH=$(shell git rev-parse --short HEAD)
SRC=./cmd/$(PROJECT)
BINARY=$(PROJECT)
GO=$(shell which go)
GO_FLAGS=-ldflags="\
-X 'github.com/mingcheng/socks5lb.Version=$(VERSION)' \
-X 'github.com/mingcheng/socks5lb.BuildCommit=$(COMMIT_HASH)' \
-X 'github.com/mingcheng/socks5lb.BuildDate=$(shell date)'"
# Make is verbose in Linux. Make it silent.
MAKEFLAGS += --silent
all: build
build: $(SRC)
@$(GO) build $(GO_FLAGS) -o ${BINARY} $(SRC)
test:
@go test -v ./...
docker_image_build:
@docker-compose build
docker_image_push: docker_image_build
@docker-compose push
clean:
@$(GO) clean ./...
@rm $(BINARY)
.PHONY: install test clean docker_image_build docker_image_push