Commit | Line | Data |
---|---|---|
970ed795 EL |
1 | ############################################################################### |
2 | # Copyright (c) 2000-2014 Ericsson Telecom AB | |
3 | # All rights reserved. This program and the accompanying materials | |
4 | # are made available under the terms of the Eclipse Public License v1.0 | |
5 | # which accompanies this distribution, and is available at | |
6 | # http://www.eclipse.org/legal/epl-v10.html | |
7 | ############################################################################### | |
8 | # Makefile for the TITAN User Guide | |
9 | ||
10 | TOP := .. | |
11 | include ../Makefile.cfg | |
12 | ||
13 | .SUFFIXES: .tex .labels .dvi .ps .pdf | |
14 | ||
af710487 | 15 | DOC2PDF_JAR := ../../titan_playground/jar/doc2pdf.jar |
16 | WARNING_TXT := warning.txt | |
970ed795 | 17 | TITAN_DOCS := apiguide.doc userguide.doc installationguide.doc referenceguide.doc releasenotes.doc |
970ed795 EL |
18 | TITAN_PDFS := $(TITAN_DOCS:.doc=.pdf) |
19 | ||
20 | ifeq ($(GEN_PDF), yes) | |
21 | ||
af710487 | 22 | # Install with error handling: Tries to create PDFs and copy the available documents to $(DOCDIR). |
23 | # On success (PDF files are successfully created), the PDF files are copied to the $(DOCDIR) directory. | |
24 | # On failure (if doc2pdf.jar is not available or install_pdf exits with error, so PDFs are not created), the DOC files are copied to the $(DOCDIR) directory instead of the PDF files. | |
25 | install: | |
26 | { make test_doc2pdf_jar && make install_pdf; } || make install_error_handling | |
27 | ||
28 | # Checks if $(DOC2PDF_JAR) is present, and exit with error if not. | |
29 | test_doc2pdf_jar: | |
30 | @{ test -f $(DOC2PDF_JAR) && echo "$(DOC2PDF_JAR) is present .. OK"; } || { echo "ERROR: $(DOC2PDF_JAR) is missing" && false; }; | |
31 | ||
32 | # Install PDFs normal case: PDFs are created and copied to the $(DOCDIR) directory. | |
33 | # PDF creation may fail if doc2pdf.jar fails, which can happen for example if the server, that converts from DOC to PDF, is not available. In this case the target exits with error. | |
34 | install_pdf: $(TITAN_PDFS) | |
970ed795 EL |
35 | ifdef MINGW |
36 | $(info Skipped ${CURDIR} for MinGW) | |
37 | else | |
38 | mkdir -p $(DOCDIR) | |
39 | cp $(TITAN_PDFS) $(DOCDIR) | |
40 | endif | |
41 | ||
af710487 | 42 | # Copies DOC files to $(DOCDIR) instead of the PDF files, because PDF creation failed. Also a $(WARNING_TXT) is created |
43 | install_error_handling: | |
44 | @echo "Error handling: DOC files are copied to $(DOCDIR) instead of PDF files" | |
45 | ifdef MINGW | |
46 | $(info Skipped ${CURDIR} for MinGW) | |
47 | else | |
48 | mkdir -p $(DOCDIR) | |
49 | cp $(TITAN_DOCS) $(DOCDIR) | |
50 | @echo "Creating $(WARNING_TXT)" | |
51 | @echo "DOC files are copied to $(DOCDIR) instead of PDF files." >$(WARNING_TXT) | |
52 | @echo "It is because $(DOC2PDF_JAR) is missing or failed, which can happen for example if the server, that converts from DOC to PDF, is not available." >>$(WARNING_TXT) | |
53 | cp $(WARNING_TXT) $(DOCDIR) | |
54 | endif | |
55 | ||
56 | # Converts DOC to PDF | |
57 | # $@ : target name, for example: apiguide.pdf | |
58 | # $(basename $@) : target name without extension, for example: apiguide | |
970ed795 | 59 | %.pdf : %.doc |
af710487 | 60 | @java -jar $(DOC2PDF_JAR) $(basename $@).doc $@ || { echo "ERROR: doc2pdf.jar failed with $(basename $@).doc" && false; } |
970ed795 EL |
61 | |
62 | else | |
af710487 | 63 | # GEN_PDF == no |
970ed795 EL |
64 | install: |
65 | endif | |
66 | ||
67 | release: | |
68 | $(MAKE) install GEN_PDF=yes | |
69 | ||
70 | all run: | |
71 | ||
72 | clean: | |
73 | ||
74 | distclean:clean | |
75 | ||
76 | dep: | |
af710487 | 77 |