summaryrefslogtreecommitdiff
path: root/Makefile
blob: 1c1720f72967d76515c1df664ee9cd113daf7118 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.PHONY: build

VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d)

all: build
	@echo "make build     # build"
	@echo "make clean     # clean build files"
	@echo "make run       # build and run on port 2233"
	@echo "make debian    # will build a debian package"
	@echo ""
	@echo "make restart   # restart the daemon"
	@echo "make enable    # enable daemon on boot"
	@echo "make log       # watch the daemon log"

build: goimports
	GO111MODULE=off go build \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

verbose:
	GO111MODULE=off go build -v -x \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

install:
	GO111MODULE=off go install \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

prod: build
	make stop
	cp gowebd /usr/bin/gowebd
	make start
	make log

log:
	@#systemctl status gowebd.service
	journalctl -f -xeu gowebd.service

enable:
	systemctl enable gowebd.service

restart:
	systemctl stop gowebd.service
	systemctl start gowebd.service

start:
	systemctl start gowebd.service

stop:
	systemctl stop gowebd.service

run: build
	./gowebd --port 2233 --repomap resources/repomap --hostname test.wit.com
	# setcap 'cap_net_bind_service=+ep' gowebd   # allow the binary to open ports below 1024

goimports:
	reset
	goimports -w *.go

clean:
	rm -f go.*
	rm -f go.wit.com
	rm -f gowebd
	go-mod-clean purge

# makes a .deb package
debian:
	rm ~/incoming/gowebd*.deb
	go-deb --no-gui --keep-files --repo go.wit.com/apps/gowebd

squash-the-last-3-commits-together:
	git rebase -i HEAD~3
	git fsck
	git prune