summaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 1cae15d727f62780cc563b93dbffc2b24af6abb8 (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
DESTDIR=
DISTROS=debian8 debian9 ubuntu1604lts ubuntu1710
VERSION=$(shell dpkg-parsechangelog --show-field Version)

all:
	make -C src VERSION=$(VERSION)

install: all
	mkdir -p $(DESTDIR)/var/www/webbox
	cp -r html/* $(DESTDIR)/var/www/webbox/

	# Minify, conditionally
	command -v uglifyjs && uglifyjs html/webbox.js -m -c > $(DESTDIR)/var/www/webbox/webbox.js || true
	command -v htmlmin && \
		htmlmin html/index.html $(DESTDIR)/var/www/webbox/index.html || true
	command -v cleancss && cleancss -o $(DESTDIR)/var/www/webbox/webbox.css html/webbox.css || true

	mkdir -p $(DESTDIR)/usr/lib/webbox
	cp src/query $(DESTDIR)/usr/lib/webbox/


deploy: all
	sudo service apache2 stop
	sudo make install
	sudo service apache2 start

deb:
	# build binary deb package
	dpkg-buildpackage -us -uc -rfakeroot

deb-src:
	dpkg-source -b .

$(DISTROS): deb-src
	sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../webbox_$(VERSION).dsc ; \

debs: $(DISTROS)

clean:
	make -C src clean
	dh_clean

.PHONY: clean $(DISTROS)