/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. # Makefile for Backup Manager written by Alexis Sukrieh,
  18. # smart ideas for finding out perl libraries' destination come
  19. # from Thomas Parmelan.
  20. # $Revision$
  21. # $Date$
  22. # $Author$
  23. # Overwrite that variable if you need to prefix the destination
  24. # (needed for vendors).
  25. DESTDIR?=
  26. PREFIX?=/usr/local
  27. # Overwrite that variable with the Perl vendorlib Config value if
  28. # you package Backup Manager
  29. PERL5DIR?="$(DESTDIR)$(shell perl -MConfig -e 'print "$$Config{sitelib}"')"
  30. # Some static paths, specific to backup-manager
  31. BINDIR=$(PREFIX)/bin
  32. SBINDIR=$(PREFIX)/sbin
  33. VARDIR=$(PREFIX)/var
  34. LIBDIR=$(DESTDIR)/$(PREFIX)/lib/backup-manager
  35. CONTRIB=$(LIBDIR)/contrib
  36. SHAREDIR=$(DESTDIR)/$(PREFIX)/share/backup-manager
  37. SHFILES=\
  38. lib/externals.sh \
  39. lib/dialog.sh \
  40. lib/files.sh \
  41. lib/actions.sh \
  42. lib/dbus.sh \
  43. lib/backup-methods.sh\
  44. lib/upload-methods.sh\
  45. lib/burning-methods.sh\
  46. lib/logger.sh \
  47. lib/gettext.sh \
  48. lib/gettext-real.sh \
  49. lib/gettext-dummy.sh \
  50. lib/sanitize.sh \
  51. lib/md5sum.sh
  52. # For the backup-manager-doc package
  53. DOCDIR = $(DESTDIR)/$(PREFIX)/share/doc/backup-manager
  54. DOCHTMLDIR = $(DOCDIR)/user-guide.html
  55. DOCPDF = doc/user-guide.pdf
  56. DOCHTMLFILES = doc/user-guide.html/*.html
  57. DOCPDF = doc/user-guide.pdf
  58. DOCTXT = doc/user-guide.txt
  59. # Main build rule (we don't buid the docs as we don't know if debiandocs can be
  60. # there) so the docs target has to be called manually by vendors.
  61. build: manpages
  62. # The backup-manager package
  63. install: build install_lib install_bin install_contrib install_man install_po
  64. install_binary: build install_lib install_bin
  65. install_contrib:
  66. @echo -e "*** Contrib files ***\n"
  67. install -d $(CONTRIB)
  68. install -m0755 contrib/*.sh $(CONTRIB)
  69. # The backup-manager-doc package
  70. install_doc:
  71. @echo -e "\n*** Building the User Guide ***\n"
  72. $(MAKE) -C doc DESTDIR=$(DESTDIR)
  73. install -d $(DOCDIR)
  74. install -o root -g 0 -m 0644 $(DOCPDF) $(DOCDIR)
  75. install -o root -g 0 -m 0644 $(DOCTXT) $(DOCDIR)
  76. install -d $(DOCHTMLDIR)
  77. install -o root -g 0 -m 0644 $(DOCHTMLFILES) $(DOCHTMLDIR)
  78. # The translation stuff
  79. install_po:
  80. $(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
  81. # The backup-manager libraries
  82. install_lib:
  83. @echo -e "\n*** Installing libraries ***\n"
  84. install -d $(LIBDIR)
  85. install -o root -g 0 -m 0644 $(SHFILES) $(LIBDIR)
  86. # The main stuff to build the backup-manager package
  87. install_bin:
  88. @echo -e "\n*** Installing scripts ***\n"
  89. mkdir -p $(DESTDIR)/$(SBINDIR)
  90. mkdir -p $(DESTDIR)/$(BINDIR)
  91. mkdir -p $(SHAREDIR)
  92. install -o root -g 0 -m 0755 backup-manager $(DESTDIR)/$(SBINDIR)
  93. install -o root -g 0 -m 0755 backup-manager-purge $(DESTDIR)/$(BINDIR)
  94. install -o root -g 0 -m 0755 backup-manager-upload $(DESTDIR)/$(BINDIR)
  95. install -o root -g 0 -m 0644 backup-manager.conf.tpl $(SHAREDIR)
  96. # Set PREFIX to backup-manager binary
  97. sed "s#^BIN_PREFIX=.*#BIN_PREFIX=$(DESTDIR)/$(BINDIR)#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
  98. sed "s#^LIB_PREFIX=.*#LIB_PREFIX=$(DESTDIR)/$(PREFIX)/lib#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
  99. sed "s#^VAR_PREFIX=.*#VAR_PREFIX=$(VARDIR)#" -i $(DESTDIR)/$(SBINDIR)/backup-manager
  100. mkdir -p $(PERL5DIR)
  101. mkdir -p $(PERL5DIR)/BackupManager
  102. install -o root -g 0 -m 0644 BackupManager/*.pm $(PERL5DIR)/BackupManager
  103. # Uninstall
  104. uninstall:
  105. @echo -e "\n*** Unsinstalling Backup-Manager ***\n"
  106. @rm -fv $(DESTDIR)$(SBINDIR)/backup-manager
  107. @rm -fv $(DESTDIR)$(BINDIR)/backup-manager-purge
  108. @rm -fv $(DESTDIR)$(BINDIR)/backup-manager-upload
  109. @rm -fv $(SHAREDIR)/backup-manager.conf.tpl
  110. @rm -fv $(DESTDIR)$(PREFIX)/share/man/man8/backup-manager*.8
  111. @rm -Rfv $(LIBDIR)
  112. @rm -Rfv $(PERL5DIR)/BackupManager
  113. @rm -Rfv $(SHAREDIR)
  114. @rm -Rfv $(DESTDIR)$(PREFIX)/share/doc/backup-manager
  115. @rm -fv $(DESTDIR)$(PREFIX)/share/locale/*/LC_MESSAGES/backup-manager.mo
  116. # Building manpages
  117. man/backup-manager-upload.8:
  118. PERL5LIB=. pod2man --section 8 --center="backup-manager-upload" backup-manager-upload > man/backup-manager-upload.8
  119. man/backup-manager-purge.8:
  120. PERL5LIB=. pod2man --section 8 --center="backup-manager-purge" backup-manager-purge > man/backup-manager-purge.8
  121. # build the manpages
  122. manpages: manpages-stamp
  123. manpages-stamp: man/backup-manager-upload.8 man/backup-manager-purge.8
  124. touch manpages-stamp
  125. # Installing the man pages.
  126. install_man: manpages-stamp
  127. @echo -e "\n*** Installing man pages ***\n"
  128. install -d $(DESTDIR)/$(PREFIX)/share/man/man8/
  129. install -o root -g 0 -m 0644 man/*.8 $(DESTDIR)/$(PREFIX)/share/man/man8/
  130. testperldir:
  131. @echo "PERL5DIR: $(PERL5DIR)"
  132. docs:
  133. make -C doc all
  134. clean:
  135. rm -f build-stamp
  136. rm -rf debian/backup-manager
  137. rm -f man/backup-manager-upload.8
  138. #rm -f man/*.8
  139. $(MAKE) -C po clean
  140. $(MAKE) -C doc clean