aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d76913d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/share/man
+
+VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
+
+.PHONY: all build install uninstall clean
+
+all: build
+
+build:
+ go build -ldflags "-X main.version=$(VERSION)" -o ssg
+
+install: build
+ install -d $(DESTDIR)$(BINDIR)
+ install -m 755 ssg $(DESTDIR)$(BINDIR)/
+ install -d $(DESTDIR)$(MANDIR)/man1
+ install -m 644 man/ssg.1 $(DESTDIR)$(MANDIR)/man1/
+ install -m 644 man/ssg-build.1 $(DESTDIR)$(MANDIR)/man1/
+ install -m 644 man/ssg-serve.1 $(DESTDIR)$(MANDIR)/man1/
+ install -m 644 man/ssg-init.1 $(DESTDIR)$(MANDIR)/man1/
+ install -m 644 man/ssg-version.1 $(DESTDIR)$(MANDIR)/man1/
+ install -m 644 man/ssg-help.1 $(DESTDIR)$(MANDIR)/man1/
+ install -d $(DESTDIR)$(MANDIR)/man5
+ install -m 644 man/ssg-templates.5 $(DESTDIR)$(MANDIR)/man5/
+
+uninstall:
+ rm -f $(DESTDIR)$(BINDIR)/ssg
+ rm -f $(DESTDIR)$(MANDIR)/man1/ssg.1
+ rm -f $(DESTDIR)$(MANDIR)/man1/ssg-build.1
+ rm -f $(DESTDIR)$(MANDIR)/man1/ssg-serve.1
+ rm -f $(DESTDIR)$(MANDIR)/man1/ssg-init.1
+ rm -f $(DESTDIR)$(MANDIR)/man1/ssg-version.1
+ rm -f $(DESTDIR)$(MANDIR)/man1/ssg-help.1
+ rm -f $(DESTDIR)$(MANDIR)/man5/ssg-templates.5
+
+clean:
+ rm -f ssg