| 1 |
# |
| 2 |
#------------------------------------------------------------------------- |
| 3 |
SHELL = /bin/sh |
| 4 |
|
| 5 |
AT=@ |
| 6 |
|
| 7 |
# |
| 8 |
# bacula.env file is a local file to define specific values if any |
| 9 |
# bacula.env.dist is a template for it. |
| 10 |
BACULAENVFILE=bacula.env |
| 11 |
ENVFILE=$(shell [ -e ./$(BACULAENVFILE) ] && echo "OK") |
| 12 |
ifeq ($(ENVFILE),OK) |
| 13 |
include $(BACULAENVFILE) |
| 14 |
$(info Found env file $(BACULAENVFILE).) |
| 15 |
else |
| 16 |
$(error No environment file "$(BACULAENVFILE)" found. You can copy "$(BACULAENVFILE).dist" to "$(BACULAENVFILE)" and adjust some definitions.) |
| 17 |
endif |
| 18 |
# |
| 19 |
# Where is latex2html tool |
| 20 |
BLATEX2HTMLDIR=$(CURDIR)/latex2html-2016 |
| 21 |
# |
| 22 |
# LaTeX directory to build bacula documentation (classes and layout) |
| 23 |
LATEX_DIR=$(CURDIR)/latex |
| 24 |
# |
| 25 |
# latex2html requirements: |
| 26 |
## - The latex2html Makefile is required to build latex2html accordingly to our needs |
| 27 |
LATEX2HTMLMAKEFILE=$(BLATEX2HTMLDIR)/Makefile |
| 28 |
## Destination of the build of latex2html (make install) |
| 29 |
BBINDIR=$(CURDIR)/latex2html |
| 30 |
## tex files location for latex2html |
| 31 |
BTEXDIR=$(LATEX_DIR)/latex2html |
| 32 |
## Perl5 libraries to build |
| 33 |
PERL5LIB=$(BLATEX2HTMLDIR) |
| 34 |
## Files required for latex2html process when compiling tex files. |
| 35 |
TRANSLATEIMGS=$(CURDIR)/manuals/translate_images.pl |
| 36 |
LATEX2HTMLINIT=$(CURDIR)/manuals/latex2html-init.pl |
| 37 |
## latex2html binary |
| 38 |
LATEX2HTML=$(BBINDIR)/bin/latex2html |
| 39 |
## Tool directory for the post-process |
| 40 |
TOOLS_DIR=$(CURDIR)/tools |
| 41 |
# |
| 42 |
# PDF to latex compiler |
| 43 |
ifneq ($(TEX_TO_PDF),) |
| 44 |
$(info Using $(TEX_TO_PDF) compiler.) |
| 45 |
else |
| 46 |
$(info PDF compiler $(TEX_TO_PDF) undefined.) |
| 47 |
TEX_TO_PDF=pdflatex |
| 48 |
endif |
| 49 |
COMPILER=$(shell which $(TEX_TO_PDF)) |
| 50 |
ifneq ($(COMPILER),) |
| 51 |
$(info Compiler $(COMPILER) found.) |
| 52 |
else |
| 53 |
# This will *stop* the Makefile |
| 54 |
$(error Unable to find $(TEX_TO_PDF)) |
| 55 |
endif |
| 56 |
# |
| 57 |
# For version.tex building process |
| 58 |
## bacula source directory |
| 59 |
ifeq ($(BACULASRC),) |
| 60 |
BACULASRC=$(HOME) |
| 61 |
endif |
| 62 |
# Location of the version.h file |
| 63 |
VERSION_H=$(shell find $(BACULASRC) -name "version.h" -print) |
| 64 |
ifeq ($(VERSION_H),) |
| 65 |
$(error Unable to find version.h in Bacula source tree $(BACULASRC).) |
| 66 |
else |
| 67 |
$(info $(VERSION_H) file found into $(dir $(VERSION_H))) |
| 68 |
endif |
| 69 |
## Bacula source directory (in the version.h point of view) |
| 70 |
SOURCES_DIR=$(dir $(VERSION_H)) |
| 71 |
## Location and name for the version.tex file |
| 72 |
VERSION_TEX=$(LATEX_DIR)/version.tex |
| 73 |
# |
| 74 |
# Directories required |
| 75 |
## images |
| 76 |
IMAGES_DIR=$(CURDIR)/images |
| 77 |
PNGIMAGES_DIR=$(IMAGES_DIR)/png |
| 78 |
JPGIMAGES_DIR=$(IMAGES_DIR)/jpg |
| 79 |
SVGIMAGES_DIR=$(IMAGES_DIR)/svg |
| 80 |
## covers for manuals |
| 81 |
COVERS_DIR=$(CURDIR)/covers |
| 82 |
## PDF covers |
| 83 |
PDFCOVERS_DIR=$(COVERS_DIR)/pdf |
| 84 |
## SVG covers |
| 85 |
SVGCOVERS_DIR=$(COVERS_DIR)/svg |
| 86 |
## Licence files |
| 87 |
LICENCE_DIR=$(MANUALS_DIR)/licences |
| 88 |
## Coverpage name. There is only one coverpage used by the .cls LaTeX class file. |
| 89 |
BMANUAL_NAME=bcoverpage |
| 90 |
# |
| 91 |
# Makefiles |
| 92 |
## The following Makefile is unique for PDF building and is used whatever the manual is. |
| 93 |
GENERAL_MAKEFILE=$(CURDIR)/manuals/Makefile |
| 94 |
## The following Makefile is unique for HTML building and is used whatever the manual is. |
| 95 |
WEB_MAKEFILE=$(CURDIR)/manuals/web.makefile |
| 96 |
|
| 97 |
export BACULAVERSION |
| 98 |
export PERL5LIB |
| 99 |
export LATEX_DIR |
| 100 |
export IMAGES_DIR |
| 101 |
export COVERS_DIR |
| 102 |
export PDFCOVERS_DIR |
| 103 |
export SVGCOVERS_DIR |
| 104 |
export LICENCE_DIR |
| 105 |
export BMANUAL_NAME |
| 106 |
export COMPILER |
| 107 |
export COVERPAGE_NAME |
| 108 |
export GENERAL_MAKEFILE |
| 109 |
export WEB_MAKEFILE |
| 110 |
export LATEX2HTMLINIT |
| 111 |
export TRANSLATEIMGS |
| 112 |
export LATEX2HTML |
| 113 |
export TOOLSDIR |
| 114 |
export VERSION_TEX |
| 115 |
export TOOLS_DIR |
| 116 |
export PNGIMAGES_DIR |
| 117 |
export JPGIMAGES_DIR |
| 118 |
export SVGIMAGES_DIR |
| 119 |
export SVGCOVERS_DIR |
| 120 |
|
| 121 |
externalreferencesfile=$(LATEX_DIR)/external-references.tex |
| 122 |
|
| 123 |
# Installation target directories & other installation stuff |
| 124 |
prefix = /usr/local |
| 125 |
exec_prefix = ${prefix} |
| 126 |
binprefix = |
| 127 |
manprefix = |
| 128 |
sbindir = ${exec_prefix}/sbin |
| 129 |
sysconfdir = ${prefix}/etc |
| 130 |
scriptdir = @scriptdir@ |
| 131 |
mandir = ${datarootdir}/man/man1 |
| 132 |
manext = 1 |
| 133 |
datarootdir=${prefix}/share |
| 134 |
|
| 135 |
|
| 136 |
# Tools & program stuff |
| 137 |
MV = /bin/mv |
| 138 |
RM = /bin/rm |
| 139 |
RMF = /bin/rm -f |
| 140 |
CP = /bin/cp |
| 141 |
SED = @SED@ |
| 142 |
AWK = /usr/bin/gawk |
| 143 |
ECHO = /bin/echo |
| 144 |
CMP = @CMP@ |
| 145 |
INSTALL = /usr/bin/install -c |
| 146 |
# add the -s to the following in PRODUCTION mode |
| 147 |
INSTALL_PROGRAM = /usr/bin/install -c -m @SBINPERM@ |
| 148 |
INSTALL_DATA = /usr/bin/install -c -m 644 |
| 149 |
INSTALL_SCRIPT = /usr/bin/install -c -m @SBINPERM@ |
| 150 |
INSTALL_CONFIG = /usr/bin/install -c -m 640 |
| 151 |
|
| 152 |
|
| 153 |
# End of common section of the Makefile |
| 154 |
#------------------------------------------------------------------------- |
| 155 |
|
| 156 |
srcdir = . |
| 157 |
.PHONY: latex2html |
| 158 |
.PATH: . |
| 159 |
|
| 160 |
basedir = .. |
| 161 |
topdir = .. |
| 162 |
thisdir = docs |
| 163 |
TRANSLATE=./htmls.sh |
| 164 |
|
| 165 |
# |
| 166 |
# Distribution variables |
| 167 |
# |
| 168 |
|
| 169 |
de_dirs = manuals/de/console manuals/de/developers manuals/de/main \ |
| 170 |
manuals/de/misc manuals/de/problems manuals/de/utility |
| 171 |
|
| 172 |
|
| 173 |
en_dirs = manuals/en/concept manuals/en/console manuals/en/developers manuals/en/main \ |
| 174 |
manuals/en/misc manuals/en/problems manuals/en/utility |
| 175 |
|
| 176 |
es_dirs = manuals/es/console manuals/es/developers manuals/es/main \ |
| 177 |
manuals/es/misc manuals/es/problems manuals/es/utility |
| 178 |
|
| 179 |
fr_dirs = manuals/fr/console manuals/fr/developers manuals/fr/main \ |
| 180 |
manuals/fr/misc manuals/fr/problems manuals/fr/utility |
| 181 |
|
| 182 |
image_dirs = images/svg |
| 183 |
all_dirs = ${de_dirs} ${en_dirs} ${es_dirs} ${fr_dirs} ${image_dirs} |
| 184 |
|
| 185 |
#------------------------------------------------------------------------- |
| 186 |
|
| 187 |
en: all |
| 188 |
|
| 189 |
all: $(VERSION_TEX) latex2html pdf-manuals html-manuals |
| 190 |
$(AT)echo "" |
| 191 |
$(AT)echo "All manuals built ..." |
| 192 |
$(AT)echo "" |
| 193 |
$(AT)echo "" |
| 194 |
$(AT)echo "" |
| 195 |
|
| 196 |
latex2html: $(BBINDIR) |
| 197 |
|
| 198 |
$(BBINDIR): $(LATEX2HTMLMAKEFILE) |
| 199 |
$(AT)$(MAKE) -C $(BLATEX2HTMLDIR) && $(MAKE) -C $(BLATEX2HTMLDIR) install |
| 200 |
|
| 201 |
$(LATEX2HTMLMAKEFILE): |
| 202 |
$(AT)echo "Building latex2html Makefile" |
| 203 |
$(AT)(cd ${BLATEX2HTMLDIR} ; ./configure --prefix=${BBINDIR} --with-texpath=${BTEXDIR}) |
| 204 |
$(AT)echo "Makefile installed." |
| 205 |
|
| 206 |
pdf-manuals: external-references |
| 207 |
$(AT)echo " " |
| 208 |
$(AT)echo "Generating PDF manuals..." |
| 209 |
$(AT)for I in ${en_dirs}; \ |
| 210 |
do $(MAKE) -C $$I pdflatex || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; echo ""; echo ""; exit 1;); done |
| 211 |
|
| 212 |
#(cd $$I; echo "==>Entering directory `pwd`"; \ |
| 213 |
done |
| 214 |
$(AT)echo "" |
| 215 |
$(AT)echo "All PDF manuals built ..." |
| 216 |
$(AT)echo "" |
| 217 |
$(AT)echo "" |
| 218 |
$(AT)echo "" |
| 219 |
|
| 220 |
html-manuals: |
| 221 |
$(AT)echo " " |
| 222 |
$(AT)echo "Creating Web documentation..." |
| 223 |
$(AT)for I in ${en_dirs}; \ |
| 224 |
do (cd $$I; echo "==>Entering directory `pwd`"; \ |
| 225 |
$(MAKE) web || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; \ |
| 226 |
echo ""; echo ""; exit 1;)); \ |
| 227 |
done |
| 228 |
$(AT)echo "Handling external references" |
| 229 |
$(AT)for I in ${en_dirs} ;\ |
| 230 |
do (cd $$I ; $(MAKE) references || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; \ |
| 231 |
echo ""; echo ""; exit 1;)); \ |
| 232 |
done |
| 233 |
$(AT)echo "Remove links ..." |
| 234 |
$(AT)find . -type l -exec rm {} \; |
| 235 |
$(AT)echo "" |
| 236 |
$(AT)echo "All HTML manuals built ..." |
| 237 |
$(AT)echo "" |
| 238 |
$(AT)echo "" |
| 239 |
$(AT)echo "" |
| 240 |
|
| 241 |
|
| 242 |
templates: |
| 243 |
$(AT)echo " " |
| 244 |
$(AT)echo -n "Linking templates.." |
| 245 |
$(AT)mkdir -p ~/texmf/tex/latex/bsys/ |
| 246 |
$(AT)if [ ! -e ~/texmf/tex/latex/bsys/bsysmanual ] || [ -h ~/texmf/tex/latex/bsys/bsysmanual ]; \ |
| 247 |
then\ |
| 248 |
ln -sf `pwd`/bsysmanual ~/texmf/tex/latex/bsys/;\ |
| 249 |
fi |
| 250 |
mktexlsr ~/texmf |
| 251 |
$(AT)echo "Done" |
| 252 |
|
| 253 |
external-references: |
| 254 |
$(AT)echo " " |
| 255 |
$(AT)echo -n "Building external references file" |
| 256 |
$(AT)find ${en_dirs} -mindepth 0 -maxdepth 1 -name "*tex" -exec grep -q '\label' {} \; -print| awk -F/ '{ print "\\externaldocument[" $$3 "-]{../"$$3"/"$$4"}"}'|sed -e 's/.tex//g' > ${externalreferencesfile} |
| 257 |
$(AT)for I in ${en_dirs}; \ |
| 258 |
do $(MAKE) -C $$I $@ || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; echo ""; echo ""; exit 1;); done |
| 259 |
$(AT)echo "All $@ built ..." |
| 260 |
$(AT)echo "External references for all manuals built." |
| 261 |
|
| 262 |
bacula-web: |
| 263 |
$(AT)(if [ -x bacula-web ]; then cd bacula-web; make; fi) |
| 264 |
|
| 265 |
fr: french |
| 266 |
|
| 267 |
french: |
| 268 |
# $(AT)for I in ${fr_dirs}; do (if [ -x $$I ]; then cd $$I; cp -f ../../version.tex .; fi); done |
| 269 |
$(AT)for I in ${fr_dirs}; \ |
| 270 |
do (cd $$I; echo "==>Entering directory `pwd`"; \ |
| 271 |
$(MAKE) all || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; \ |
| 272 |
echo ""; echo ""; exit 1;)); \ |
| 273 |
done |
| 274 |
|
| 275 |
de: german |
| 276 |
|
| 277 |
german: |
| 278 |
# $(AT)for I in ${de_dirs}; do (if [ -x $$I ]; then cd $$I; cp -f ../../version.tex .; fi); done |
| 279 |
$(AT)for I in ${de_dirs}; \ |
| 280 |
do (cd $$I; echo "==>Entering directory `pwd`"; \ |
| 281 |
$(MAKE) all || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; \ |
| 282 |
echo ""; echo ""; exit 1;)); \ |
| 283 |
done |
| 284 |
|
| 285 |
es: spanish |
| 286 |
|
| 287 |
spanish: |
| 288 |
# $(AT)for I in ${es_dirs}; do (if [ -x $$I ]; then cd $$I; cp -f ../../version.tex .; fi); done |
| 289 |
$(AT)for I in ${es_dirs}; \ |
| 290 |
do (cd $$I; echo "==>Entering directory `pwd`"; \ |
| 291 |
$(MAKE) all || (echo ""; echo ""; echo " ====== Error in `pwd` ======"; \ |
| 292 |
echo ""; echo ""; exit 1;)); \ |
| 293 |
done |
| 294 |
|
| 295 |
|
| 296 |
$(basedir)/$(VERNAME).lsm: LSM.in $(srcdir)/../autoconf/Make.common.in $(srcdir)/../src/version.h |
| 297 |
$(SED) $(SEDREPLACE) < $(srcdir)/LSM.in > $@ |
| 298 |
|
| 299 |
clean: |
| 300 |
$(AT)$(RMF) *~ 1 2 3 bacula-doc*.tar.gz |
| 301 |
$(AT)(if [ -x bacula-web ] ; then cd bacula-web; make clean; fi) |
| 302 |
$(AT)for I in ${all_dirs}; \ |
| 303 |
do (if [ -x $$I ]; then cd $$I; echo "==>Entering directory `pwd`"; ${MAKE} $@ || exit 1; fi); done |
| 304 |
|
| 305 |
|
| 306 |
realclean: clean |
| 307 |
|
| 308 |
distclean: $(LATEX2HTMLMAKEFILE) clean |
| 309 |
$(AT)(cd $(BLATEX2HTMLDIR) ; make $@) |
| 310 |
$(AT)rm -rf $(BBINDIR) |
| 311 |
$(AT)rm -rf $(BTEXDIR) |
| 312 |
$(AT)$(RMF) -r CVS html-manual/CVS home-page/CVS techlogs/CVS |
| 313 |
$(AT)$(RMF) -rf autom4te.cache bacula-doc-* config.log config.out |
| 314 |
$(AT)$(RMF) -f config.status kernsconfig |
| 315 |
$(AT)(if [ -x bacula-web ] ; then cd bacula-web; make clean; fi) |
| 316 |
$(AT)for I in ${all_dirs}; \ |
| 317 |
do (if [ -x $$I ]; then ${MAKE} -C $$I $@ || exit 1; fi); done |
| 318 |
$(AT)rm -f ${VERSION_TEX} |
| 319 |
$(AT)rm -f ${externalreferencesfile} |
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
devclean: |
| 324 |
|
| 325 |
depend: |
| 326 |
|
| 327 |
install: |
| 328 |
# $(INSTALL_DATA) bacula.1 $(DESTDIR)$(mandir)/$(manprefix)bacula.$(manext) |
| 329 |
|
| 330 |
uninstall: |
| 331 |
# -cd $(mandir); $(RMF) $(manprefix)bacula.$(manext) |
| 332 |
|
| 333 |
|
| 334 |
version: $(VERSION_TEX) |
| 335 |
|
| 336 |
$(VERSION_TEX): $(VERSION_H) |
| 337 |
$(info Building version.tex) |
| 338 |
$(AT)bacula=$(abspath $(SOURCES_DIR)../..) versionh=$(VERSION_H) versiontex=$(VERSION_TEX) ./update_version |
| 339 |
|
| 340 |
|
| 341 |
verbose: |
| 342 |
$(AT)echo "version.h file: $(VERSION_H)\n" |
| 343 |
$(AT)echo "version.h directory: $(SOURCES_DIR)\n" |
| 344 |
$(AT)echo "version.tex file: $(VERSION_TEX)" |
| 345 |
$(AT)echo "LATEX2HTML_OK: $(LATEX2HTML_OK)" |
| 346 |
$(AT)echo "TEX_TO_PDF: >$(TEX_TO_PDF)<" |
| 347 |
$(AT)echo "TEX_TO_PDF_OK: $(TEX_TO_PDF_OK)" |