-
-
Notifications
You must be signed in to change notification settings - Fork 127
/
Makefile
40 lines (32 loc) · 1.73 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
.PHONY: default help contribute add-tool distribute-readme clean
SHELL = /bin/bash
APP_NAME = MobileHackersWeapons
ADD_TOOL = add-tool
DISTRIBUTE_README = distribute-readme
VERSION = $(shell git describe --always --tags)
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
BUILD_DATE = $(shell date '+%Y-%m-%d-%H:%M:%S')
default: help
help:
@echo 'Management commands for ${APP_NAME}:'
@echo
@echo 'Usage:'
@echo ' make contribute Compile ${ADD_TOOL} & ${DISTRIBUTE_README}.'
@echo ' make add-tool Build ${ADD_TOOL}'
@echo ' make distribute-readme Build ${DISTRIBUTE_README}'
@echo ' make clean Clean the contribute file.'
@echo
contribute: add-tool distribute-readme
add-tool:
@echo "Build ${ADD_TOOL} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-w -X github.com/hahwul/MobileHackersWeapons/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/hahwul/MobileHackersWeapons/version.Version=${VERSION} -X github.com/hahwul/MobileHackersWeapons/version.BuildDate=${BUILD_DATE}" -o ./${ADD_TOOL} ./${ADD_TOOL}.go
distribute-readme:
@echo "Build ${ADD_TOOL} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-w -X github.com/hahwul/MobileHackersWeapons/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/hahwul/MobileHackersWeapons/version.Version=${VERSION} -X github.com/hahwul/MobileHackersWeapons/version.BuildDate=${BUILD_DATE}" -o ./${DISTRIBUTE_README} ./${DISTRIBUTE_README}.go
clean:
@echo "Removing ${APP_NAME} ${VERSION}"
@test ! -e ${ADD_TOOL} || rm ${ADD_TOOL}
@test ! -e ${DISTRIBUTE_README} || rm ${DISTRIBUTE_README}