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

Legend:
Removed from v.1735  
changed lines
  Added in v.2937

  ViewVC Help
Powered by ViewVC 1.1.5