source: Makefile@ cb55412

10.0 10.1 11.0 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 ken/refactor-virt krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk upgradedb xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since cb55412 was cb55412, checked in by Dan Nichilson <dnicholson@…>, 14 years ago

Correct the prerequisite for the "test-links" target

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@7449 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 5.9 KB
Line 
1# Makefile for BLFS Book generation.
2# By Tushar Teredesai <tushar@linuxfromscratch.org>
3# 2004-01-31
4# $LastChangedBy$
5# $Date$
6
7# Adjust these to suit your installation
8BASEDIR ?= $(HOME)/public_html/blfs-book-xsl
9DUMPDIR ?= $(HOME)/blfs-commands
10RENDERTMP ?= tmp
11CHUNK_QUIET = 1
12ROOT_ID =
13PDF_OUTPUT = BLFS-BOOK.pdf
14NOCHUNKS_OUTPUT = BLFS-BOOK.html
15
16ALLXML := $(filter-out $(RENDERTMP)/%, \
17 $(wildcard *.xml */*.xml */*/*.xml */*/*/*.xml */*/*/*/*.xml))
18ALLXSL := $(filter-out $(RENDERTMP)/%, \
19 $(wildcard *.xsl */*.xsl */*/*.xsl */*/*/*.xsl */*/*/*/*.xsl))
20
21ifdef V
22 Q =
23else
24 Q = @
25endif
26
27blfs: html wget-list
28all: blfs nochunks pdf
29world: all blfs-patch-list dump-commands test-links
30
31html: $(BASEDIR)/index.html
32$(BASEDIR)/index.html: $(RENDERTMP)/blfs-html.xml
33 @echo "Generating chunked XHTML files..."
34 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
35 -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \
36 stylesheets/blfs-chunked.xsl $(RENDERTMP)/blfs-html.xml
37
38 @echo "Copying CSS code and images..."
39 $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
40 mkdir -p $(BASEDIR)/stylesheets; \
41 fi;
42 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
43 $(Q)if [ ! -e $(BASEDIR)/images ]; then \
44 mkdir -p $(BASEDIR)/images; \
45 fi;
46 $(Q)cp images/*.png $(BASEDIR)/images
47 $(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
48 $(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
49
50 @echo "Running Tidy and obfuscate.sh on chunked XHTML..."
51 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
52 tidy -config tidy.conf $$filename; \
53 true; \
54 sh obfuscate.sh $$filename; \
55 sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
56 done;
57
58pdf: $(BASEDIR)/$(PDF_OUTPUT)
59$(RENDERTMP)/blfs-pdf.xml: $(RENDERTMP)/blfs-full.xml
60 @echo "Generating profiled XML for PDF..."
61 $(Q)xsltproc --nonet --stringparam profile.condition pdf \
62 --output $(RENDERTMP)/blfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
63 $(RENDERTMP)/blfs-full.xml
64
65$(RENDERTMP)/blfs-pdf.fo: $(RENDERTMP)/blfs-pdf.xml
66 @echo "Generating FO file..."
67 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
68 --output $(RENDERTMP)/blfs-pdf.fo stylesheets/blfs-pdf.xsl \
69 $(RENDERTMP)/blfs-pdf.xml
70 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/blfs-pdf.fo
71
72$(BASEDIR)/$(PDF_OUTPUT): $(RENDERTMP)/blfs-pdf.fo
73 @echo "Generating PDF file..."
74 $(Q)if [ ! -e $(BASEDIR) ]; then \
75 mkdir -p $(BASEDIR); \
76 fi;
77 $(Q)fop $(RENDERTMP)/blfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
78
79nochunks: $(BASEDIR)/$(NOCHUNKS_OUTPUT)
80$(BASEDIR)/$(NOCHUNKS_OUTPUT): $(RENDERTMP)/blfs-html.xml
81 @echo "Generating non-chunked XHTML file..."
82 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
83 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
84 stylesheets/blfs-nochunks.xsl $(RENDERTMP)/blfs-html.xml
85
86 @echo "Running Tidy and obfuscate.sh on non-chunked XHTML..."
87 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
88 $(Q)sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
89 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
90 $(BASEDIR)/$(NOCHUNKS_OUTPUT)
91
92tmpdir: $(RENDERTMP)
93$(RENDERTMP):
94 @echo "Creating $(RENDERTMP)"
95 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
96
97clean:
98 @echo "Cleaning $(RENDERTMP)"
99 $(Q)rm -f $(RENDERTMP)/blfs-{full,html,pdf}.xml
100 $(Q)rm -f $(RENDERTMP)/blfs-pdf.fo
101 $(Q)rm -f $(RENDERTMP)/blfs-{patch-list,patches}
102 $(Q)rmdir $(RENDERTMP) 2>/dev/null || :
103
104validxml: $(RENDERTMP)/blfs-full.xml
105$(RENDERTMP)/blfs-full.xml: general.ent $(ALLXML) $(ALLXSL)
106 @echo "Validating the book..."
107 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
108 $(Q)xmllint --nonet --noent --xinclude --postvalid \
109 -o $(RENDERTMP)/blfs-full.xml index.xml
110
111profile-html: $(RENDERTMP)/blfs-html.xml
112$(RENDERTMP)/blfs-html.xml: $(RENDERTMP)/blfs-full.xml
113 @echo "Generating profiled XML for XHTML..."
114 $(Q)xsltproc --nonet --stringparam profile.condition html \
115 --output $(RENDERTMP)/blfs-html.xml stylesheets/lfs-xsl/profile.xsl \
116 $(RENDERTMP)/blfs-full.xml
117
118blfs-patch-list: blfs-patches.sh
119 @echo "Generating blfs patch list..."
120 $(Q)awk '{if ($$1 == "copy") {sub(/.*\//, "", $$2); print $$2}}' \
121 blfs-patches.sh > blfs-patch-list
122
123blfs-patches.sh: $(RENDERTMP)/blfs-full.xml
124 @echo "Generating blfs patch script..."
125 $(Q)xsltproc --nonet --output blfs-patches.sh \
126 stylesheets/patcheslist.xsl $(RENDERTMP)/blfs-full.xml
127
128wget-list: $(BASEDIR)/wget-list
129$(BASEDIR)/wget-list: $(RENDERTMP)/blfs-full.xml
130 @echo "Generating wget list..."
131 $(Q)mkdir -p $(BASEDIR)
132 $(Q)xsltproc --nonet --output $(BASEDIR)/wget-list \
133 stylesheets/wget-list.xsl $(RENDERTMP)/blfs-full.xml
134
135test-links: $(BASEDIR)/test-links
136$(BASEDIR)/test-links: $(RENDERTMP)/blfs-full.xml
137 @echo "Generating test-links file..."
138 $(Q)mkdir -p $(BASEDIR)
139 $(Q)xsltproc --nonet --stringparam list_mode full \
140 --output $(BASEDIR)/test-links stylesheets/wget-list.xsl \
141 $(RENDERTMP)/blfs-full.xml
142
143 @echo "Checking URLs, first pass..."
144 $(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
145 $(Q)for URL in `cat $(BASEDIR)/test-links`; do \
146 wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
147 if test $$? -ne 0 ; then echo $$URL >> $(BASEDIR)/bad_urls ; \
148 else echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
149 fi; \
150 done
151
152 @echo "Checking URLs, second pass..."
153 $(Q)for URL2 in `cat $(BASEDIR)/bad_urls`; do \
154 wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
155 if test $$? -ne 0 ; then echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
156 else echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
157 fi; \
158 done
159
160dump-commands: $(DUMPDIR)
161$(DUMPDIR): $(RENDERTMP)/blfs-full.xml
162 @echo "Dumping book commands..."
163 $(Q)xsltproc --output $(DUMPDIR)/ \
164 stylesheets/dump-commands.xsl $(RENDERTMP)/blfs-full.xml
165 $(Q)touch $(DUMPDIR)
166
167validate:
168 @echo "Validating the book..."
169 $(Q)xmllint --noout --nonet --xinclude --postvalid index.xml
170
171.PHONY: blfs all world html pdf nochunks tmpdir clean validxml \
172 profile-html wget-list test-links dump-commands validate
Note: See TracBrowser for help on using the repository browser.