summaryrefslogtreecommitdiffstats
path: root/Makefile.common
blob: 5ba4f832b9a8fbe7ab5e0b25e2ed1070c7eadbae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#########################################################################
# Makefile.common
#
# This file, to be included from every document's local Makefile, provides
# the basic targets used by the Fedora Docs Project:
# all			-- Default target, builds HTML document only
# ${DOCNAME}/index.html	-- Builds HTML version of document
# html			-- See "${DOCNAME}/index.html"
# html-nochunks		-- See "${DOCNAME}.html"; single HTML file
# ${DOCNAME}.tar.gz	-- Packages HTML document into a tar archive
# tarball		-- See "${DOCNAME}.tar.gz"
# clean			-- Deletes all generated files and directories
# distclean		-- See "clean"
# ${DOCNAME}.pdf	-- Builds PDF version of document
# pdf			-- See "${DOCNAME}.pdf"
#########################################################################
# PDF generation is still fragile and probably won't work on your document
#########################################################################
# Note: all targets within this Makefile.common must be defined as 
# double-colon (::) targets so that additional steps can be added by
# providing additional rules, also marked with double-colons, in the
# document Makefile.
#########################################################################
# PUT NO TARGETS BEFORE THIS ONE, not even in your base Makefile
# In a properly-constructed Makefile, this will be the default target

.PHONY:	all tarball pdf html html-nochunks clean distclean

all::	${DOCNAME}/index.html

# The "tarball" or "${DOCNAME}.tar.gz" target will bind the HTML formatted
# document into a compressed tar archive.

tarball ${DOCNAME}.tar.gz:: ${DOCNAME}/index.html
	tar -zcf ${DOCNAME}.tar.gz ${DOCNAME}

# The "pdf" or "${DOCNAME}.pdf" target produces an Adobe Portable Document
# Format (PDF) file as output.

pdf ${DOCNAME}.pdf:: ${XMLFILE} ${XMLEXTRAFILES}
	xmlto pdf -x $(XSLPDF) $(XMLFILE)

# The "html" or "${DOCNAME}.
html ${DOCNAME}/index.html:: ${XMLFILE} ${XMLEXTRAFILES}
	xmlto html -x $(XSLHTML) -o $(DOCNAME) $(XMLFILE)
	mkdir -p $(DOCNAME)/stylesheet-images
	cp ../docs-common/stylesheet-images/*.png $(DOCNAME)/stylesheet-images
	cp ../docs-common/css/fedora.css $(DOCNAME)

html-nochunks $(DOCNAME).html:: ${XMLFILE} ${XMLEXTRAFILES}
	xmlto html-nochunks -x $(XSLHTMLNOCHUNKS) $(XMLFILE)
	mkdir -p stylesheet-images
	cp ../docs-common/stylesheet-images/*.png stylesheet-images
	cp ../docs-common/css/fedora.css .

# The "view" target ensures that the HTML version of the document is built
# then displays it using the "htmlview" tool to start up the browser.  It
# assumes that the current working directory is immediately above the HTML
# document directory.  (We could change this if we wanted to futz around 
# with making up an absolute pathname, but why bother.)

view::	${DOCNAME}/index.html
	/usr/bin/htmlview file://localhost/${PWD}/${DOCNAME}/index.html

# The "clean" or "distclean" target will remove all generated and temporary
# files.

distclean clean: 
	${RM} -r ${DOCNAME}.pdf $(DOCNAME) \
	      ${DOCNAME}.tar.gz \
	      ${DOCNAME}.html stylesheet-images fedora.css