| 1 |
# Makefile for a manual in the Debian Documentation Project manuals.sgml |
# |
| 2 |
# tree. |
# 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 maint-guide package build. |
| 6 |
|
|
| 7 |
|
##### CONF PART |
| 8 |
|
# this can and will be overriden by a higher level makefile |
| 9 |
|
PUBLISHDIR := ../../../public_html/manuals.html |
| 10 |
|
|
| 11 |
|
# Darn, I should have named dir and file the same way |
| 12 |
|
#MANUAL = $(notdir $(shell pwd)) |
| 13 |
|
MANUAL = securing-debian-howto |
| 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 = es ru |
| 23 |
|
|
| 24 |
|
EXTS=txt info |
| 25 |
|
##### END OF CONF PART CHANGE THE END AT YOU OWN RISK |
| 26 |
|
|
| 27 |
|
# what will be built |
| 28 |
|
HTMLDIRS=$(MANUAL).html $(foreach lang,$(LANGS),$(MANUAL).$(lang).html) |
| 29 |
|
ALLFILES=$(foreach ext,$(EXTS),\ |
| 30 |
|
$(MANUAL).$(ORIG_LANG).$(ext)\ |
| 31 |
|
$(foreach lang,$(LANGS),$(MANUAL).$(lang).$(ext))\ |
| 32 |
|
) |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
#====[ build rules ]=========================================================== |
| 36 |
|
# generate anything some dirs want version.ent to be builded, some not |
| 37 |
|
|
| 38 |
|
DEBIAN=$(wildcard debian) |
| 39 |
|
ifeq ($(DEBIAN),"debian") |
| 40 |
|
all: version.ent $(HTMLDIRS) $(ALLFILES) |
| 41 |
|
else |
| 42 |
|
all: $(HTMLDIRS) $(ALLFILES) |
| 43 |
|
endif |
| 44 |
|
|
| 45 |
|
version.ent: debian/changelog |
| 46 |
|
./debian/rules $@ |
| 47 |
|
|
| 48 |
|
#----[ generating HTML ]------------------------------------------------------- |
| 49 |
|
# for orig_lang |
| 50 |
|
$(MANUAL).html: $(MANUAL).sgml |
| 51 |
|
debiandoc2html -l $(ORIG_LANG) -c $< |
| 52 |
|
|
| 53 |
|
# for translated languages |
| 54 |
|
# FIXME: there is a trick because debiandoc2html does a sed 'y/.../...' |
| 55 |
|
# which should be reverted to have the content negociation working. |
| 56 |
|
# This trick is bad. debiandoc2html should be corrected. |
| 57 |
|
$(MANUAL).%.html: $(MANUAL).%.sgml |
| 58 |
|
debiandoc2html -l $* -c $< |
| 59 |
|
@echo "cleaning up file extensions";\ |
| 60 |
|
for file in `ls $(MANUAL).$*.html/*` ; do\ |
| 61 |
|
newfile=`echo $$file|\ |
| 62 |
|
sed 's/$(shell echo $*|\ |
| 63 |
|
sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\ |
| 64 |
|
)\.html/$*\.html/'`;\ |
| 65 |
|
if [ $$file != $$newfile ] ; then\ |
| 66 |
|
mv $$file $$newfile;\ |
| 67 |
|
fi\ |
| 68 |
|
done; |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
#----[ generating plain text ]------------------------------------------------- |
| 72 |
|
# for orig_lang |
| 73 |
|
$(MANUAL).$(ORIG_LANG).txt: $(MANUAL).sgml |
| 74 |
|
debiandoc2text -l $(ORIG_LANG) -c $< |
| 75 |
|
|
| 76 |
|
# for translated languages |
| 77 |
|
$(MANUAL).%.txt: $(MANUAL).%.sgml |
| 78 |
|
debiandoc2text -l $* $< |
| 79 |
|
|
| 80 |
|
#----[ generating tov ]-------------------------------------------------------- |
| 81 |
|
# for orig_lang |
| 82 |
|
$(MANUAL).$(ORIG_LANG).tov: $(MANUAL).sgml |
| 83 |
|
debiandoc2textov -l $(ORIG_LANG) -c $< |
| 84 |
|
|
| 85 |
|
# for translated languages |
| 86 |
|
$(MANUAL).%.tov: $(MANUAL).%.sgml |
| 87 |
|
debiandoc2textov -l $* $< |
| 88 |
|
|
| 89 |
|
#----[ generating info ]------------------------------------------------------- |
| 90 |
|
# for orig_lang |
| 91 |
|
$(MANUAL).$(ORIG_LANG).info: $(MANUAL).sgml |
| 92 |
|
debiandoc2info -l $(ORIG_LANG) -c $< |
| 93 |
|
|
| 94 |
|
# for translated languages |
| 95 |
|
$(MANUAL).%.info: $(MANUAL).%.sgml |
| 96 |
|
debiandoc2info -l $* $< |
| 97 |
|
|
| 98 |
|
#----[ generating PostScript ]------------------------------------------------- |
| 99 |
|
# for orig_lang |
| 100 |
|
$(MANUAL).$(ORIG_LANG).ps: $(MANUAL).sgml |
| 101 |
|
debiandoc2latexps -l $(ORIG_LANG) -c $< |
| 102 |
|
|
| 103 |
|
# for translated languages |
| 104 |
|
$(MANUAL).%.ps: $(MANUAL).%.sgml |
| 105 |
|
debiandoc2latexps -l $* $< |
| 106 |
|
|
| 107 |
|
#----[ generating PDF ]-------------------------------------------------------- |
| 108 |
|
# for orig_lang |
| 109 |
|
$(MANUAL).$(ORIG_LANG).pdf: $(MANUAL).sgml |
| 110 |
|
debiandoc2latexpdf -l $(ORIG_LANG) -c $< |
| 111 |
|
|
| 112 |
|
# for translated languages |
| 113 |
|
$(MANUAL).%.pdf: $(MANUAL).%.sgml |
| 114 |
|
debiandoc2latexpdf -l $* $< |
| 115 |
|
|
| 116 |
|
#====[ publishing to the DDP web pages ]======================================= |
| 117 |
|
publish: publish-html publish-files |
| 118 |
|
|
| 119 |
|
#----[ publish html ]---------------------------------------------------------- |
| 120 |
|
publish-html: $(HTMLDIRS) |
| 121 |
|
test -d $(PUBLISHDIR)/$(MANUAL) \ |
| 122 |
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL) |
| 123 |
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html |
| 124 |
|
# install any translated html |
| 125 |
|
$(foreach lang,$(LANGS),\ |
| 126 |
|
install -p -m 644 $(MANUAL).$(lang).html/*.html $(PUBLISHDIR)/$(MANUAL)/;) |
| 127 |
|
# install original html |
| 128 |
|
install -p -m 644 $(MANUAL).html/*.html \ |
| 129 |
|
$(PUBLISHDIR)/$(MANUAL)/ |
| 130 |
|
# make the simlinks for html files |
| 131 |
|
@$(foreach file,$(wildcard $(MANUAL).html/*.html),\ |
| 132 |
|
name=`echo $(file) | sed 's/$(MANUAL).html\///'`; \ |
| 133 |
|
link=`echo $$name|sed 's/.$(ORIG_LANG).html$$/.html/'`;\ |
| 134 |
|
rm -f $$link; \ |
| 135 |
|
echo "$$link -> $$name";\ |
| 136 |
|
ln -s $(PUBLISHDIR)/$(MANUAL)/$$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 |
|
rm -f $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ext);\ |
| 155 |
|
ln -s $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).$(ext)\ |
| 156 |
|
$(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ext);\ |
| 157 |
|
) |
| 158 |
|
|
| 159 |
|
|
| 160 |
|
#----[ publish the ps ]-------------------------------------------------------- |
| 161 |
|
publish-ps: ps |
| 162 |
|
test -d $(PUBLISHDIR)/$(MANUAL) \ |
| 163 |
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL) |
| 164 |
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps |
| 165 |
|
# install any translated ps |
| 166 |
|
$(foreach lang,$(LANGS),\ |
| 167 |
|
install -p -m 644 $(MANUAL).$(lang).ps \ |
| 168 |
|
$(PUBLISHDIR)/$(MANUAL)/ ;) |
| 169 |
|
# install original ps |
| 170 |
|
install -p -m 644 $(MANUAL).$(ORIG_LANG).ps\ |
| 171 |
|
$(PUBLISHDIR)/$(MANUAL)/ |
| 172 |
|
# make the simlinks for ps |
| 173 |
|
rm -f $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps; |
| 174 |
|
ln -s $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).ps\ |
| 175 |
|
$(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps |
| 176 |
|
|
|
# The directory in which this makefile resides must also contain a file |
|
|
# called <directoryname>.sgml, which is the top-level file for the manual |
|
|
# in this directory. |
|
|
|
|
|
# What is the current manual's name |
|
|
#MANUAL := $(shell basename $(shell pwd)) |
|
|
MANUAL := securing-debian-howto |
|
|
# Where are we publishing to? |
|
|
# (this can be overriden by a higher level makefile) |
|
|
PUBLISHDIR := ../../../public_html/manuals.html |
|
|
|
|
|
# What do we want by default? |
|
|
all: publish |
|
|
|
|
|
# This target installs the generated HTML in the published directory. |
|
|
publish: $(MANUAL).html/index.html |
|
|
# fail if there is no PUBLISHDIR |
|
|
[ -d $(PUBLISHDIR) ] || exit 1 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html |
|
|
install -d -m 755 $(PUBLISHDIR)/$(MANUAL) |
|
|
install -m 644 --preserve-timestamps $(MANUAL).html/*.html \ |
|
|
$(PUBLISHDIR)/$(MANUAL)/ |
|
| 177 |
|
|
| 178 |
$(MANUAL).html/index.html: $(wildcard *.sgml) |
#====[ validating SGML ]======================================================= |
|
debiandoc2html $(MANUAL).sgml |
|
|
|
|
|
# ensure our SGML is valid |
|
|
# (add this to $(MANUAL).html rule to prevent building if not) |
|
| 179 |
validate: |
validate: |
| 180 |
nsgmls -gues $(MANUAL).sgml |
set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done |
|
|
|
|
clean: |
|
|
rm -rf $(MANUAL).html |
|
|
|
|
|
distclean: clean |
|
| 181 |
|
|
| 182 |
.PHONY: all publish clean distclean validate |
#====[ cleaning up ]=========================================================== |
| 183 |
|
clean distclean: |
| 184 |
|
rm -f maint-guide*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*} *~ |
| 185 |
|
rm -rf maint-guide*.html |
| 186 |
|
|
| 187 |
|
.PHONY: all html txt ps\ |
| 188 |
|
publish publish-html publish-txt publish-ps\ |
| 189 |
|
clean distclean validate |