| 1 |
#
|
| 2 |
# New Makefile Template (Osamu Aoki)
|
| 3 |
#
|
| 4 |
# Build html(multi-page), txt, ps, pdf, and other formats.
|
| 5 |
#
|
| 6 |
# Should work both for a manual in the Debian Documentation Project
|
| 7 |
# manuals.sgml tree, and for the package build.
|
| 8 |
# ------------------------------------------------------------------- #
|
| 9 |
# WARNING #
|
| 10 |
# Use with caution, aimed at woody system #
|
| 11 |
# "ps" and "pdf" tends to break in some ill-configured system #
|
| 12 |
# ------------------------------------------------------------------- #
|
| 13 |
|
| 14 |
# Following default shall be editted buy the cordinaor for the entire
|
| 15 |
# set of languages. If each subsection owner wish to overide setyings,
|
| 16 |
# this can be overriden by running make with "make 'LANGS=fi'" etc..
|
| 17 |
|
| 18 |
# =================================================================== #
|
| 19 |
# Default configuration part: Customize #
|
| 20 |
# =================================================================== #
|
| 21 |
|
| 22 |
# The directory in which this makefile resides must also contain a file
|
| 23 |
# called <directoryname>.[<language>.]sgml, which is the top-level file
|
| 24 |
# for the manual in this directory.
|
| 25 |
|
| 26 |
export PATH:=../quick-reference/bin/:${PATH}
|
| 27 |
|
| 28 |
# Basename for language dependent sgml (DDP default, generated)
|
| 29 |
MANUAL := $(notdir $(CURDIR))
|
| 30 |
|
| 31 |
# Basename for language independent sgml-template.
|
| 32 |
MANUAL0 := $(MANUAL)
|
| 33 |
|
| 34 |
# Build type: Possible values are BUILD_TYPE = web|package
|
| 35 |
BUILD_TYPE := web
|
| 36 |
# Set parameters by build environment
|
| 37 |
|
| 38 |
ifeq ("$(BUILD_TYPE)", "web")
|
| 39 |
# DDP site or checked out source from DDP
|
| 40 |
else
|
| 41 |
# Default: for Debian package
|
| 42 |
endif
|
| 43 |
|
| 44 |
# Publish directory
|
| 45 |
# This can and will be overriden by a higher level makefile
|
| 46 |
PUBLISHDIR := /org/www.debian.org/www/doc/manuals
|
| 47 |
|
| 48 |
# List of languages build for "publish" target for DDP
|
| 49 |
LANGS := en fr it
|
| 50 |
|
| 51 |
# Files which affect SGML generation (excluding *.sgml)
|
| 52 |
SGMLENTS := custom.ent default.ent dynamic.%.ent
|
| 53 |
|
| 54 |
# All SGML source files
|
| 55 |
SGMLSRCS := $(foreach lang, $(LANGS), $(MANUAL).$(lang).sgml) \
|
| 56 |
$(foreach lang, $(LANGS), $(wildcard $(lang)/*.sgml ) ) \
|
| 57 |
$(SGMLENTS)
|
| 58 |
|
| 59 |
# Name for example directory
|
| 60 |
EXAMPLE := examples
|
| 61 |
|
| 62 |
# List of example to be copied
|
| 63 |
EXAMPLES := $(wildcard $(EXAMPLE)/*)
|
| 64 |
|
| 65 |
# List of all files in tar
|
| 66 |
TARSRCS = $(EXAMPLES) bin/* $(SGMLSRCS) Makefile TODO PROJECT README
|
| 67 |
|
| 68 |
# =================================================================== #
|
| 69 |
# Build target default part: Routine #
|
| 70 |
# =================================================================== #
|
| 71 |
# If some languages have problem building, filter-out in here.
|
| 72 |
|
| 73 |
# List of parent sgml to be build for each language
|
| 74 |
SGMLS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).sgml)
|
| 75 |
|
| 76 |
# List of html stamp files to be built
|
| 77 |
HTMLS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).html.stamp)
|
| 78 |
|
| 79 |
# List of pdf to be build
|
| 80 |
TXTS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).txt)
|
| 81 |
|
| 82 |
# List of ps to be build
|
| 83 |
PSS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).ps)
|
| 84 |
|
| 85 |
# List of pdf to be build
|
| 86 |
PDFS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).pdf)
|
| 87 |
|
| 88 |
# =================================================================== #
|
| 89 |
# Build target part: Customize #
|
| 90 |
# =================================================================== #
|
| 91 |
# If some language have problem building, filter-out in here.
|
| 92 |
|
| 93 |
all: html txt ps pdf
|
| 94 |
sgml: $(SGMLS)
|
| 95 |
html: $(HTMLS)
|
| 96 |
txt: $(TXTS)
|
| 97 |
ps: $(PSS)
|
| 98 |
pdf: $(PDFS)
|
| 99 |
tar: $(MANUAL).tar.gz
|
| 100 |
|
| 101 |
# Until woody, we will not build ps/pdf
|
| 102 |
publish: publish-html publish-examples publish-txt publish-ps publish-pdf
|
| 103 |
#publish: publish-html publish-examples publish-txt
|
| 104 |
publish-all: publish publish-tar
|
| 105 |
|
| 106 |
# =================================================================== #
|
| 107 |
# Build rule part: If not package build #
|
| 108 |
# =================================================================== #
|
| 109 |
|
| 110 |
dynamic.%.ent:
|
| 111 |
echo "<!entity language \"$*\">" > $@
|
| 112 |
echo "<!entity % lang-$* \"INCLUDE\">" >> $@
|
| 113 |
echo "<!entity docdate \"`LC_ALL=C date -R`\">" >> $@
|
| 114 |
echo "<!entity docversion \"CVS\">" >> $@
|
| 115 |
|
| 116 |
# =================================================================== #
|
| 117 |
# Build rule part: Routine #
|
| 118 |
# =================================================================== #
|
| 119 |
|
| 120 |
# SGML
|
| 121 |
|
| 122 |
# Create starting SGML for each language from the template. Actual
|
| 123 |
# contents reside in language segrigated subdirectories.
|
| 124 |
|
| 125 |
#$(MANUAL).%.sgml: $(MANUAL0).sgml
|
| 126 |
# sed -e "s/@@@@/$*/g" $< > $(MANUAL).$*.sgml
|
| 127 |
|
| 128 |
# If sgml for original language "en" does not use mid-extension
|
| 129 |
%.en.sgml: %.sgml
|
| 130 |
ln -sf $*.sgml $*.en.sgml
|
| 131 |
|
| 132 |
# HTML
|
| 133 |
|
| 134 |
$(MANUAL).%.html.stamp: $(MANUAL).%.sgml $(SGMLSRCS)
|
| 135 |
debiandoc2html -l $* -c $<
|
| 136 |
# since $(MANUAL).%.html/index.%.html can not be a target file
|
| 137 |
touch $(MANUAL).$*.html.stamp
|
| 138 |
|
| 139 |
# TXT
|
| 140 |
|
| 141 |
$(MANUAL).%.txt: $(MANUAL).%.sgml $(SGMLSRCS)
|
| 142 |
debiandoc2text -l $* $<
|
| 143 |
|
| 144 |
# PS
|
| 145 |
|
| 146 |
$(MANUAL).%.ps: $(MANUAL).%.sgml $(SGMLSRCS)
|
| 147 |
debiandoc2latexps -l $* $<
|
| 148 |
|
| 149 |
# PDF
|
| 150 |
|
| 151 |
$(MANUAL).%.pdf: $(MANUAL).%.sgml $(SGMLSRCS)
|
| 152 |
debiandoc2latexpdf -l $* $<
|
| 153 |
|
| 154 |
# TAR
|
| 155 |
|
| 156 |
$(MANUAL).tar.gz: $(TARSRCS)
|
| 157 |
@tar cvzf $(MANUAL).tar.gz $(TARSRCS)
|
| 158 |
|
| 159 |
# =================================================================== #
|
| 160 |
# Build rule part: Web publish #
|
| 161 |
# =================================================================== #
|
| 162 |
|
| 163 |
publish-html: html
|
| 164 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 165 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 166 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
|
| 167 |
# install all html
|
| 168 |
@$(foreach lang,$(LANGS),\
|
| 169 |
install -p -m 644 $(MANUAL).$(lang).html/*.html \
|
| 170 |
$(PUBLISHDIR)/$(MANUAL)/ ;\
|
| 171 |
)
|
| 172 |
# Ugly but until updating all the web pages, needs these symlinks
|
| 173 |
ifeq ("$(BUILD_TYPE)", "web")
|
| 174 |
# cd $(PUBLISHDIR) ; rm -f quick-reference ; ln -sf $(MANUAL) quick-reference
|
| 175 |
endif
|
| 176 |
|
| 177 |
publish-examples: $(EXAMPLES)
|
| 178 |
test -d $(PUBLISHDIR)/$(MANUAL)/$(EXAMPLE) \
|
| 179 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)/$(EXAMPLE)
|
| 180 |
@install -p -m 644 --preserve-timestamps \
|
| 181 |
`find $(EXAMPLE) -type f -maxdepth 1` $(PUBLISHDIR)/$(MANUAL)/$(EXAMPLE)/
|
| 182 |
|
| 183 |
publish-txt: txt
|
| 184 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 185 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 186 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.txt
|
| 187 |
$(foreach lang,$(LANGS), \
|
| 188 |
install -p -m 644 $(MANUAL).$(lang).txt $(PUBLISHDIR)/$(MANUAL)/ ; )
|
| 189 |
|
| 190 |
publish-ps: ps
|
| 191 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 192 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 193 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps
|
| 194 |
$(foreach lang,$(LANGS), \
|
| 195 |
install -p -m 644 $(MANUAL).$(lang).ps $(PUBLISHDIR)/$(MANUAL)/ ; )
|
| 196 |
|
| 197 |
publish-pdf: pdf
|
| 198 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 199 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 200 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.pdf
|
| 201 |
$(foreach lang,$(LANGS), \
|
| 202 |
install -p -m 644 $(MANUAL).$(lang).pdf $(PUBLISHDIR)/$(MANUAL)/ ; )
|
| 203 |
|
| 204 |
publish-tar: $(MANUAL).tar.gz
|
| 205 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 206 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 207 |
rm -f $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).tar.gz
|
| 208 |
install -p -m 644 $(MANUAL).tar.gz $(PUBLISHDIR)/$(MANUAL)/
|
| 209 |
|
| 210 |
#====[ sourceforge maint-script ]==============================================
|
| 211 |
# If we decide to update some server remotely rather than by CRON job
|
| 212 |
# This may be useful
|
| 213 |
#sf:
|
| 214 |
# $(MAKE) BUILD_TYPE=sf "LANGS=en fr it fi pt es" scp
|
| 215 |
|
| 216 |
#sf-test:
|
| 217 |
# $(MAKE) BUILD_TYPE=sf "LANGS=en fr it fi pt es" html
|
| 218 |
|
| 219 |
#sf-clean:
|
| 220 |
# $(MAKE) BUILD_TYPE=sf distclean
|
| 221 |
|
| 222 |
#scp: publish-all
|
| 223 |
# scp -pr $(PUBLISHDIR)/$(MANUAL)/ \
|
| 224 |
# $$USER@shell.sf.net:/home/groups/q/qr/qref/htdocs/ddp
|
| 225 |
|
| 226 |
#====[ validating SGML ]=======================================================
|
| 227 |
validate:
|
| 228 |
set -x; for i in $(LANGS); do $(MAKE) validate.$$i ; done
|
| 229 |
|
| 230 |
validate.%: $(SGMLSRCS)
|
| 231 |
nsgmls -gues -wall $(MANUAL).$*.sgml
|
| 232 |
|
| 233 |
#====[ cleaning up ]===========================================================
|
| 234 |
distclean: clean
|
| 235 |
rm -rf $(PUBLISHDIR)/$(MANUAL)
|
| 236 |
|
| 237 |
clean:
|
| 238 |
rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*,out,tov}
|
| 239 |
rm -f *~ prior.aux pprior.aux tar.gz.log
|
| 240 |
rm -f $(MANUAL).??.sgml *.error dynamic.??.ent date.ent $(MANUAL).tar.gz
|
| 241 |
rm -rf $(MANUAL)*.html *stamp
|
| 242 |
|
| 243 |
.PHONY: all html txt ps pdf files tar\
|
| 244 |
publish publish-all publish-html publish-files publish-tar \
|
| 245 |
clean distclean validate
|