1# distribution boxbackup-0.11_trunk_2979 (svn version: 2979) 2# Box Backup, http://www.boxbackup.org/ 3# 4# Copyright (c) 2003-2010, Ben Summers and contributors. 5# All rights reserved. 6# 7# Note that this project uses mixed licensing. Any file with this license 8# attached, or where the code LICENSE-GPL appears on the first line, falls 9# under the "Box Backup GPL" license. See the file COPYING.txt for more 10# information about this license. 11# 12# --------------------------------------------------------------------- 13# This program is free software; you can redistribute it and/or 14# modify it under the terms of the GNU General Public License 15# as published by the Free Software Foundation; either version 2 16# of the License, or (at your option) any later version. 17# 18# This program is distributed in the hope that it will be useful, 19# but WITHOUT ANY WARRANTY; without even the implied warranty of 20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21# GNU General Public License for more details. 22# 23# You should have received a copy of the GNU General Public License 24# along with this program; if not, write to the Free Software 25# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 26# 27# [http://www.gnu.org/licenses/old-licenses/gpl-2.0.html#SEC4] 28# 29# As a special exception to the GPLv2, the Box Backup Project gives 30# permission to link any code falling under this license (the Box Backup 31# GPL) with any software that can be downloaded from 32# the OpenSSL website [http://www.openssl.org] under either the 33# "OpenSSL License" or the "Original SSLeay License", and to distribute 34# the linked executables under the terms of the "Box Backup GPL" license. 35# 36# As a special exception to the GPLv2, the Box Backup Project gives 37# permission to link any code falling under this license (the Box Backup 38# GPL) with any version of Microsoft's Volume Shadow Copy Service 7.2 SDK 39# or Microsoft Windows Software Development Kit (SDK), including 40# vssapi.lib, that can be downloaded from the Microsoft website 41# [*.microsoft.com], and to distribute the linked executables under the 42# terms of the "Box Backup GPL" license. 43# Process DocBook to HTML 44 45# This makefile is a bit obfuscated so that it works correctly on both 46# BSD and GNU make. Some parts apply to one version of make and not the 47# other; these are marked by comments. 48 49# The "all" target shouldn't be up here, but the trickery below defines 50# what looks like a rule to GNU make, and so we need to define the actual 51# default target before it. 52 53all: docs 54 55DBPROC_COMMAND = xsltproc 56MKDIR_COMMAND = mkdir 57CP_COMMAND = cp 58PERL_COMMAND = perl 59RM_COMMAND = rm -f 60TAR_COMMAND = tar 61GZIP_COMMAND = gzip -f 62GENERATE_SCRIPT = tools/generate_except_xml.pl 63 64DBPROC = $(DBPROC_COMMAND) 65MKDIR = $(MKDIR_COMMAND) 66CP = $(CP_COMMAND) 67GENERATE = $(PERL_COMMAND) $(GENERATE_SCRIPT) 68RM_QUIET = $(RM_COMMAND) 69TAR = $(TAR_COMMAND) 70GZIP = $(GZIP_COMMAND) 71PROGRESS = @ true 72 73# use a GNU make "define" command, that looks like a harmless dummy rule 74# to BSD make, to hide parts of the Makefile from GNU make. 75define IGNORED_BY_GNU_MAKE: 76.if 0 77endef 78 79 # seen by GNU make, not by BSD make 80 ifeq ($(V),) 81 DBPROC = @ echo " [XLSTPROC]" $^ && $(DBPROC_COMMAND) 2>/dev/null 82 GENERATE = @ echo " [GENERATE]" $@ && $(PERL_COMMAND) $(GENERATE_SCRIPT) 83 TAR = @ echo " [TAR] " $@ && $(TAR_COMMAND) 84 GZIP = @ echo " [GZIP] " $< && $(GZIP_COMMAND) 85 RM_QUIET = @ $(RM_COMMAND) 86 PROGRESS = @ echo 87 endif 88 89define IGNORED_BY_GNU_MAKE: 90.endif 91 92.ifndef V 93 # seen by BSD make, not by GNU make 94 DBPROC = @ echo " [XSLTPROC]" $(.ALLSRC) && $(DBPROC_COMMAND) 2>/dev/null 95 GENERATE = @ echo " [GENERATE]" $(.TARGET) && $(PERL_COMMAND) $(GENERATE_SCRIPT) 96 TAR = @ echo " [TAR] " $(.TARGET) && $(TAR_COMMAND) 97 GZIP = @ echo " [GZIP] " $(.TARGET:.gz=) && $(GZIP_COMMAND) 98 RM_QUIET = @ $(RM_COMMAND) 99 PROGRESS = @ echo 100.endif 101 102# neither .endif nor endef can be followed by a colon; each creates 103# warnings or errors in one or other version of make. we need some 104# magic to make them both work. Luckily, .endfor ignores the colon. 105 106.for DUMMY in $(NO_SUCH_VARIABLE) 107endef 108.endfor : 109 110PROGRESS_RM = $(PROGRESS) " [RM] " 111 112DOCBOOK_DIR = docbook 113HTML_DIR = htmlguide 114MAN_DIR = man 115 116BOOKXSL = $(DOCBOOK_DIR)/bb-book.xsl 117NOCHUNKBOOKXSL = $(DOCBOOK_DIR)/bb-nochunk-book.xsl 118MANXSL = $(DOCBOOK_DIR)/bb-man.xsl 119 120VPATH = $(DOCBOOK_DIR) 121.SUFFIXES: .html .xml .gz .1 .5 .8 122 123docs: instguide adminguide manpages 124 @mkdir -p $(HTML_DIR)/images 125 @cp $(DOCBOOK_DIR)/html/images/*.png $(HTML_DIR)/images/. 126 @cp $(DOCBOOK_DIR)/html/*.css $(HTML_DIR)/. 127 @cp $(DOCBOOK_DIR)/html/*.ico $(HTML_DIR)/. 128 129adminguide: $(DOCBOOK_DIR)/ExceptionCodes.xml $(HTML_DIR)/adminguide/index.html 130 131# $^ gives all sources on GNU make, and nothing on BSD make 132# $> gives all sources on BSD make, and nothing on GNU make 133$(HTML_DIR)/adminguide/index.html: $(BOOKXSL) $(DOCBOOK_DIR)/adminguide.xml 134 $(DBPROC) -o $(HTML_DIR)/adminguide/ $^ $> 135 136instguide: $(HTML_DIR)/instguide/index.html 137 138$(HTML_DIR)/instguide/index.html: $(BOOKXSL) $(DOCBOOK_DIR)/instguide.xml 139 $(DBPROC) -o $(HTML_DIR)/instguide/ $^ $> 140 141# On BSD make, $> contains all sources and $^ is empty 142# On GNU make, $^ contains all sources and $> is empty 143$(DOCBOOK_DIR)/ExceptionCodes.xml: ../ExceptionCodes.txt 144 $(GENERATE) $> $^ $@ 145 146manpages: man-dirs man-nroff man-html 147 148man-dirs: man/.there $(HTML_DIR)/man-html/.there 149 150$(HTML_DIR)/man-html/.there: 151 mkdir -p $(HTML_DIR)/man-html 152 touch $(HTML_DIR)/man-html/.there 153 154man/.there: 155 mkdir -p man 156 touch man/.there 157 158NROFF_PAGES = bbackupd.8 bbackupd-config.8 bbackupctl.8 bbackupquery.8 \ 159 bbstored.8 bbstored-config.8 bbstoreaccounts.8 bbstored-certs.8 \ 160 raidfile-config.8 \ 161 bbackupd.conf.5 bbstored.conf.5 raidfile.conf.5 162 163NROFF_FILES = $(NROFF_PAGES:%=$(MAN_DIR)/%.gz) 164 165man-nroff: $(NROFF_FILES) 166 167HTML_FILES_1 = $(NROFF_PAGES:%.5=%.html) 168HTML_FILES_2 = $(HTML_FILES_1:%.8=%.html) 169HTML_FILES = $(HTML_FILES_2:%=$(HTML_DIR)/man-html/%) 170 171man-html: $(HTML_FILES) 172 173# $^ gives all sources on GNU make, and nothing on BSD make 174 175# GNU make 176$(HTML_DIR)/man-html/%.html: $(NOCHUNKBOOKXSL) $(DOCBOOK_DIR)/%.xml 177 $(DBPROC) -o $@ $^ 178 179# GNU make 180$(MAN_DIR)/%.8: $(MANXSL) $(DOCBOOK_DIR)/%.xml 181 $(DBPROC) -o $@ $^ 182 183# GNU make 184$(MAN_DIR)/%.8.gz: $(MAN_DIR)/%.8 185 $(GZIP) $< 186 187# GNU make 188$(MAN_DIR)/%.5: $(MANXSL) $(DOCBOOK_DIR)/%.xml $(MANXSL) 189 $(DBPROC) -o $@ $^ 190 191# GNU make 192$(MAN_DIR)/%.5.gz: $(MAN_DIR)/%.5 193 $(GZIP) $< 194 195# BSD make: the final colon (:) is required to make the .for and .endfor 196# lines valid in GNU make. It creates (different) dummy rules in GNU and 197# BSD make. Both dummy rules are harmless. 198 199.for MAN_PAGE in $(NROFF_PAGES) : 200$(MAN_DIR)/$(MAN_PAGE).gz: $(MANXSL) $(DOCBOOK_DIR)/$(MAN_PAGE:R).xml 201 $(DBPROC) -o $(.TARGET:.gz=) $(.ALLSRC) 202 $(GZIP) $(.TARGET:.gz=) 203 204$(HTML_DIR)/man-html/$(MAN_PAGE:R).html: $(NOCHUNKBOOKXSL) \ 205$(DOCBOOK_DIR)/$(MAN_PAGE:R).xml 206 $(DBPROC) -o $(.TARGET) $(.ALLSRC) 207.endfor : 208 209dockit: clean docs documentation-kit-0.10.tar.gz 210 211documentation-kit-0.10.tar.gz: 212 $(TAR) zcf documentation-kit-0.10.tar.gz $(HTML_DIR)/ 213 214clean: 215 $(PROGRESS_RM) "$(HTML_DIR)/man-html/*.html" 216 $(RM_QUIET) $(HTML_FILES) 217 218 $(PROGRESS_RM) "$(MAN_DIR)/*.[58].gz" 219 $(RM_QUIET) $(NROFF_FILES) 220 221 $(PROGRESS_RM) "$(DOCBOOK_DIR)/ExceptionCodes.xml" 222 $(RM_QUIET) $(DOCBOOK_DIR)/ExceptionCodes.xml 223 224 $(PROGRESS_RM) "documentation-kit-0.10.tar.gz" 225 $(RM_QUIET) documentation-kit-0.10.tar.gz 226