about summary refs log tree commit diff stats
path: root/Makefile
blob: 1b244bf2f8dcba9197495667b140310c44ef3048 (plain) (blame)
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
PREFIX?=/var/www
_INSTDIR=$(PREFIX)
BINDIR?=$(_INSTDIR)/api

api: main.go go.mod
	@printf "\n%s\n\n" "Building tilde.institute API"
	go build -o $@
	@printf "\n%s\n\n" "...Done!"

.PHONY: clean
clean:
	@printf "\n%s\n\n" "Cleaning build artifacts..."
	go clean
	@printf "\n%s\n\n" "...Done!"

.PHONY: install
install:
	@printf "\n%s\n\n%s\n" "Installing ..." "Creating Directories ..."
	mkdir -p $(BINDIR)/static
	@printf "\n%s\n" "Copying files..."
	install -m755 api $(BINDIR)
	install -m644 static/* $(BINDIR)
	@printf "\n%s\n" "Setting ownership..."
	chown -R www:www $(BINDIR)
	@printf "\n%s\n\n" "...Done!"

.PHONY: uninstall
uninstall:
	@printf "\n%s\n\n" "Removing files..."
	rm -rf $(BINDIR)
	@printf "\n%s\n\n" "...Done!"