summaryrefslogtreecommitdiff
path: root/Makefile
blob: e258995e34098d6761e5f7e7d760e523a4b7fa23 (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
# vim: shiftwidth=4 tabstop=4 noexpandtab

DESTDIR=""  # leave empty for the current system or provide a fakeroot here
PREFIX="/usr"
PROGRAM="webiot"

.PHONY: all clean install debug

all:
	# some recommended options for Go building:
	# https://wiki.archlinux.org/title/Go_package_guidelines
	mkdir -p build
	go build -o build/$(PROGRAM) main.go hs100.go

clean:
	rm -rf build

install: all
	install -Dm 755 build/$(PROGRAM) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM)
	install -Dm 644 config.json $(DESTDIR)/etc/$(PROGRAM)/config.json
	install -Dm 644 index.html.tmpl $(DESTDIR)$(PREFIX)/share/$(PROGRAM)/index.html.tmpl
	install -Dm 644 libweb/libweb.css $(DESTDIR)$(PREFIX)/share/$(PROGRAM)/webiot.css
	install -Dm 644 systemd/$(PROGRAM).service $(DESTDIR)$(PREFIX)/lib/systemd/system/$(PROGRAM).service
	install -Dm 644 systemd/$(PROGRAM).sysusers $(DESTDIR)$(PREFIX)/lib/sysusers.d/$(PROGRAM).conf

debug:
	go run main.go hs100.go -c private/config.json