-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (34 loc) · 1.14 KB
/
Makefile
File metadata and controls
38 lines (34 loc) · 1.14 KB
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
# config
bindir = ./bin
releaseDir = ./release
mainFile = ./main.go
# var
make_dir:=$(shell pwd)
app_name:=$(shell basename $(make_dir))
version=$(shell git describe --tags --always)
## build: Builds the project
.PHONY: build
build:
GOOS=linux GOARCH=amd64 go build -o $(bindir)/$(app_name).linux $(mainFile)
GOOS=darwin GOARCH=amd64 go build -o $(bindir)/$(app_name).darwin $(mainFile)
GOOS=windows GOARCH=amd64 go build -o $(bindir)/$(app_name).exe $(mainFile)
## release: Builds the project for release
.PHONY: release
release: clean build
tar -zcvf $(releaseDir)/$(app_name)-linux-$(version).tar.gz $(bindir)/$(app_name).linux
tar -zcvf $(releaseDir)/$(app_name)-darwin-$(version).tar.gz $(bindir)/$(app_name).darwin
tar -zcvf $(releaseDir)/$(app_name)-exe-$(version).tar.gz $(bindir)/$(app_name).exe
git tag -d $(version)
## clean: Cleans the project
.PHONY: clean
clean:
rm -rf $(bindir)/*
rm -rf $(releaseDir)/*
rm -rf images/*
go clean
## help: Show this help info.
.PHONY: help
help: Makefile
@printf "\nUsage: make <TARGETS> <OPTIONS> ...\n\nTargets:\n"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo "$$USAGE_OPTIONS