Changeset c695188 for BOOK/Makefile


Ignore:
Timestamp:
Jan 1, 2010, 4:57:36 PM (15 years ago)
Author:
Joe Ciccone <jciccone@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
5bc27c8
Parents:
16ca115
Message:

Rearrange the makefile. Create a tidy.sh script to replace the tidy target and create a tidy target that calls this script. Also make sure that the rendertmp dir is available for whatever target needs it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOOK/Makefile

    r16ca115 rc695188  
    3232endif
    3333
    34 .PHONY: lfs tidy render titlepage $(ARCHS_HTML) nochunks $(ARCHS_NOCHUNKS) pdf \
    35         $(ARCHS_PDF) validate $(ARCHS_VALIDATE) trouble $(ARCHS_TROUBLE) \
    36         dump-commands $(ARCHS_DUMP) download-list $(ARCHS_DLLIST) tmpdir
     34.PHONY: clfs lfs tidy render titlepage nochunks pdf validate trouble dump-commands \
     35        download-list tmpdir $(ARCHS_HTML) $(ARCHS_NOCHUNKS) $(ARCHS_PDF) \
     36        $(ARCHS_VALIDATE) $(ARCHS_TROUBLE) $(ARCHS_DUMP) $(ARCHS_DLLIST) tmpdir
    3737
    38 lfs: tmpdir render tidy
     38clfs lfs: tmpdir render
     39render: $(ARCHS_HTML) titlepage
     40nochunks: tmpdir $(ARCHS_NOCHUNKS)
     41pdf: tmpdir $(ARCHS_PDF)
     42validate: $(ARCHS_VALIDATE)
     43trouble: tmpdir $(ARCHS_TROUBLE)
     44dump-commands: $(ARCHS_DUMP)
     45download-list: $(ARCHS_DLLIST)
    3946
    4047tmpdir:
    41         @echo "Creating and cleaning $(RENDERTMP)"
    4248        $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
    43         $(Q)rm -f $(RENDERTMP)/*-{full,html,pdf}.xml
    44         $(Q)rm -f $(RENDERTMP)/*.fo
    4549
    4650ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
    4751tidy:
    48         @echo "Running tidy on the created HTML"
    49         $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
    50           tidy -config $(PWD)/tidy.conf $$filename; \
    51           true; \
    52           bash $(PWD)/obfuscate.sh $$filename; \
    53           sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
    54         done;
     52        @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(BASEDIR)
     53
     54tidy-f:
     55        @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
     56        @$(TOP)/tidy.sh "$(TIDY_FILE)"
     57
     58tidy-d:
     59        @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
     60        @$(TOP)/tidy.sh "$(TIDY_DIR)"
    5561else
    56 tidy:
     62tidy tidy-f tidy-d:
    5763        @echo "Tidy is not installed on this system"
    5864endif
    5965
    60 render: $(ARCHS_HTML) titlepage
    61 
    6266titlepage:
     67        @echo "Rendering the top-level index..."
    6368        $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
    6469          $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
     70        @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(BASEDIR)/index.html
    6571
    6672$(ARCHS_VD_XML): override validate_dump_xml_arch = $(@:%-validate_dump-xml=%)
    67 $(ARCHS_VD_XML):
     73$(ARCHS_VD_XML): tmpdir
    6874        @echo "Validating $(validate_dump_xml_arch) book..."
    6975        $(Q)xmllint --nonet --noent --xinclude --postvalid \
     
    7177
    7278$(ARCHS_P_XML): override profiled_xml_arch = $(@:%-profiled-xml=%)
    73 $(ARCHS_P_XML):
     79$(ARCHS_P_XML): tmpdir
    7480        @$(MAKE) --no-print-directory $(profiled_xml_arch)-validate_dump-xml
    7581
     
    8086
    8187$(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
    82 $(ARCHS_HTML):
     88$(ARCHS_HTML): tmpdir
    8389        @$(MAKE) --no-print-directory $(html_arch)-profiled-xml
    8490
     
    9096          $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(html_arch)-html.xml
    9197
    92         @echo "Copying CSS code and images..."
     98        @echo "Copying CSS code and images for $(html_arch)..."
    9399        $(Q)mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
    94100        $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(html_arch)/stylesheets
     
    98104        $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
    99105
    100 nochunks: tmpdir $(ARCHS_NOCHUNKS) tidy
     106        @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(BASEDIR)/$(html_arch)
    101107
    102108$(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
    103 $(ARCHS_NOCHUNKS):
     109$(ARCHS_NOCHUNKS): tmpdir
    104110        @$(MAKE) --no-print-directory $(nochunk_arch)-profiled-xml
    105111
     
    110116          $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(nochunk_arch)-html.xml
    111117
    112         @echo "Running Tidy..."
    113         $(Q)tidy -config $(PWD)/tidy.conf $(BASEDIR)/CLFS-$(nochunk_arch).html || true
    114         @echo "Running obfuscate.sh..."
    115         $(Q)bash $(PWD)/obfuscate.sh $(BASEDIR)/CLFS-$(nochunk_arch).html
    116         $(Q)sed -i -e "s@text/html@application/xhtml+xml@g"  \
    117           $(BASEDIR)/CLFS-$(nochunk_arch).html
    118 
    119 pdf: tmpdir $(ARCHS_PDF)
     118        @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(BASEDIR)/CLFS-$(nochunk_arch).html
    120119
    121120$(ARCHS_PDF): override pdf_arch =  $(@:%$(S)pdf=%)
    122 $(ARCHS_PDF):
     121$(ARCHS_PDF): tmpdir
    123122        @$(MAKE) --no-print-directory $(pdf_arch)-profiled-xml
    124123
     
    133132        $(Q)fop $(RENDERTMP)/$(pdf_arch).fo $(BASEDIR)/CLFS-$(pdf_arch).pdf
    134133
    135 validate: $(ARCHS_VALIDATE)
    136 
    137134$(ARCHS_VALIDATE): override validate_arch =  $(@:%$(S)validate=%)
    138135$(ARCHS_VALIDATE):
     
    140137        $(Q)xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
    141138
    142 trouble: tmpdir $(ARCHS_TROUBLE)
    143 
    144139$(ARCHS_TROUBLE): override trouble_arch =  $(@:%$(S)trouble=%)
    145 $(ARCHS_TROUBLE):
     140$(ARCHS_TROUBLE): tmpdir
    146141        @echo "Troubleshooting $(trouble_arch)..."
    147142        $(Q)xmllint --xinclude --nonet --postvalid \
     
    149144        $(Q)xmllint --xinclude --noout --nonet --valid $(RENDERTMP)/dump-$(trouble_arch)
    150145        @echo "You can now look at $(RENDERTMP)/dump-$(trouble_arch) to see the errors"
    151 
    152 dump-commands: $(ARCHS_DUMP)
    153146
    154147$(ARCHS_DUMP): override dump_arch =  $(@:%$(S)dump=%)
     
    158151        $(Q)xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ \
    159152          $(PWD)/stylesheets/dump-commands.xsl $(PWD)/$(dump_arch)-index.xml
    160 
    161 download-list: $(ARCHS_DLLIST)
    162153
    163154$(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
     
    172163        @echo
    173164        @echo "HTML Targets"
    174         @echo -e "  \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
     165        @echo -e "  \e[0;32mclfs lfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
    175166        @echo
    176167        @echo "NoChunks Targets"
Note: See TracChangeset for help on using the changeset viewer.