-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (31 loc) · 890 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
usage:
@echo "Please specify a task:"
@awk -F: '/^[^\t#.$$]+:[^=]+?$$/ {print "-",$$1}' Makefile
name := rich-presence
bin := ./bin/$(name)
version := $(shell grep -Eo 'version = "[^"]+"' main.go | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
ifdef WSL_DISTRO_NAME
export GOOS := windows
bin := $(bin).exe
endif
.PHONY: build
build: $(bin)
$(bin): $(shell find . -name '*.go')
go build -o $(bin) main.go
serve: $(bin)
$(bin) serve
clean:
rm -rf bin
# release process:
# 1. update version in main.go
# 2. commit all the changes
# 3. run this task
release: clean
@for os in linux windows; do\
if [ $$os = "windows" ]; then ext=".exe"; fi;\
out="bin/release/$(name)-$$os-amd64$$ext";\
echo "Building $$out";\
GOOS=$$os GOARCH=amd64 CGO_ENABLED=0 go build -ldflags='-w -s' -o $$out main.go;\
done
upx -5 bin/release/*
gh release create v$(version) bin/release/* --generate-notes