| 1 |
jfs |
1391 |
#
|
| 2 |
|
|
# Makefile for the Debian New Maintainers' Guide
|
| 3 |
|
|
#
|
| 4 |
|
|
# Should work both for a manual in the Debian Documentation Project
|
| 5 |
|
|
# manuals.sgml tree, and for maint-guide package build.
|
| 6 |
|
|
|
| 7 |
|
|
##### CONF PART
|
| 8 |
|
|
# this can and will be overriden by a higher level makefile
|
| 9 |
osamu |
1399 |
|
| 10 |
|
|
HTDOCS := $(notdir $(patsubst %/,%, $(dir $(shell pwd))))
|
| 11 |
|
|
ifeq ("$(HTDOCS)", "manuals.sgml")
|
| 12 |
|
|
# DDP site or checked out source from DDP
|
| 13 |
jfs |
1391 |
PUBLISHDIR := ../../../public_html/manuals.html
|
| 14 |
osamu |
1399 |
MANUAL := $(notdir $(shell pwd))
|
| 15 |
|
|
else
|
| 16 |
|
|
ifeq ("$(HTDOCS)", "htdocs")
|
| 17 |
|
|
# qref.sourceforge.net
|
| 18 |
|
|
PUBLISHDIR := ./
|
| 19 |
|
|
MANUAL := qref
|
| 20 |
|
|
else
|
| 21 |
|
|
# default: checked out source from qref.sourceforge.net
|
| 22 |
|
|
PUBLISHDIR := $$HOME/public_html
|
| 23 |
|
|
MANUAL := qref
|
| 24 |
|
|
endif
|
| 25 |
|
|
endif
|
| 26 |
jfs |
1391 |
|
| 27 |
|
|
# The cannonical language, in which the original document is
|
| 28 |
|
|
ORIG_LANG=en
|
| 29 |
|
|
# list of langs (above the canonical one)
|
| 30 |
|
|
LANGS=fr it
|
| 31 |
osamu |
1399 |
#LANGS=
|
| 32 |
jfs |
1391 |
|
| 33 |
osamu |
1397 |
# Because Latex is hard to work with, I just to do text for now
|
| 34 |
|
|
# When it is not a problem to enable others, we should enable the rest.
|
| 35 |
|
|
#EXTS=ps pdf txt tov info
|
| 36 |
|
|
EXTS=txt
|
| 37 |
osamu |
1385 |
# default language for build
|
| 38 |
jfs |
1391 |
TLANG := en
|
| 39 |
osamu |
1385 |
# default language for build (LATEX related specification)
|
| 40 |
jfs |
1391 |
LLANG := en
|
| 41 |
osamu |
1385 |
# build flag for SGML parse.
|
| 42 |
jfs |
1391 |
BOOK := qref
|
| 43 |
|
|
##### END OF CONF PART CHANGE THE END AT YOU OWN RISK
|
| 44 |
osamu |
1385 |
|
| 45 |
jfs |
1391 |
# what will be built
|
| 46 |
|
|
HTMLDIRS=$(MANUAL).html $(foreach lang,$(LANGS),$(MANUAL).$(lang).html)
|
| 47 |
|
|
ALLFILES=$(foreach ext,$(EXTS),\
|
| 48 |
|
|
$(MANUAL).$(ORIG_LANG).$(ext)\
|
| 49 |
|
|
$(foreach lang,$(LANGS),$(MANUAL).$(lang).$(ext))\
|
| 50 |
|
|
)
|
| 51 |
osamu |
1385 |
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
jfs |
1391 |
#====[ build rules ]===========================================================
|
| 55 |
osamu |
1398 |
# generate anything some dirs want version.ent to be built, some not
|
| 56 |
osamu |
1385 |
|
| 57 |
jfs |
1391 |
DEBIAN=$(wildcard debian)
|
| 58 |
|
|
ifeq ($(DEBIAN),"debian")
|
| 59 |
osamu |
1398 |
all: version.ent $(HTMLDIRS) $(ALLFILES) publish
|
| 60 |
jfs |
1391 |
else
|
| 61 |
osamu |
1398 |
all: $(HTMLDIRS) $(ALLFILES) publish
|
| 62 |
jfs |
1391 |
endif
|
| 63 |
|
|
|
| 64 |
|
|
version.ent: debian/changelog
|
| 65 |
|
|
./debian/rules $@
|
| 66 |
|
|
|
| 67 |
|
|
DATE := `date --utc +"%Y.%m.%d-%H:%M"`
|
| 68 |
|
|
|
| 69 |
|
|
# --- build sgml
|
| 70 |
|
|
#
|
| 71 |
osamu |
1385 |
date.ent:
|
| 72 |
jfs |
1391 |
: > $@ # clear the file
|
| 73 |
osamu |
1385 |
@echo "<!entity date \"$(DATE)\">" >> $@
|
| 74 |
|
|
|
| 75 |
|
|
# generate entities which are dynamically defined by the settings of this
|
| 76 |
jfs |
1391 |
# build run, generally set in the top-level config file (always make)
|
| 77 |
osamu |
1385 |
dynamic.ent::
|
| 78 |
osamu |
1399 |
@#echo H===$(HTDOCS)===
|
| 79 |
|
|
@#echo M===$(MANUAL)===
|
| 80 |
|
|
@#echo M===$(PUBLISHDIR)===
|
| 81 |
jfs |
1391 |
: > $@ # clear the file
|
| 82 |
osamu |
1385 |
@echo "<!entity language \"$(TLANG)\">" >> $@
|
| 83 |
|
|
@echo "<!entity % lang-$(TLANG) \"INCLUDE\">" >> $@
|
| 84 |
|
|
@echo "<!entity booklet \"$(BOOK)\">" >> $@
|
| 85 |
|
|
@echo "<!entity % $(BOOK) \"INCLUDE\">" >> $@
|
| 86 |
|
|
|
| 87 |
jfs |
1391 |
# Note: This does work, but it's a hack, it
|
| 88 |
|
|
# needs to be rewritten properly (jfs)
|
| 89 |
|
|
#
|
| 90 |
osamu |
1399 |
# I know. But for now, I need to avoid circular dependence. (OA)
|
| 91 |
|
|
#
|
| 92 |
osamu |
1385 |
# Create starting SGML for each language from template
|
| 93 |
|
|
# Actual contents are in language segrigated subdirectory
|
| 94 |
|
|
# generic rules for all the languages to each language
|
| 95 |
osamu |
1399 |
$(MANUAL).%.sgml: qref.sgml
|
| 96 |
jfs |
1391 |
sed -e "s/@@@@/$*/g" $< > $(MANUAL).$*.sgml
|
| 97 |
osamu |
1385 |
|
| 98 |
jfs |
1391 |
#----[ generating HTML ]-------------------------------------------------------
|
| 99 |
|
|
# for orig_lang
|
| 100 |
|
|
$(MANUAL).html: $(MANUAL).$(ORIG_LANG).sgml date.ent dynamic.ent
|
| 101 |
osamu |
1399 |
debiandoc2html -l $(ORIG_LANG) -c $< 2>_html.error
|
| 102 |
osamu |
1385 |
|
| 103 |
jfs |
1391 |
# for translated languages
|
| 104 |
|
|
# FIXME: there is a trick because debiandoc2html does a sed 'y/.../...'
|
| 105 |
|
|
# which should be reverted to have the content negociation working.
|
| 106 |
|
|
# This trick is bad. debiandoc2html should be corrected.
|
| 107 |
osamu |
1399 |
$(MANUAL).%.html: $(MANUAL).%.sgml date.ent dynamic.ent
|
| 108 |
|
|
debiandoc2html -l $* -c $< 2>_html.$*.error
|
| 109 |
jfs |
1391 |
@echo "cleaning up file extensions";\
|
| 110 |
|
|
for file in `ls $(MANUAL).$*.html/*` ; do\
|
| 111 |
|
|
newfile=`echo $$file|\
|
| 112 |
|
|
sed 's/$(shell echo $*|\
|
| 113 |
|
|
sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\
|
| 114 |
|
|
)\.html/$*\.html/'`;\
|
| 115 |
|
|
if [ $$file != $$newfile ] ; then\
|
| 116 |
|
|
mv $$file $$newfile;\
|
| 117 |
|
|
fi\
|
| 118 |
|
|
done;
|
| 119 |
osamu |
1385 |
|
| 120 |
|
|
|
| 121 |
jfs |
1391 |
#----[ generating plain text ]-------------------------------------------------
|
| 122 |
|
|
# for orig_lang
|
| 123 |
osamu |
1399 |
$(MANUAL).$(ORIG_LANG).txt: $(MANUAL).$(ORIG_LANG).sgml date.ent dynamic.ent
|
| 124 |
|
|
debiandoc2text -l $(ORIG_LANG) $< 2>_txt.error
|
| 125 |
osamu |
1385 |
|
| 126 |
jfs |
1391 |
# for translated languages
|
| 127 |
osamu |
1399 |
$(MANUAL).%.txt: $(MANUAL).%.sgml date.ent dynamic.ent
|
| 128 |
|
|
debiandoc2text -l $* $< 2>_txt.$*.error
|
| 129 |
osamu |
1385 |
|
| 130 |
jfs |
1391 |
#----[ generating tov ]--------------------------------------------------------
|
| 131 |
|
|
# for orig_lang
|
| 132 |
|
|
$(MANUAL).$(ORIG_LANG).tov: $(MANUAL).$(ORIG_LANG).sgml
|
| 133 |
|
|
debiandoc2textov -l $(ORIG_LANG) -c $<
|
| 134 |
osamu |
1385 |
|
| 135 |
jfs |
1391 |
# for translated languages
|
| 136 |
|
|
$(MANUAL).%.tov: $(MANUAL).%.sgml
|
| 137 |
|
|
debiandoc2textov -l $* $<
|
| 138 |
osamu |
1385 |
|
| 139 |
jfs |
1391 |
#----[ generating info ]-------------------------------------------------------
|
| 140 |
|
|
# for orig_lang
|
| 141 |
|
|
$(MANUAL).$(ORIG_LANG).info: $(MANUAL).$(ORIG_LANG).sgml
|
| 142 |
|
|
debiandoc2info -l $(ORIG_LANG) -c $<
|
| 143 |
osamu |
1385 |
|
| 144 |
jfs |
1391 |
# for translated languages
|
| 145 |
|
|
$(MANUAL).%.info: $(MANUAL).%.sgml
|
| 146 |
|
|
debiandoc2info -l $* $<
|
| 147 |
osamu |
1385 |
|
| 148 |
jfs |
1391 |
#----[ generating PostScript ]-------------------------------------------------
|
| 149 |
|
|
# for orig_lang
|
| 150 |
|
|
$(MANUAL).$(ORIG_LANG).ps: $(MANUAL).$(ORIG_LANG).sgml
|
| 151 |
|
|
debiandoc2latexps -l $(ORIG_LANG) -c $<
|
| 152 |
osamu |
1385 |
|
| 153 |
jfs |
1391 |
# for translated languages
|
| 154 |
|
|
$(MANUAL).%.ps: $(MANUAL).%.sgml
|
| 155 |
|
|
debiandoc2latexps -l $* $<
|
| 156 |
osamu |
1385 |
|
| 157 |
jfs |
1391 |
#----[ generating PDF ]--------------------------------------------------------
|
| 158 |
|
|
# for orig_lang
|
| 159 |
|
|
$(MANUAL).$(ORIG_LANG).pdf: $(MANUAL).$(ORIG_LANG).sgml
|
| 160 |
|
|
debiandoc2latexpdf -l $(ORIG_LANG) -c $<
|
| 161 |
osamu |
1385 |
|
| 162 |
jfs |
1391 |
# for translated languages
|
| 163 |
|
|
$(MANUAL).%.pdf: $(MANUAL).%.sgml
|
| 164 |
|
|
debiandoc2latexpdf -l $* $<
|
| 165 |
osamu |
1385 |
|
| 166 |
jfs |
1391 |
#====[ publishing to the DDP web pages ]=======================================
|
| 167 |
|
|
#publish: publish-html publish-files
|
| 168 |
|
|
# publish-file is disabled since the files do not compile cleanly to
|
| 169 |
|
|
# PS/PDF.
|
| 170 |
osamu |
1399 |
publish: publish-html publish-files
|
| 171 |
osamu |
1385 |
|
| 172 |
jfs |
1391 |
#----[ publish html ]----------------------------------------------------------
|
| 173 |
|
|
publish-html: $(HTMLDIRS)
|
| 174 |
|
|
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 175 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 176 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
|
| 177 |
osamu |
1399 |
# install all html
|
| 178 |
jfs |
1391 |
$(foreach lang,$(ORIG_LANG) $(LANGS),\
|
| 179 |
|
|
install -p -m 644 $(MANUAL).$(lang).html/*.html $(PUBLISHDIR)/$(MANUAL)/;)
|
| 180 |
osamu |
1398 |
# # excuse me for ugly script (skip CVS directory)
|
| 181 |
|
|
test -d $(PUBLISHDIR)/$(MANUAL)/examples \
|
| 182 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)/examples
|
| 183 |
|
|
install -p -m 644 --preserve-timestamps \
|
| 184 |
|
|
examples/[_AIOa-z]* $(PUBLISHDIR)/$(MANUAL)/examples/
|
| 185 |
|
|
|
| 186 |
jfs |
1391 |
#----[ publish the files ]-----------------------------------------------------
|
| 187 |
|
|
publish-files: $(ALLFILES)
|
| 188 |
|
|
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 189 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 190 |
|
|
$(foreach ext,$(EXTS),\
|
| 191 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.$(ext);\
|
| 192 |
|
|
\
|
| 193 |
|
|
$(foreach lang,$(LANGS),\
|
| 194 |
|
|
install -p -m 644 $(MANUAL).$(lang).$(ext)\
|
| 195 |
|
|
$(PUBLISHDIR)/$(MANUAL)/;)\
|
| 196 |
|
|
\
|
| 197 |
|
|
install -p -m 644 $(MANUAL).$(ORIG_LANG).$(ext)\
|
| 198 |
|
|
$(PUBLISHDIR)/$(MANUAL)/;\
|
| 199 |
|
|
\
|
| 200 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ext);\
|
| 201 |
|
|
ln -s $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).$(ext)\
|
| 202 |
osamu |
1398 |
$(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ext);\
|
| 203 |
jfs |
1391 |
)
|
| 204 |
osamu |
1385 |
|
| 205 |
|
|
|
| 206 |
jfs |
1391 |
#----[ publish the ps ]--------------------------------------------------------
|
| 207 |
|
|
publish-ps: ps
|
| 208 |
|
|
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 209 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 210 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps
|
| 211 |
|
|
# install any translated ps
|
| 212 |
|
|
$(foreach lang,$(LANGS),\
|
| 213 |
|
|
install -p -m 644 $(MANUAL).$(lang).ps \
|
| 214 |
|
|
$(PUBLISHDIR)/$(MANUAL)/ ;)
|
| 215 |
|
|
# install original ps
|
| 216 |
|
|
install -p -m 644 $(MANUAL).$(ORIG_LANG).ps\
|
| 217 |
|
|
$(PUBLISHDIR)/$(MANUAL)/
|
| 218 |
|
|
# make the simlinks for ps
|
| 219 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps;
|
| 220 |
|
|
ln -s $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).ps\
|
| 221 |
|
|
$(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps
|
| 222 |
osamu |
1385 |
|
| 223 |
|
|
|
| 224 |
jfs |
1391 |
#====[ validating SGML ]=======================================================
|
| 225 |
|
|
validate:
|
| 226 |
|
|
set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done
|
| 227 |
osamu |
1385 |
|
| 228 |
jfs |
1391 |
#====[ cleaning up ]===========================================================
|
| 229 |
|
|
clean distclean:
|
| 230 |
|
|
rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*} *~
|
| 231 |
|
|
rm -rf $(MANUAL)*.html
|
| 232 |
|
|
rm -f $(MANUAL).??.sgml
|
| 233 |
osamu |
1399 |
rm -f *.error
|
| 234 |
|
|
rm -f dynamic.ent date.ent
|
| 235 |
osamu |
1385 |
|
| 236 |
jfs |
1391 |
|
| 237 |
|
|
.PHONY: all html txt ps\
|
| 238 |
osamu |
1399 |
publish publish-html publish-files publish-txt publish-ps\
|
| 239 |
jfs |
1391 |
clean distclean validate
|