-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
131 lines (113 loc) · 3.6 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
127
128
129
130
131
#
# Simple Makefile for mylvmbackup
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# required programs
POD2MAN = /usr/bin/pod2man
POD2HTML = /usr/bin/pod2html
CHMOD = /bin/chmod
CP = /bin/cp
FIND = /usr/bin/find
GPG = /usr/bin/gpg
GZIP = /bin/gzip
INSTALL = /usr/bin/install -p
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_CONF = $(INSTALL) -m 600
MV = /bin/mv
RM = /bin/rm
PERL = /usr/bin/perl
RPMBUILD = /usr/bin/rpmbuild
RPMFLAGS = -ta --clean
SED = /bin/sed
SHELL = /bin/sh
TAR = /bin/tar
# define some variables
NAME = mylvmbackup
VERSION = 0.17
BUILDDATE = $(shell date +%Y-%m-%d)
MAN1 = man/$(NAME).1
HOOKS := $(wildcard hooks/*.pm)
DISTFILES = \
ChangeLog \
COPYING \
CREDITS \
hooks \
INSTALL \
Makefile \
man \
$(NAME) \
$(NAME).conf \
$(NAME).pl.in \
$(NAME).spec \
$(NAME).spec.in \
README \
TODO
CLEANFILES = $(NAME).spec $(NAME) $(MAN1) $(MAN1).html
prefix = /usr/local
sysconfdir = /etc
bindir = $(prefix)/bin
datadir = $(prefix)/share/mylvmbackup
distdir = $(NAME)-$(VERSION)
mandir = $(prefix)/share/man
man1dir = $(mandir)/man1
all: $(DISTFILES) $(MAN1)
$(NAME).spec: $(NAME).spec.in
$(SED) -e s/@VERSION@/$(VERSION)/ < $< > $@
$(NAME): $(NAME).pl.in
$(SED) -e s/@BUILDDATE@/$(BUILDDATE)/ \
-e s_@PERL@_$(PERL)_ \
-e s/@VERSION@/$(VERSION)/ < $< > $@
$(CHMOD) 755 $@
$(MAN1):
$(POD2MAN) man/$(NAME).pod > $(MAN1)
htmlman:
$(POD2HTML) man/$(NAME).pod > $(MAN1).html
$(RM) -f pod2htmd.tmp pod2htmi.tmp
install-bin: $(NAME)
$(INSTALL_PROGRAM) $(NAME) $(DESTDIR)$(bindir)
install: all
test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir)
test -d $(DESTDIR)$(man1dir) || $(INSTALL) -d $(DESTDIR)$(man1dir)
test -d $(DESTDIR)$(sysconfdir) || $(INSTALL) -d $(DESTDIR)$(sysconfdir)
test -d $(DESTDIR)$(datadir) || $(INSTALL) -d $(DESTDIR)$(datadir)
$(INSTALL_PROGRAM) $(NAME) $(DESTDIR)$(bindir)
$(INSTALL_DATA) $(MAN1) $(DESTDIR)$(man1dir)/$(NAME).1
if test -f $(DESTDIR)$(sysconfdir)/$(NAME).conf ; then $(MV) $(DESTDIR)$(sysconfdir)/$(NAME).conf $(DESTDIR)$(sysconfdir)/$(NAME).conf.bak ; fi
$(INSTALL_CONF) $(NAME).conf $(DESTDIR)$(sysconfdir)
for HOOK in $(HOOKS) ; do if [ ! -f $(DESTDIR)$(datadir)/$$HOOK ] ; then $(INSTALL_DATA) -v $$HOOK $(DESTDIR)$(datadir) ; fi ; done
uninstall:
$(RM) -f $(DESTDIR)$(bindir)/$(NAME)
$(RM) -f $(DESTDIR)$(man1dir)/$(NAME).1
$(RM) -f $(DESTDIR)$(sysconfdir)/$(NAME).conf
for HOOK in $(notdir $(HOOKS)) ; do $(RM) -f $(DESTDIR)$(datadir)/$$HOOK ; done
distdir: all
if test -d $(distdir) ; then $(RM) -rf $(distdir) ; fi
mkdir $(distdir)
$(CP) -a $(DISTFILES) $(distdir)
dist: distdir
$(TAR) chof - $(distdir) | $(GZIP) -c > $(distdir).tar.gz
$(RM) -rf $(distdir)
distsign: $(distdir).tar.gz
$(GPG) --armor --detach-sign --default-key=B27291F2 $(distdir).tar.gz
rpm: dist
$(RPMBUILD) $(RPMFLAGS) $(distdir).tar.gz
.PHONY: clean
clean:
$(RM) -f $(CLEANFILES)
maintainer-clean: clean
$(RM) -f $(distdir).tar.gz
syntaxcheck:
$(PERL) -c $(NAME).pl.in