forked from parcha/anything-sync-daemon
/
Makefile
126 lines (102 loc) · 4.18 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
VERSION = 5.85
PN = anything-sync-daemon
PREFIX ?= /usr
CONFDIR = /etc
CRONDIR = /etc/cron.hourly
INITDIR_SYSTEMD = /usr/lib/systemd/system
INITDIR_UPSTART = /etc/init.d
BINDIR = $(PREFIX)/bin
DOCDIR = $(PREFIX)/share/doc/$(PN)
MANDIR = $(PREFIX)/share/man/man1
ZSHDIR = $(PREFIX)/share/zsh/site-functions
BSHDIR = $(PREFIX)/share/bash-completion/completions
# set to anything except 0 to enable manpage compression
COMPRESS_MAN = 1
RM = rm
SED = sed
INSTALL = install -p
INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_SCRIPT = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
INSTALL_DIR = $(INSTALL) -d
Q = @
common/$(PN): common/$(PN).in
$(Q)echo -e '\033[1;32mSetting version\033[0m'
$(Q)$(SED) 's/@VERSION@/'$(VERSION)'/' common/$(PN).in > common/$(PN)
help: install
install-bin: common/$(PN)
$(Q)echo -e '\033[1;32mInstalling main script...\033[0m'
$(INSTALL_DIR) "$(DESTDIR)$(BINDIR)"
$(INSTALL_PROGRAM) common/$(PN) "$(DESTDIR)$(BINDIR)/$(PN)"
ln -sf $(PN) "$(DESTDIR)$(BINDIR)/asd"
$(INSTALL_DIR) "$(DESTDIR)$(ZSHDIR)"
$(INSTALL_DATA) common/zsh-completion "$(DESTDIR)/$(ZSHDIR)/_asd"
$(INSTALL_DIR) "$(DESTDIR)$(BSHDIR)"
$(INSTALL_DATA) common/bash-completion "$(DESTDIR)/$(BSHDIR)/asd"
install-man:
$(Q)echo -e '\033[1;32mInstalling manpage...\033[0m'
$(INSTALL_DIR) "$(DESTDIR)$(MANDIR)"
$(INSTALL_DATA) doc/asd.1 "$(DESTDIR)$(MANDIR)/asd.1"
ifneq ($(COMPRESS_MAN),0)
gzip -9 "$(DESTDIR)$(MANDIR)/asd.1"
ln -sf asd.1.gz "$(DESTDIR)$(MANDIR)/$(PN).1.gz"
else
ln -sf asd.1 "$(DESTDIR)$(MANDIR)/$(PN).1"
endif
install-cron:
$(Q)echo -e '\033[1;32mInstalling cronjob...\033[0m'
$(INSTALL_DIR) "$(DESTDIR)$(CRONDIR)"
$(INSTALL_SCRIPT) common/asd.cron.hourly "$(DESTDIR)$(CRONDIR)/asd-update"
install-systemd:
$(Q)echo -e '\033[1;32mInstalling systemd files...\033[0m'
$(INSTALL_DIR) "$(DESTDIR)$(CONFDIR)"
$(INSTALL_DIR) "$(DESTDIR)$(INITDIR_SYSTEMD)"
$(INSTALL_DATA) common/asd.conf "$(DESTDIR)$(CONFDIR)/asd.conf"
$(INSTALL_DATA) init/asd.service "$(DESTDIR)$(INITDIR_SYSTEMD)/asd.service"
$(INSTALL_DATA) init/asd-resync.service "$(DESTDIR)$(INITDIR_SYSTEMD)/asd-resync.service"
$(INSTALL_DATA) init/asd-resync.timer "$(DESTDIR)$(INITDIR_SYSTEMD)/asd-resync.timer"
install-upstart:
$(Q)echo -e '\033[1;32mInstalling upstart files...\033[0m'
$(INSTALL_DIR) "$(DESTDIR)$(CONFDIR)"
$(INSTALL_DIR) "$(DESTDIR)$(INITDIR_UPSTART)"
$(INSTALL_DATA) common/asd.conf "$(DESTDIR)$(CONFDIR)/asd.conf"
$(INSTALL_SCRIPT) init/asd.upstart "$(DESTDIR)$(INITDIR_UPSTART)/asd"
install-systemd-all: install-bin install-man install-systemd
install-upstart-all: install-bin install-man install-cron install-upstart
install:
$(Q)echo "run one of the following:"
$(Q)echo " make install-systemd-all (systemd based systems)"
$(Q)echo " make install-upstart-all (upstart based systems)"
$(Q)echo
$(Q)echo "or check out the Makefile for specific rules"
uninstall-bin:
$(RM) "$(DESTDIR)$(BINDIR)/$(PN)"
$(RM) "$(DESTDIR)$(BINDIR)/asd"
$(RM) "$(DESTDIR)/$(ZSHDIR)/_asd"
$(RM) "$(DESTDIR)/$(BSHDIR)/asd"
uninstall-man:
$(RM) -f "$(DESTDIR)$(MANDIR)/$(PN).1.gz"
$(RM) -f "$(DESTDIR)$(MANDIR)/asd.1.gz"
$(RM) -f "$(DESTDIR)$(MANDIR)/$(PN).1"
$(RM) -f "$(DESTDIR)$(MANDIR)/asd.1"
uninstall-cron:
$(RM) "$(DESTDIR)$(CRONDIR)/asd-update"
uninstall-systemd:
$(RM) "$(DESTDIR)$(CONFDIR)/asd.conf"
$(RM) "$(DESTDIR)$(INITDIR_SYSTEMD)/asd.service"
$(RM) "$(DESTDIR)$(INITDIR_SYSTEMD)/asd-resync.service"
$(RM) "$(DESTDIR)$(INITDIR_SYSTEMD)/asd-resync.timer"
uninstall-upstart:
$(RM) "$(DESTDIR)$(CONFDIR)/asd.conf"
$(RM) "$(DESTDIR)$(INITDIR_UPSTART)/asd"
uninstall-systemd-all: uninstall-bin uninstall-man uninstall-systemd
uninstall-upstart-all: uninstall-bin uninstall-man uninstall-cron uninstall-upstart
uninstall:
$(Q)echo "run one of the following:"
$(Q)echo " make uninstall-systemd-all (systemd based systems)"
$(Q)echo " make uninstall-upstart-all (upstart based systems)"
$(Q)echo
$(Q)echo "or check out the Makefile for specific rules"
clean:
$(RM) -f common/$(PN)
.PHONY: help install-bin install-man install-cron install-systemd install-upstart install-systemd-all install-upstart-all install uninstall-bin uninstall-man uninstall-cron uninstall-systemd uninstall-upstart uninstall-systemd-all uninstall clean