aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 42310156c9fe36393a9a5d86a9190f648ea46354 (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
GO=go
GOFLAGS=-mod=vendor
PREFIX=/usr/local
BINPATH=$(PREFIX)/bin
SHAREPATH=$(PREFIX)/share/bloat

TMPL=templates/*.tmpl
SRC=main.go		\
	config/*.go 	\
	mastodon/*.go	\
	model/*.go	\
	renderer/*.go 	\
	repo/*.go 	\
	service/*.go 	\
	util/*.go 	\

all: bloat bloat.def.conf

bloat: $(SRC) $(TMPL)
	$(GO) build $(GOFLAGS) -o bloat main.go

bloat.def.conf:
	sed -e "s%=database%=/var/bloat%g" \
		-e "s%=templates%=$(SHAREPATH)/templates%g" \
		-e "s%=static%=$(SHAREPATH)/static%g" \
		< bloat.conf > bloat.def.conf

install: bloat
	mkdir -p $(DESTDIR)$(BINPATH) \
		$(DESTDIR)$(SHAREPATH)/templates \
		$(DESTDIR)$(SHAREPATH)/static
	cp bloat $(DESTDIR)$(BINPATH)/bloat
	chmod 0755 $(DESTDIR)$(BINPATH)/bloat
	cp -r templates/* $(DESTDIR)$(SHAREPATH)/templates
	chmod 0644 $(DESTDIR)$(SHAREPATH)/templates/*
	cp -r static/* $(DESTDIR)$(SHAREPATH)/static
	chmod 0644 $(DESTDIR)$(SHAREPATH)/static/*

uninstall:
	rm -f $(DESTDIR)$(BINPATH)/bloat
	rm -fr $(DESTDIR)$(SHAREPATH)

clean: 
	rm -f bloat
	rm -f bloat.def.conf