about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2020-05-08 01:13:31 -0400
committerBen Morrison <ben@gbmor.dev>2020-05-08 01:13:31 -0400
commit01b6a93f2cfc8b6dd54045c726d87dedcbf9ccc7 (patch)
tree0474d54c29b5a3644404d690ae1939593ef86333
parente6ce5f3caaeeaebe2fce89a837c0d81d4d000fae (diff)
downloadapi-01b6a93f2cfc8b6dd54045c726d87dedcbf9ccc7.tar.gz
added makefile
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5024d8e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+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 and module caches..."
+	go clean
+	go clean -cache -modcache
+	@printf "\n%s\n\n" "...Done!"
+
+.PHONY: update
+update:
+	@printf "\n%s\n\n" "Updating from upstream repository..."
+	git pull --rebase origin master
+	@printf "\n%s\n\n" "...Done!"
+
+.PHONY: install
+install:
+	@printf "\n%s\n\n%s\n" "Installing ..." "Creating Directories ..."
+	mkdir -p $(BINDIR)/web
+	@printf "\n%s\n" "Copying files..."
+	install -m755 api $(BINDIR)
+	install -m644 web/* $(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!"