/[ddp]/manuals/trunk/securing-howto/Makefile
ViewVC logotype

Diff of /manuals/trunk/securing-howto/Makefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1240 by joy, Tue Aug 28 07:57:50 2001 UTC revision 9176 by taffit, Sat Apr 7 21:44:32 2012 UTC
# Line 1  Line 1 
1  #  #
2  # Makefile for the Securing Debian HOWTO (copied from Makefile.intln)  # Based  Makefile Template from 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  # Should work both for a manual in the Debian Documentation Project
7  # manuals.sgml tree, and for maint-guide package build.  # 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 systems      #
12    # ------------------------------------------------------------------- #
13    # Read local texmf.cnf file
14    
15  ##### CONF PART  .SUFFIXES:
16  # this can and will be overriden by a higher level makefile  
17  PUBLISHDIR := ../../../public_html/manuals.html  # Following default shall be edited by the coordinator for the entire
18    # set of languages.  If a subsection owner wishes to override settings,
19  # Darn, I should have named dir and file the same way  # they can be overridden by running make with "make 'LANGS1=fi'" etc..
20  #MANUAL = $(notdir $(shell pwd))  
21  MANUAL = securing-debian-howto  # =================================================================== #
22    #                 Default configuration part: Customize               #
23  # The cannonical language, in which the original document is  # =================================================================== #
24  ORIG_LANG=en  
25  # list of langs (above the canonical one)  # The directory in which this makefile resides must also contain a file
26  # LANGS=$(shell ls $(MANUAL).*.sgml|sed 's/.*$(MANUAL)\.\([^.]*\)\.sgml/\1/')  # called <directoryname>.[<language>.]sgml, which is the top-level file
27  #  # for the manual in this directory.
28  # Since portuguese is not yet in debiandoc format we cannot publish it until it is  
29  #  # Basename for language-dependent SGML (DDP default, generated)
30  LANGS = es ru  MANUAL := securing-debian-howto
31    
32    # Basename for language-independent SGML-template.
33    MANUAL0 := $(MANUAL)
34    
35    # Build type: Possible values are BUILD_TYPE = web|package
36    BUILD_TYPE  := web
37    
38    # Publish directory
39    # This can and will be overridden by a higher level makefile
40    PUBLISHDIR := ~/public_html/manuals.html
41    
42    # List of languages not being handled with po4a:
43    LANGSNOPO := en de es it pt-br ru ja zh-cn
44    # List of languages handled with po4a:
45    LANGSPO  := fr
46    # List of languages built for "publish" target for DDP
47    LANGS    := en de fr pt-br
48    
49    # Files which affect SGML generation (excluding *.sgml)
50    SGMLENTS := custom.ent default.ent
51    
52    # All SGML source files
53    SGMLSRCS := $(foreach lang, $(LANGS), $(MANUAL).$(lang).sgml) \
54                $(foreach lang, $(LANGS), $(wildcard $(lang)/*.sgml ) ) \
55                $(SGMLENTS)
56    
57    # All SGML targets not being handled with po4a:
58    SGMLNOPOSRCS := $(foreach lang, $(LANGSNOPO), $(MANUAL).$(lang).sgml)
59    
60    # All SGML targets handled with po4a:
61    SGMLPOSRCS := $(foreach lang, $(LANGSPO), $(MANUAL).$(lang).sgml)
62    
63    # =================================================================== #
64    #                 Build target default part: Routine                  #
65    # =================================================================== #
66    # If some languages have problems building, filter-out in here.
67    
68    # define $(locale) for the following targets
69    $(MANUAL).%.html.stamp $(MANUAL).%.txt $(MANUAL).%.ps $(MANUAL).%.pdf: \
70      locale=$(subst pt-br,pt_BR,\
71             $(subst zh-cn,zh_CN,\
72             $(subst fr,fr.UTF-8,\
73             $*)))
74    
75    ### Full guide
76    
77    # List of html stamp files to be built
78    HTMLS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).html.stamp)
79    
80    # List of txt to be built
81    TXTS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).txt)
82    
83    # List of ps to be built
84    PSS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).ps)
85    
86    # List of pdf to be built
87    PDFS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).pdf)
88    
89    
90    # =================================================================== #
91    #                 Build target part: Customize                        #
92    # =================================================================== #
93    # If some languages have problems building, filter-out in here.
94    
95    all: html txt ps pdf
96    html: $(HTMLS)
97    text txt:  $(TXTS)
98    ps:   $(PSS)
99    pdf:  $(PDFS)
100    
101    publish: publish-html publish-txt publish-ps publish-pdf
102    
103    # =================================================================== #
104    #                 Build rule part: If not package build               #
105    # =================================================================== #
106    
107    $(MANUAL).%.ent:
108            echo "<!ENTITY language \"$*\">"                 > $@
109            echo "<!ENTITY % lang-$* \"INCLUDE\">"          >> $@
110            echo "<!ENTITY docdate \"`LC_ALL=C date -R`\">" >> $@
111            echo "<!ENTITY docversion \"CVS\">"             >> $@
112    
 EXTS=txt info  
 ##### END OF CONF PART CHANGE THE END AT YOU OWN RISK  
113    
114  # what will be built  # =================================================================== #
115  HTMLDIRS=$(MANUAL).html $(foreach lang,$(LANGS),$(MANUAL).$(lang).html)  #                 Build rule part: Routine                            #
116  ALLFILES=$(foreach ext,$(EXTS),\  # =================================================================== #
             $(MANUAL).$(ORIG_LANG).$(ext)\  
             $(foreach lang,$(LANGS),$(MANUAL).$(lang).$(ext))\  
           )  
   
   
 #====[ build rules ]===========================================================  
 # generate anything some dirs want version.ent to be builded, some not  
   
 DEBIAN=$(wildcard debian)  
 ifeq ($(DEBIAN),"debian")  
 all: version.ent $(HTMLDIRS) $(ALLFILES)  
 else  
 all: $(HTMLDIRS) $(ALLFILES)  
 endif  
   
 version.ent: debian/changelog  
         ./debian/rules $@  
   
 #----[ generating HTML ]-------------------------------------------------------  
 # for orig_lang  
 $(MANUAL).html: $(MANUAL).sgml  
         debiandoc2html -l $(ORIG_LANG) -c $<  
   
 # for translated languages  
 # FIXME: there is a trick because debiandoc2html does a sed 'y/.../...'  
 #        which should be reverted to have the content negociation working.  
 #   This trick is bad. debiandoc2html should be corrected.  
 $(MANUAL).%.html: $(MANUAL).%.sgml  
         debiandoc2html -l $* -c $<  
         @echo "cleaning up file extensions";\  
         for file in `ls $(MANUAL).$*.html/*` ; do\  
          newfile=`echo $$file|\  
                   sed 's/$(shell echo $*|\  
               sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\  
                           )\.html/$*\.html/'`;\  
          if [ $$file != $$newfile ] ; then\  
            mv $$file $$newfile;\  
          fi\  
         done;  
   
   
 #----[ generating plain text ]-------------------------------------------------  
 # for orig_lang  
 $(MANUAL).$(ORIG_LANG).txt: $(MANUAL).sgml  
         debiandoc2text -l $(ORIG_LANG) -c $<  
   
 # for translated languages  
 $(MANUAL).%.txt: $(MANUAL).%.sgml  
         debiandoc2text -l $* $<  
   
 #----[ generating tov ]--------------------------------------------------------  
 # for orig_lang  
 $(MANUAL).$(ORIG_LANG).tov: $(MANUAL).sgml  
         debiandoc2textov -l $(ORIG_LANG) -c $<  
   
 # for translated languages  
 $(MANUAL).%.tov: $(MANUAL).%.sgml  
         debiandoc2textov -l $* $<  
   
 #----[ generating info ]-------------------------------------------------------  
 # for orig_lang  
 $(MANUAL).$(ORIG_LANG).info: $(MANUAL).sgml  
         debiandoc2info -l $(ORIG_LANG) -c $<  
   
 # for translated languages  
 $(MANUAL).%.info: $(MANUAL).%.sgml  
         debiandoc2info -l $* $<  
   
 #----[ generating PostScript ]-------------------------------------------------  
 # for orig_lang  
 $(MANUAL).$(ORIG_LANG).ps: $(MANUAL).sgml  
         debiandoc2latexps -l $(ORIG_LANG) -c $<  
   
 # for translated languages  
 $(MANUAL).%.ps: $(MANUAL).%.sgml  
         debiandoc2latexps -l $* $<  
   
 #----[ generating PDF ]--------------------------------------------------------  
 # for orig_lang  
 $(MANUAL).$(ORIG_LANG).pdf: $(MANUAL).sgml  
         debiandoc2latexpdf -l $(ORIG_LANG) -c $<  
   
 # for translated languages  
 $(MANUAL).%.pdf: $(MANUAL).%.sgml  
         debiandoc2latexpdf -l $* $<  
117    
118  #====[ publishing to the DDP web pages ]=======================================  # SGML
 publish: publish-html publish-files  
119    
120  #----[ publish html ]----------------------------------------------------------  # Create starting SGML for each language from the template.  Actual
121  publish-html: $(HTMLDIRS)  # contents reside in language-segregated subdirectories.
122    
123    $(SGMLNOPOSRCS): $(MANUAL).%.sgml: $(MANUAL0).sgml
124            sed -e "s/@@LANGS@@/$*/g" \
125                -e "s/@@DIRS@@/$*/g" \
126                -e "s/@@NAME@@/$(MANUAL)/g" \
127                    $< > $(MANUAL).$*.sgml
128    
129    # Create starting SGML for each language handled with po4a
130    
131    $(SGMLPOSRCS): $(MANUAL).%.sgml: $(MANUAL).en.sgml $(MANUAL).en.ent po4a/po/%.po
132            po4a po4a/po4a.cfg
133    
134    # HTML
135    $(MANUAL).%.html.stamp: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
136            debiandoc2html -l $(locale) -C $<
137    # since $(MANUAL).%.html/index.%.html cannot be a target file
138            @for file in `ls $(MANUAL).$*.html/*` ; do \
139            newfile=`echo $$file|\
140                sed 's/$(shell echo $*|\
141                    sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\
142                    )\.html/$*\.html/'`; \
143            if [ $$file != $$newfile ] ; then \
144                    mv $$file $$newfile; \
145                    echo "Rename $$file --> $$newfile"; \
146            fi \
147            done
148            touch $(MANUAL).$*.html.stamp
149    
150    # TXT
151    
152    $(MANUAL).%.txt: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
153            debiandoc2text -l $(locale) $<
154    
155    
156    # PS
157    
158    $(MANUAL).%.ps: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
159            debiandoc2latexps -l $(locale) $<
160    
161    # PDF
162    
163    $(MANUAL).%.pdf: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
164            debiandoc2latexpdf -l $(locale) $<
165    
166    # DVI
167    
168    $(MANUAL).%.dvi: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
169            debiandoc2dvi $<
170    
171    
172    # =================================================================== #
173    #                 Build rule part: Web publish                        #
174    # =================================================================== #
175    
176    publish-html: html
177          test -d $(PUBLISHDIR)/$(MANUAL) \          test -d $(PUBLISHDIR)/$(MANUAL) \
178             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
179          rm -f $(PUBLISHDIR)/$(MANUAL)/*.html          rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
180           # install any translated html          # install all html
181          $(foreach lang,$(LANGS),\          $(foreach lang,$(LANGS),\
182            install -p -m 644 $(MANUAL).$(lang).html/*.html $(PUBLISHDIR)/$(MANUAL)/;)           install -p -m 644 $(MANUAL).$(lang).html/*.html \
183           # install original html                    $(PUBLISHDIR)/$(MANUAL)/ ;\
184           install -p -m 644 $(MANUAL).html/*.html \          )
185                             $(PUBLISHDIR)/$(MANUAL)/  publish-txt:  txt
186           # make the symlinks for html files          test -d $(PUBLISHDIR)/$(MANUAL) \
187           @$(foreach file,$(wildcard  $(MANUAL).html/*.html),\             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
188            name=`echo $(file) | sed 's/$(MANUAL).html\///'`; \          rm -f $(PUBLISHDIR)/$(MANUAL)/*.txt
189            link=`echo $$name|sed 's/.$(ORIG_LANG).html$$/.html/'`;\          # install all txt
190            echo "$$link -> $$name";\          @$(foreach lang,$(LANGS),\
191            ln -sf $(PUBLISHDIR)/$(MANUAL)/$$name\           install -p -m 644 $(MANUAL).$(lang).txt \
192                  $(PUBLISHDIR)/$(MANUAL)/$$link;\                    $(PUBLISHDIR)/$(MANUAL)/ ;\
193           )          )
194    
195  #----[ publish the files ]-----------------------------------------------------  publish-ps:  ps
 publish-files: $(ALLFILES)  
196          test -d $(PUBLISHDIR)/$(MANUAL) \          test -d $(PUBLISHDIR)/$(MANUAL) \
197             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
198          $(foreach ext,$(EXTS),\          rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps
199           rm -f $(PUBLISHDIR)/$(MANUAL)/*.$(ext);\          # install all ps
200           \          @$(foreach lang,$(LANGS),\
201           $(foreach lang,$(LANGS),\           install -p -m 644 $(MANUAL).$(lang).ps \
202            install -p -m 644 $(MANUAL).$(lang).$(ext)\                    $(PUBLISHDIR)/$(MANUAL)/ ;\
                             $(PUBLISHDIR)/$(MANUAL)/;)\  
          \  
          install -p -m 644 $(MANUAL).$(ORIG_LANG).$(ext)\  
                            $(PUBLISHDIR)/$(MANUAL)/;\  
          \  
          ln -sf $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).$(ext)\  
                $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ext);\  
203          )          )
204    
205    
206  #----[ publish the ps ]--------------------------------------------------------  publish-pdf:  pdf
 publish-ps: ps  
207          test -d $(PUBLISHDIR)/$(MANUAL) \          test -d $(PUBLISHDIR)/$(MANUAL) \
208             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)             || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
209          rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps          rm -f $(PUBLISHDIR)/$(MANUAL)/*.pdf
210           # install any translated ps          # install all pdf1
211          $(foreach lang,$(LANGS),\          @$(foreach lang,$(LANGS),\
212            install -p -m 644 $(MANUAL).$(lang).ps \           install -p -m 644 $(MANUAL).$(lang).pdf \
213                              $(PUBLISHDIR)/$(MANUAL)/ ;)                    $(PUBLISHDIR)/$(MANUAL)/ ;\
214           # install original ps          )
          install -p -m 644 $(MANUAL).$(ORIG_LANG).ps\  
                            $(PUBLISHDIR)/$(MANUAL)/  
          # make the symlinks for ps  
          ln -sf $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).$(ORIG_LANG).ps\  
                $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps  
215    
216    
217  #====[ validating SGML ]=======================================================  #====[ validating SGML ]=======================================================
218  validate:  validate:
219          set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done          set -x; for i in $(LANGS); do $(MAKE) validate1-$$i ; done
220    
221    validate1-%: $(SGMLSRCS) $(MANUAL)-%.ent
222            nsgmls -gues -wall $(MANUAL)-$*.sgml
223    
224    
225  #====[ cleaning up ]===========================================================  #====[ cleaning up ]===========================================================
226  clean distclean:  distclean: clean
227          rm -f maint-guide*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*} *~          rm -Rf $(PUBLISHDIR)/$(MANUAL)
228          rm -rf maint-guide*.html          rm -f *.error $(MANUAL).*.sgml
229    
230    clean:
231            rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*,out,tov}
232            rm -f *~ prior.aux pprior.aux body.tmp head.tmp tar.gz.log
233            rm -f *.error $(MANUAL).*.ent $(MANUAL).*.sgml date.ent $(MANUAL).*.tpt
234            rm -rf $(MANUAL)*.html *stamp
235    
236  .PHONY: all html txt ps\  .PHONY: all html text txt ps pdf \
237          publish publish-html publish-txt publish-ps\          publish publish-html publish-tst publish-ps publish-pdf \
238          clean distclean validate          clean distclean validate
239    

Legend:
Removed from v.1240  
changed lines
  Added in v.9176

  ViewVC Help
Powered by ViewVC 1.1.5