-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (40 loc) · 1.05 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
.DEFAULT_GOAL := all
NAME=remote2local
VERSION=0.1
DIRS=etc lib bin sbin share
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null`
DOC_FILES=*.md
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)
pkg:
mkdir -p $(PKG_DIR)
$(PKG): pkg
git archive --output=$(PKG) --prefix=$(PKG_NAME)/ HEAD
build: $(PKG)
$(SIG): $(PKG)
sign: $(SIG)
echo "signing not yet implemented"
clean:
rm -rf $(PKG_DIR)
all: $(PKG) $(SIG)
test:
spellintian */*
spellintian *
shellcheck bin/*.sh
tag:
git tag -s v$(VERSION) -m "$(NAME) $(VERSION)"
release: $(PKG) $(SIG) tag
install:
for dir in $(INSTALL_DIRS); do mkdir -p $(PREFIX)/$$dir; done
for file in $(INSTALL_FILES); do cp $$file $(PREFIX)/$$file; done
mkdir -p $(DOC_DIR)
cp -r $(DOC_FILES) $(DOC_DIR)/
uninstall:
for file in $(INSTALL_FILES); do rm -f $(PREFIX)/$$file; done
rm -rf $(DOC_DIR)
.PHONY: build sign clean test tag release install uninstall all