/
Makefile
50 lines (36 loc) · 994 Bytes
/
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
NAME=chruby
VERSION=0.1.0
FILES=$(shell git ls-files)
INSTALL_DIRS={etc,lib,bin,sbin,share}
DOC_FILES=doc/*
EXTRA_DOC_FILES=*.{md,tt,txt}
PKG_DIR=pkg
PKG_NAME=$(NAME)-$(VERSION)
PKG=$(PKG_DIR)/$(PKG_NAME).tar.bz2
SIG=$(PKG_DIR)/$(PKG_NAME).asc
PREFIX=/usr/local
DOC_DIR=$(PREFIX)/share/doc/$(PKG_NAME)
pkg:
mkdir -p $(PKG_DIR)
$(PKG): pkg $(FILES)
tar -cjvf $(PKG) --transform 's|^|$(PKG_NAME)/|' $(FILES)
build: $(PKG)
$(SIG): $(PKG)
gpg --sign --detach-sign --armor $(PKG)
sign: $(SIG)
clean:
rm -f $(PKG) $(SIG)
all: $(PKG) $(SIG)
tag:
git push
git tag v$(VERSION)
git push --tags
release: $(PKG) $(SIG) tag
install:
for file in `find $(INSTALL_DIRS) -type f 2>/dev/null`; do install -D $$file $(PREFIX)/$$file; done
install -d $(DOC_DIR)
cp -r $(DOC_FILES) $(DOC_DIR)/ 2>/dev/null || true
cp -r $(EXTRA_DOC_FILES) $(DOC_DIR)/ 2>/dev/null || true
uninstall:
for file in `find $(INSTALL_DIRS) -type f 2>/dev/null`; do rm -f $(PREFIX)/$$file; done
rm -rf $(DOC_DIR)