/
Makefile
112 lines (83 loc) · 3.05 KB
/
Makefile
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Makefile for DocBoook compilation
#
# $Id: Makefile,v 1.5 2004/10/01 12:54:37 giallu Exp $
#
#
# Some things to remember:
# - The main DocBook name is $BOOK.sgml
# - All other files should have .sgml extension
# - Images should go into ./images directory
# - Images should be in png format
#
# Output directory
BUILD_DIR:=build
# Installation directory
INSTALL_DIR:=install
# Book name: will be used to build the input filename ($BOOK.sgml)
# and the output filename ($BOOK.html, $BOOK.pdf and so on)
BOOK:=administration_guide
# Stylesheet name. Original file from:
# /usr/share/sgml/docbook/utils-0.6.11/docbook-utils.dsl
#
STYLE=stylesheet.dsl
FILES:=$(BOOK).sgml $(wildcard *.sgml) $(STYLE) builddate
IMAGES:=$(wildcard images/*.png)
EPSS:=$(IMAGES:.png=.eps)
default: help
all: html pdf
#all: html html_onefile text pdf ps sgml.gz html.tar.gz
html: $(BUILD_DIR)/$(BOOK)/$(BOOK).html
html_onefile: $(BUILD_DIR)/$(BOOK).html
pdf: $(BUILD_DIR)/$(BOOK).pdf
ps: $(BUILD_DIR)/$(BOOK).ps
rtf: $(BUILD_DIR)/$(BOOK).rtf
text: $(BUILD_DIR)/$(BOOK).txt
builddate:
echo -n $$(LANG="en_US";date "+%e %B %Y") > $@
html.tar.gz: html
(for i in $(files); do \
tar -cf $$i.tar $$i; \
gzip -f $$i.tar; \
done; )
$(BUILD_DIR)/$(BOOK)/$(BOOK).html: $(FILES) $(IMAGES)
jw -d $(STYLE)#html -f docbook -b html -o $(BUILD_DIR)/$(BOOK) $<
-cp -r images $(BUILD_DIR)/$(BOOK)/
$(BUILD_DIR)/$(BOOK).pdf: $(FILES) $(IMAGES)
jw -d $(STYLE)#print -f docbook -b pdf -o $(BUILD_DIR) $<
$(BUILD_DIR)/$(BOOK).html: $(FILES) $(IMAGES)
jw -d $(STYLE)#html -f docbook -b html -o $(BUILD_DIR) -u $<
$(BUILD_DIR)/$(BOOK).ps: $(FILES) $(EPSS)
jw -d $(STYLE) -f docbook -b ps -o $(BUILD_DIR) $<
$(BUILD_DIR)/$(BOOK).rtf: $(FILES) $(IMAGES)
jw -d $(STYLE) -f docbook -b rtf -o $(BUILD_DIR) $<
$(BUILD_DIR)/$(BOOK).txt: $(FILES)
jw -f docbook -b txt -o $(BUILD_DIR) $<
# pattern rules to convert PNGs to EPS
#
%.eps : %.png
pngtopnm $< | pnmtops -noturn > $@
.PHONY: valid install clean dist help
valid:
nsgmls -s $(BOOK).sgml
install:
-mkdir -p $(INSTALL_DIR)
-cp -r $(BUILD_DIR)/$(BOOK) $(BUILD_DIR)/$(BOOK).pdf $(BUILD_DIR)/$(BOOK).html $(BUILD_DIR)/$(BOOK).ps $(BUILD_DIR)/$(BOOK).rtf $(BUILD_DIR)/$(BOOK).txt $(INSTALL_DIR)
clean:
-$(RM) *.log *.dvi *.aux *.tex *.out
-$(RM) $(GENERATED_IMG) builddate
-$(RM) -r $(BUILD_DIR)/$(BOOK)
-$(RM) $(BUILD_DIR)/$(BOOK).html $(BUILD_DIR)/$(BOOK).ps $(BUILD_DIR)/$(BOOK).pdf $(BUILD_DIR)/$(BOOK).rtf $(BUILD_DIR)/$(BOOK).txt
# Rebuild everything
dist: clean all
help:
@echo "Usage: make <target>"
@echo "Available targets are:"
@echo " help Show this text"
@echo " html Convert to HTML (split pages)"
@echo " html_onefile Convert to HTML (single page)"
@echo " pdf Convert to PDF"
@echo " rtf Convert to RTF"
@echo " ps Convert to Postscript"
@echo " text Convert to plain text"
@echo " clean Remove output and temporary files"
@echo " valid Check book correctness with nsgmls"