-
Notifications
You must be signed in to change notification settings - Fork 82
/
Makefile
72 lines (56 loc) · 1.97 KB
/
Makefile
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
SHELL=/usr/bin/env bash
NAME=nginx_ensite
VERSION=1.0.0
AUTHOR=perusio
URL=https://github.com/$(AUTHOR)/$(NAME)
UPDATE_URL=https://raw.githubusercontent.com/$(AUTHOR)/$(NAME)/master
UPDATE_FILES={{versions,stable}.txt,checksums.{md5,sha1,sha256,sha512}}
DIRS=bin share
INSTALL_DIRS=`find $(DIRS) -type d`
INSTALL_FILES=`find $(DIRS) -type f`
DOC_FILES=*.ronn
PKG_DIR=pkg
PKG_NAME=$(NAME)-$(VERSION)
PKG=$(PKG_DIR)/$(PKG_NAME).tar.gz
SIG=$(PKG_DIR)/$(PKG_NAME).asc
PREFIX?=/usr/local
DOC_DIR=$(PREFIX)/share/doc/$(PKG_NAME)
COMPLETION_DIR=/etc/bash_completion.d
CURR_DIR=`pwd`
pkg:
mkdir $(PKG_DIR)
share/man/man8/nginx_ensite.8: doc/man/nginx_ensite.8.ronn
ronn --pipe doc/man/nginx_ensite.8.ronn > share/man/man8/nginx_ensite.8
man: doc/man/nginx_ensite.8.ronn share/man/man8/nginx_ensite.8
git add doc/man/nginx_ensite.8.ronn share/man/man8/nginx_ensite.8 share/man/man8/nginx_dissite.8
git commit
download: pkg
wget -O $(PKG) $(URL)/archive/v$(VERSION).tar.gz
build: pkg
git archive --output=$(PKG) --prefix=$(PKG_NAME)/ HEAD
sign: $(PKG)
gpg --sign --detach-sign --armor $(PKG)
git add $(PKG).sig
git commit $(PKG).sig -m "Added PGP signature for v$(VERSION)"
git push origin master
clean:
rm -f $(PKG) $(SIG)
all: $(PKG) $(SIG)
tag:
git push
git tag -s -m "Releasing $(VERSION)" v$(VERSION)
git push --tags
release: tag download sign
install:
for dir in $(INSTALL_DIRS); do mkdir -p $(DESTDIR)$(PREFIX)/$$dir; done
for file in $(INSTALL_FILES); do cp $$file $(DESTDIR)$(PREFIX)/$$file; done
(cd $(DESTDIR)$(PREFIX)/bin && test -L nginx_dissite || ln -s nginx_ensite nginx_dissite)
mkdir -p $(DESTDIR)$(DOC_DIR)
cp -r doc/man/$(DOC_FILES) $(DESTDIR)$(DOC_DIR)/
mkdir -p $(COMPLETION_DIR)
cp bash_completion.d/* $(COMPLETION_DIR)/
uninstall:
for file in $(INSTALL_FILES); do rm -f $(DESTDIR)$(PREFIX)/$$file; done
rm -rf $(DESTDIR)$(DOC_DIR)
rm $(COMPLETION_DIR)/$(NAME)
.PHONY: build man update download sign verify clean check test tag release rpm install uninstall all