| 1 |
#
|
| 2 |
# Makefile for the Securing Debian HOWTO (copied from Makefile.intln)
|
| 3 |
#
|
| 4 |
# Should work both for a manual in the Debian Documentation Project
|
| 5 |
# manuals.sgml tree, and for the package build.
|
| 6 |
|
| 7 |
##### CONF PART
|
| 8 |
# this can and will be overriden by a higher level makefile
|
| 9 |
PUBLISHDIR := /org/www.debian.org/www/doc/manuals
|
| 10 |
|
| 11 |
# Darn, I should have named dir and file the same way
|
| 12 |
#MANUAL = $(notdir $(shell pwd))
|
| 13 |
MANUAL = debian-euro-support
|
| 14 |
|
| 15 |
# The cannonical language, in which the original document is
|
| 16 |
ORIG_LANG=en
|
| 17 |
# list of langs (above the canonical one)
|
| 18 |
# LANGS=$(shell ls $(MANUAL).*.sgml|sed 's/.*$(MANUAL)\.\([^.]*\)\.sgml/\1/')
|
| 19 |
#
|
| 20 |
# Since portuguese is not yet in debiandoc format we cannot publish it until it is
|
| 21 |
#
|
| 22 |
LANGS = fr it
|
| 23 |
|
| 24 |
#EXTS=txt info pdf
|
| 25 |
EXTS=txt pdf
|
| 26 |
##### END OF CONF PART CHANGE THE END AT YOU OWN RISK
|
| 27 |
|
| 28 |
# what will be built
|
| 29 |
HTMLDIRS=$(MANUAL).html $(foreach lang,$(LANGS),$(MANUAL).$(lang).html)
|
| 30 |
ALLFILES=$(foreach ext,$(EXTS),\
|
| 31 |
$(MANUAL).$(ORIG_LANG).$(ext)\
|
| 32 |
$(foreach lang,$(LANGS),$(MANUAL).$(lang).$(ext))\
|
| 33 |
)
|
| 34 |
|
| 35 |
|
| 36 |
#====[ build rules ]===========================================================
|
| 37 |
# generate anything some dirs want version.ent to be builded, some not
|
| 38 |
|
| 39 |
DEBIAN=$(wildcard debian)
|
| 40 |
ifeq ($(DEBIAN),"debian")
|
| 41 |
all: version.ent $(HTMLDIRS) $(ALLFILES)
|
| 42 |
else
|
| 43 |
all: $(HTMLDIRS) $(ALLFILES)
|
| 44 |
endif
|
| 45 |
|
| 46 |
version.ent: debian/changelog
|
| 47 |
./debian/rules $@
|
| 48 |
|
| 49 |
#----[ generating HTML ]-------------------------------------------------------
|
| 50 |
# for orig_lang
|
| 51 |
$(MANUAL).html: $(MANUAL).sgml
|
| 52 |
debiandoc2html -l $(ORIG_LANG) -c $<
|
| 53 |
|
| 54 |
# for translated languages
|
| 55 |
# FIXME: there is a trick because debiandoc2html does a sed 'y/.../...'
|
| 56 |
# which should be reverted to have the content negociation working.
|
| 57 |
# This trick is bad. debiandoc2html should be corrected.
|
| 58 |
$(MANUAL).%.html: $(MANUAL).%.sgml
|
| 59 |
debiandoc2html -l $* -c $<
|
| 60 |
@echo "cleaning up file extensions";\
|
| 61 |
for file in `ls $(MANUAL).$*.html/*` ; do\
|
| 62 |
newfile=`echo $$file|\
|
| 63 |
sed 's/$(shell echo $*|\
|
| 64 |
sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\
|
| 65 |
)\.html/$*\.html/'`;\
|
| 66 |
if [ $$file != $$newfile ] ; then\
|
| 67 |
mv $$file $$newfile;\
|
| 68 |
fi; \
|
| 69 |
done
|
| 70 |
|
| 71 |
|
| 72 |
#----[ generating plain text ]-------------------------------------------------
|
| 73 |
# for orig_lang
|
| 74 |
$(MANUAL).$(ORIG_LANG).txt: $(MANUAL).sgml
|
| 75 |
debiandoc2text -l $(ORIG_LANG) -c $<
|
| 76 |
|
| 77 |
# for translated languages
|
| 78 |
$(MANUAL).%.txt: $(MANUAL).%.sgml
|
| 79 |
debiandoc2text -l $* $<
|
| 80 |
|
| 81 |
#----[ generating tov ]--------------------------------------------------------
|
| 82 |
# for orig_lang
|
| 83 |
$(MANUAL).$(ORIG_LANG).tov: $(MANUAL).sgml
|
| 84 |
debiandoc2textov -l $(ORIG_LANG) -c $<
|
| 85 |
|
| 86 |
# for translated languages
|
| 87 |
$(MANUAL).%.tov: $(MANUAL).%.sgml
|
| 88 |
debiandoc2textov -l $* $<
|
| 89 |
|
| 90 |
#----[ generating info ]-------------------------------------------------------
|
| 91 |
# for orig_lang
|
| 92 |
$(MANUAL).$(ORIG_LANG).info: $(MANUAL).sgml
|
| 93 |
debiandoc2info -l $(ORIG_LANG) -c $<
|
| 94 |
|
| 95 |
# for translated languages
|
| 96 |
$(MANUAL).%.info: $(MANUAL).%.sgml
|
| 97 |
debiandoc2info -l $* $<
|
| 98 |
|
| 99 |
#----[ generating PostScript ]-------------------------------------------------
|
| 100 |
# for orig_lang
|
| 101 |
$(MANUAL).$(ORIG_LANG).ps: $(MANUAL).sgml
|
| 102 |
debiandoc2latexps -l $(ORIG_LANG) -c $<
|
| 103 |
|
| 104 |
# for translated languages
|
| 105 |
$(MANUAL).%.ps: $(MANUAL).%.sgml
|
| 106 |
debiandoc2latexps -l $* $<
|
| 107 |
|
| 108 |
#----[ generating PDF ]--------------------------------------------------------
|
| 109 |
# for orig_lang
|
| 110 |
$(MANUAL).$(ORIG_LANG).pdf: $(MANUAL).sgml
|
| 111 |
debiandoc2latexpdf -l $(ORIG_LANG) -c $<
|
| 112 |
|
| 113 |
# for translated languages
|
| 114 |
$(MANUAL).%.pdf: $(MANUAL).%.sgml
|
| 115 |
debiandoc2latexpdf -l $* $<
|
| 116 |
|
| 117 |
#====[ publishing to the DDP web pages ]=======================================
|
| 118 |
publish: publish-html publish-files
|
| 119 |
|
| 120 |
#----[ publish html ]----------------------------------------------------------
|
| 121 |
publish-html: $(HTMLDIRS)
|
| 122 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 123 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 124 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
|
| 125 |
# install any translated html
|
| 126 |
$(foreach lang,$(LANGS),\
|
| 127 |
install -p -m 644 $(MANUAL).$(lang).html/*.html $(PUBLISHDIR)/$(MANUAL)/;)
|
| 128 |
# install original html
|
| 129 |
install -p -m 644 $(MANUAL).html/*.html \
|
| 130 |
$(PUBLISHDIR)/$(MANUAL)/
|
| 131 |
# make the symlinks for html files
|
| 132 |
@$(foreach file,$(wildcard $(MANUAL).html/*.html),\
|
| 133 |
name=`echo $(file) | sed 's/$(MANUAL).html\///'`; \
|
| 134 |
link=`echo $$name|sed 's/.$(ORIG_LANG).html$$/.html/'`;\
|
| 135 |
echo "$$link -> $$name";\
|
| 136 |
ln -sf $$name\
|
| 137 |
$(PUBLISHDIR)/$(MANUAL)/$$link;\
|
| 138 |
)
|
| 139 |
|
| 140 |
#----[ publish the files ]-----------------------------------------------------
|
| 141 |
publish-files: $(ALLFILES)
|
| 142 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 143 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 144 |
$(foreach ext,$(EXTS),\
|
| 145 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.$(ext);\
|
| 146 |
\
|
| 147 |
$(foreach lang,$(LANGS),\
|
| 148 |
install -p -m 644 $(MANUAL).$(lang).$(ext)\
|
| 149 |
$(PUBLISHDIR)/$(MANUAL)/;)\
|
| 150 |
\
|
| 151 |
install -p -m 644 $(MANUAL).$(ORIG_LANG).$(ext)\
|
| 152 |
$(PUBLISHDIR)/$(MANUAL)/;\
|
| 153 |
\
|
| 154 |
ln -sf $(MANUAL).$(ORIG_LANG).$(ext)\
|
| 155 |
$(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ext);\
|
| 156 |
)
|
| 157 |
|
| 158 |
|
| 159 |
#----[ publish the ps ]--------------------------------------------------------
|
| 160 |
publish-ps: ps
|
| 161 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 162 |
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 163 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps
|
| 164 |
# install any translated ps
|
| 165 |
$(foreach lang,$(LANGS),\
|
| 166 |
install -p -m 644 $(MANUAL).$(lang).ps \
|
| 167 |
$(PUBLISHDIR)/$(MANUAL)/ ;)
|
| 168 |
# install original ps
|
| 169 |
install -p -m 644 $(MANUAL).$(ORIG_LANG).ps\
|
| 170 |
$(PUBLISHDIR)/$(MANUAL)/
|
| 171 |
# make the symlinks for ps
|
| 172 |
ln -sf $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).ps\
|
| 173 |
$(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps
|
| 174 |
|
| 175 |
|
| 176 |
#====[ validating SGML ]=======================================================
|
| 177 |
validate:
|
| 178 |
set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done
|
| 179 |
|
| 180 |
#====[ cleaning up ]===========================================================
|
| 181 |
clean distclean:
|
| 182 |
rm -f debian-euro-support*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*} *~
|
| 183 |
rm -rf debian-euro-support*.html
|
| 184 |
|
| 185 |
.PHONY: all html txt ps\
|
| 186 |
publish publish-html publish-txt publish-ps\
|
| 187 |
clean distclean validate
|