PageRenderTime 44ms CodeModel.GetById 16ms app.highlight 24ms RepoModel.GetById 1ms app.codeStats 0ms

/Makefile

http://github.com/sukria/Backup-Manager
Makefile | 166 lines | 99 code | 26 blank | 41 comment | 0 complexity | ef743ad3e0921e12fdd2ec20d7d5a53d MD5 | raw file
  1# Copyright © 2005-2016 The Backup Manager Authors
  2# See the AUTHORS file for details.
  3#
  4# This program is free software; you can redistribute it and/or
  5# modify it under the terms of the GNU General Public License
  6# as published by the Free Software Foundation; either version 2
  7# of the License, or (at your option) any later version.
  8#
  9# This program is distributed in the hope that it will be useful,
 10# but WITHOUT ANY WARRANTY; without even the implied warranty of
 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12# GNU General Public License for more details.
 13#
 14# You should have received a copy of the GNU General Public License
 15# along with this program; if not, write to the Free Software
 16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 17
 18# Makefile for Backup Manager written by Alexis Sukrieh, 
 19# smart ideas for finding out perl libraries' destination come 
 20# from Thomas Parmelan.
 21
 22# $Revision$
 23# $Date$
 24# $Author$
 25
 26
 27# Overwrite that variable if you need to prefix the destination 
 28# (needed for vendors).
 29DESTDIR?=
 30PREFIX?=/usr/local
 31
 32# Overwrite that variable with the Perl vendorlib Config value if 
 33# you package Backup Manager
 34PERL5DIR?="$(DESTDIR)$(shell perl -MConfig -e 'print "$$Config{sitelib}"')"
 35
 36# Some static paths, specific to backup-manager
 37BINDIR=$(PREFIX)/bin
 38SBINDIR=$(PREFIX)/sbin
 39VARDIR=$(PREFIX)/var
 40
 41LIBDIR=$(DESTDIR)/$(PREFIX)/lib/backup-manager
 42CONTRIB=$(LIBDIR)/contrib
 43SHAREDIR=$(DESTDIR)/$(PREFIX)/share/backup-manager
 44SHFILES=\
 45	lib/externals.sh \
 46	lib/dialog.sh \
 47	lib/files.sh \
 48	lib/actions.sh \
 49	lib/dbus.sh \
 50	lib/backup-methods.sh\
 51	lib/upload-methods.sh\
 52	lib/burning-methods.sh\
 53	lib/logger.sh \
 54	lib/gettext.sh \
 55	lib/gettext-real.sh \
 56	lib/gettext-dummy.sh \
 57	lib/sanitize.sh \
 58	lib/md5sum.sh 
 59
 60# For the backup-manager-doc package
 61DOCDIR		 = $(DESTDIR)/$(PREFIX)/share/doc/backup-manager
 62DOCHTMLDIR	 = $(DOCDIR)/user-guide.html
 63DOCPDF		 = doc/user-guide.pdf
 64DOCHTMLFILES = doc/user-guide.html/*.html
 65DOCPDF		 = doc/user-guide.pdf
 66DOCTXT		 = doc/user-guide.txt
 67
 68# Main build rule (we don't buid the docs as we don't know if debiandocs can be
 69# there) so the docs target has to be called manually by vendors.
 70build: manpages 
 71
 72# The backup-manager package
 73install: build install_lib install_bin install_contrib install_man install_po
 74install_binary: build install_lib install_bin
 75
 76install_contrib:
 77	@echo -e "*** Contrib files ***\n"
 78	install -d $(CONTRIB)
 79	install -m0755 contrib/*.sh $(CONTRIB)
 80
 81# The backup-manager-doc package
 82install_doc: 
 83	@echo -e "\n*** Building the User Guide ***\n"
 84	$(MAKE) -C doc DESTDIR=$(DESTDIR)
 85	install -d $(DOCDIR)
 86	install -o root -g 0 -m 0644 $(DOCPDF) $(DOCDIR)
 87	install -o root -g 0 -m 0644 $(DOCTXT) $(DOCDIR)
 88	install -d $(DOCHTMLDIR)
 89	install -o root -g 0 -m 0644 $(DOCHTMLFILES) $(DOCHTMLDIR)
 90
 91# The translation stuff
 92install_po:
 93	$(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
 94
 95# The backup-manager libraries
 96install_lib:
 97	@echo -e "\n*** Installing libraries ***\n"
 98	install -d $(LIBDIR)
 99	install -o root -g 0 -m 0644 $(SHFILES) $(LIBDIR)
100
101# The main stuff to build the backup-manager package
102install_bin:
103	@echo -e "\n*** Installing scripts ***\n"
104	mkdir -p $(DESTDIR)/$(SBINDIR)
105	mkdir -p $(DESTDIR)/$(BINDIR)
106	mkdir -p $(SHAREDIR)
107	install -o root -g 0 -m 0755 backup-manager $(DESTDIR)/$(SBINDIR)
108	install -o root -g 0 -m 0755 backup-manager-purge $(DESTDIR)/$(BINDIR)
109	install -o root -g 0 -m 0755 backup-manager-upload $(DESTDIR)/$(BINDIR)
110	install -o root -g 0 -m 0644 backup-manager.conf.tpl $(SHAREDIR)
111
112	# Set PREFIX to backup-manager binary
113	sed "s#^BIN_PREFIX=.*#BIN_PREFIX=$(DESTDIR)/$(BINDIR)#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
114	sed "s#^LIB_PREFIX=.*#LIB_PREFIX=$(DESTDIR)/$(PREFIX)/lib#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
115	sed "s#^VAR_PREFIX=.*#VAR_PREFIX=$(VARDIR)#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
116	
117	mkdir -p $(PERL5DIR)
118	mkdir -p $(PERL5DIR)/BackupManager
119	install -o root -g 0 -m 0644 BackupManager/*.pm $(PERL5DIR)/BackupManager
120	
121# Uninstall
122uninstall:
123	@echo -e "\n*** Unsinstalling Backup-Manager ***\n"
124	@rm -fv $(DESTDIR)$(SBINDIR)/backup-manager
125	@rm -fv $(DESTDIR)$(BINDIR)/backup-manager-purge
126	@rm -fv $(DESTDIR)$(BINDIR)/backup-manager-upload
127	@rm -fv $(SHAREDIR)/backup-manager.conf.tpl
128	@rm -fv $(DESTDIR)$(PREFIX)/share/man/man8/backup-manager*.8
129	@rm -Rfv $(LIBDIR)
130	@rm -Rfv $(PERL5DIR)/BackupManager
131	@rm -Rfv $(SHAREDIR)
132	@rm -Rfv $(DESTDIR)$(PREFIX)/share/doc/backup-manager
133	@rm -fv $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/backup-manager.mo
134
135# Building manpages
136man/backup-manager-upload.8:
137	PERL5LIB=. pod2man --section 8 --center="backup-manager-upload" backup-manager-upload > man/backup-manager-upload.8
138
139man/backup-manager-purge.8:
140	PERL5LIB=. pod2man --section 8 --center="backup-manager-purge" backup-manager-purge > man/backup-manager-purge.8
141	
142# build the manpages
143manpages: manpages-stamp	
144manpages-stamp: man/backup-manager-upload.8 man/backup-manager-purge.8
145	touch manpages-stamp
146
147# Installing the man pages.
148install_man: manpages-stamp
149	@echo -e "\n*** Installing man pages ***\n"
150	install -d $(DESTDIR)/$(PREFIX)/share/man/man8/
151	install -o root -g 0 -m 0644 man/*.8 $(DESTDIR)/$(PREFIX)/share/man/man8/
152
153testperldir:
154	@echo "PERL5DIR: $(PERL5DIR)"
155
156docs:
157	make -C doc all
158
159clean:
160	rm -f build-stamp
161	rm -rf debian/backup-manager
162	rm -f man/backup-manager-upload.8
163	#rm -f man/*.8
164	$(MAKE) -C po clean
165	$(MAKE) -C doc clean
166