Changeset 879785b for BOOK/Makefile


Ignore:
Timestamp:
Feb 26, 2011, 5:16:25 PM (14 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:
da28cc3
Parents:
b47a4a1
Message:

Rework the Makefile to be cleaner top-down. Also we now have the ability
to specificy output directories for each target individually. Restructure
the output to be much more segregated and neater.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOOK/Makefile

    rb47a4a1 r879785b  
    11TOP             := $(PWD)
    2 
    3 WORKDIR         := $(TOP)/render-output
    4 
    5 BASEDIR         := $(WORKDIR)/cross-lfs-book
    6 DUMPDIR         := $(WORKDIR)/cross-lfs-commands
    7 DLLISTDIR       := $(WORKDIR)/cross-lfs-dllist
    8 RENDERTMP       := $(WORKDIR)/tmp
     2RENDERDIR       := $(TOP)/../render
     3
     4VALIDATEDIR     := $(RENDERDIR)/validate
     5PROFILEDIR      := $(RENDERDIR)/profile
     6
     7HTMLDIR         := $(RENDERDIR)/html
     8NOCHUNKDIR      := $(RENDERDIR)/nochunk
     9
     10FODIR           := $(RENDERDIR)/fo
     11PDFDIR          := $(RENDERDIR)/pdf
     12
     13TROUBLEDIR      := $(RENDERDIR)/trouble
     14DUMPDIR         := $(RENDERDIR)/commands
     15DLLISTDIR       := $(RENDERDIR)/download-list
     16
    917CHUNK_QUIET     := 1
    10 ROOT_ID  :=
    11 
    12 FG_GREEN        := $(shell echo -e '\e[0;32m')
    13 FG_BLUE         := $(shell echo -e '\e[0;34m')
    14 FG_DEFAULT      := $(shell echo -e '\e[0;0m')
     18ROOT_ID         :=
    1519
    1620ARCHS           := x86 x86_64 x86_64-64 \
     
    2024                   alpha
    2125
    22 ARCHS_VD_XML    := $(ARCHS:%=%-validate_dump-xml)
    23 ARCHS_P_XML     := $(ARCHS:%=%-profiled-xml)
    24 
    25 ARCHS_HTML      := $(ARCHS:%=%-html)
    26 ARCHS_NOCHUNKS  := $(ARCHS:%=%-nochunks)
    27 ARCHS_PDF       := $(ARCHS:%=%-pdf)
    28 ARCHS_VALIDATE  := $(ARCHS:%=%-validate)
    29 ARCHS_TROUBLE   := $(ARCHS:%=%-trouble)
    30 ARCHS_DUMP      := $(ARCHS:%=%-dump)
    31 ARCHS_DLLIST    := $(ARCHS:%=%-dllist)
    32 
    3326ifdef V
    3427  Q =
     
    3730endif
    3831
    39 .PHONY: clfs lfs render nochunks pdf validate trouble dump-commands download-list
    40 clfs lfs: tmpdir render
    41 render: $(ARCHS_HTML) titlepage
    42 nochunks: tmpdir $(ARCHS_NOCHUNKS)
    43 pdf: tmpdir $(ARCHS_PDF)
    44 validate: $(ARCHS_VALIDATE)
    45 trouble: tmpdir $(ARCHS_TROUBLE)
    46 dump-commands: $(ARCHS_DUMP)
    47 download-list: $(ARCHS_DLLIST)
    48 
    49 .PHONY: tmpdir
    50 tmpdir:
    51         $(Q)mkdir -p $(RENDERTMP)
     32.PHONY: clfs lfs
     33clfs lfs: html
    5234
    5335.PHONY: tidy tidy-f tidy-d
    5436ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
    5537tidy:
    56         @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(BASEDIR)
     38        @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
    5739
    5840tidy-f:
     
    7153titlepage:
    7254        @echo "Rendering the top-level index..."
    73         $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
    74           $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
    75         @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(BASEDIR)/index.html
    76 
    77 
     55        $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
     56          $(PWD)/stylesheets/top-index.xsl \
     57          $(PWD)/index.xml
     58        @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
     59
     60ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
    7861.PHONY: $(ARCHS_VD_XML)
    7962$(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
    80 $(ARCHS_VD_XML): tmpdir
     63$(ARCHS_VD_XML):
    8164        @echo "Validating $(arch) book..."
     65        $(Q)mkdir -p $(VALIDATEDIR)
    8266        $(Q)xmllint --nonet --noent --xinclude --postvalid \
    83           -o $(RENDERTMP)/$(arch)-full.xml $(PWD)/$(arch)-index.xml
    84 
     67          -o $(VALIDATEDIR)/$(arch)-full.xml \
     68          $(PWD)/$(arch)-index.xml
     69
     70ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
    8571.PHONY: $(ARCHS_P_XML)
    8672$(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
    87 $(ARCHS_P_XML): tmpdir
     73$(ARCHS_P_XML):
    8874        @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
    89 
    90         @echo "Generating profiled $(arch) book for XHTML..."
     75        @echo "Generating profiled $(arch) book..."
     76        $(Q)mkdir -p $(PROFILEDIR)
    9177        $(Q)xsltproc --nonet --stringparam profile.condition html \
    92           --output $(RENDERTMP)/$(arch)-html.xml \
    93           $(PWD)/stylesheets/lfs-xsl/profile.xsl $(RENDERTMP)/$(arch)-full.xml
    94 
    95 .PHONY: $(ARCHS_HTML)
     78          --output $(PROFILEDIR)/$(arch)-html.xml \
     79          $(PWD)/stylesheets/lfs-xsl/profile.xsl \
     80          $(VALIDATEDIR)/$(arch)-full.xml
     81
     82ARCHS_HTML := $(ARCHS:%=%-html)
     83.PHONY: html render $(ARCHS_HTML)
     84html render: $(ARCHS_HTML) titlepage
    9685$(ARCHS_HTML): override arch = $(@:%-html=%)
    97 $(ARCHS_HTML): tmpdir
     86$(ARCHS_HTML):
    9887        @$(MAKE) --no-print-directory $(arch)-profiled-xml
    9988
    10089        @echo "Rendering chunked XHTML of $(arch)..."
    101         $(Q)mkdir -p $(BASEDIR)/$(arch)
     90        $(Q)mkdir -p $(HTMLDIR)/$(arch)
    10291        $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
    10392          -stringparam rootid "$(ROOT_ID)" \
    104           -stringparam base.dir $(BASEDIR)/$(arch)/ \
    105           $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(arch)-html.xml
     93          -stringparam base.dir $(HTMLDIR)/$(arch)/ \
     94          $(PWD)/stylesheets/clfs-chunked.xsl \
     95          $(PROFILEDIR)/$(arch)-html.xml
    10696
    10797        @echo "Copying CSS code and images for $(arch)..."
    108         $(Q)mkdir -p $(BASEDIR)/$(arch)/stylesheets
    109         $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(arch)/stylesheets
    110         $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(arch)/*.html
    111         $(Q)mkdir -p $(BASEDIR)/$(arch)/images
    112         $(Q)cp $(PWD)/images/*.png $(BASEDIR)/$(arch)/images
    113         $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(arch)/*.html
    114 
    115         @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(BASEDIR)/$(arch)
    116 
    117 .PHONY: $(ARCHS_NOCHUNKS)
     98        $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
     99        $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
     100        $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
     101        $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
     102        $(Q)cp $(PWD)/images/*.png $(HTMLDIR)/$(arch)/images
     103        $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
     104
     105        @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
     106
     107ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
     108.PHONY: nochunks $(ARCHS_NOCHUNKS)
     109nochunks: $(ARCHS_NOCHUNKS)
    118110$(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
    119 $(ARCHS_NOCHUNKS): tmpdir
     111$(ARCHS_NOCHUNKS):
    120112        @$(MAKE) --no-print-directory $(arch)-profiled-xml
    121113
    122114        @echo "Rendering Single File HTML of $(arch)..."
    123         $(Q)mkdir -p $(BASEDIR)
     115        $(Q)mkdir -p $(NOCHUNKDIR)
    124116        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
    125           --output $(BASEDIR)/CLFS-$(arch).html \
    126           $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(arch)-html.xml
    127 
    128         @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(BASEDIR)/CLFS-$(arch).html
    129 
    130 .PHONY: $(ARCHS_PDF)
    131 $(ARCHS_PDF): override arch =  $(@:%-pdf=%)
    132 $(ARCHS_PDF): tmpdir
     117          --output $(NOCHUNKDIR)/CLFS-$(arch).html \
     118          $(PWD)/stylesheets/clfs-nochunks.xsl \
     119          $(PROFILEDIR)/$(arch)-html.xml
     120
     121        @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
     122
     123ARCHS_FO := $(ARCHS:%=%-fo)
     124.PHONY: fo $(ARCHS_FO)
     125fo: $(ARCHS_FO)
     126$(ARCHS_FO): override arch = $(@:%-fo=%)
     127$(ARCHS_FO):
    133128        @$(MAKE) --no-print-directory $(arch)-profiled-xml
    134129
    135130        @echo "Generating FO file of $(arch)..."
     131        @mkdir -p $(FODIR)
    136132        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
    137           --output $(RENDERTMP)/$(arch).fo $(PWD)/stylesheets/clfs-pdf.xsl \
    138           $(RENDERTMP)/$(arch)-html.xml
    139         $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/$(arch).fo
     133          --output $(FODIR)/$(arch).fo \
     134          $(PWD)/stylesheets/clfs-pdf.xsl \
     135          $(PROFILEDIR)/$(arch)-html.xml
     136        $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
     137
     138ARCHS_PDF := $(ARCHS:%=%-pdf)
     139.PHONY: pdf $(ARCHS_PDF)
     140pdf: $(ARCHS_PDF)
     141$(ARCHS_PDF): override arch = $(@:%-pdf=%)
     142$(ARCHS_PDF):
     143        @$(MAKE) --no-print-directory $(arch)-fo
    140144
    141145        @echo "Rendering PDF of $(arch)..."
    142         $(Q)mkdir -p $(BASEDIR)
    143         $(Q)fop $(RENDERTMP)/$(arch).fo $(BASEDIR)/CLFS-$(arch).pdf
    144 
    145 .PHONY: $(ARCHS_VALIDATE)
     146        $(Q)mkdir -p $(PDFDIR)
     147        $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
     148
     149ARCHS_VALIDATE := $(ARCHS:%=%-validate)
     150.PHONY: validate $(ARCHS_VALIDATE)
     151validate: $(ARCHS_VALIDATE)
    146152$(ARCHS_VALIDATE): override arch =  $(@:%-validate=%)
    147153$(ARCHS_VALIDATE):
    148154        @echo "Validating $(arch)..."
    149         $(Q)xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(arch)-index.xml
    150 
    151 .PHONY: $(ARCHS_TROUBLE)
    152 $(ARCHS_TROUBLE): override trouble_arch =  $(@:%-trouble=%)
    153 $(ARCHS_TROUBLE): tmpdir
    154         @echo "Troubleshooting $(trouble_arch)..."
     155        $(Q)xmllint --xinclude --noout \
     156          --nonet --postvalid \
     157          $(PWD)/$(arch)-index.xml
     158
     159ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
     160.PHONY: trouble $(ARCHS_TROUBLE)
     161trouble: $(ARCHS_TROUBLE)
     162$(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
     163$(ARCHS_TROUBLE):
     164        @echo "Troubleshooting $(arch)..."
     165        @mkdir -p $(TROUBLEDIR)
    155166        $(Q)xmllint --xinclude --nonet --postvalid \
    156           -o $(RENDERTMP)/dump-$(arch) $(PWD)/$(arch)-index.xml
    157         $(Q)xmllint --xinclude --noout --nonet --valid $(RENDERTMP)/dump-$(arch)
    158         @echo "You can now look at $(RENDERTMP)/dump-$(arch) to see the errors"
    159 
    160 .PHONY: $(ARCHS_DUMP)
    161 $(ARCHS_DUMP): override arch =  $(@:%-dump=%)
     167          -o $(TROUBLEDIR)/dump-$(arch) \
     168          $(PWD)/$(arch)-index.xml
     169        $(Q)xmllint --xinclude --noout --nonet --valid \
     170          $(TROUBLEDIR)/dump-$(arch)
     171        @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
     172
     173ARCHS_DUMP := $(ARCHS:%=%-dump)
     174.PHONY: dump-commands $(ARCHS_DUMP)
     175dump-commands: $(ARCHS_DUMP)
     176$(ARCHS_DUMP): override arch = $(@:%-dump=%)
    162177$(ARCHS_DUMP):
    163178        @echo "Extracting commands from $(arch)..."
    164179        $(Q)mkdir -p $(DUMPDIR)/$(arch)
    165         $(Q)xsltproc --xinclude --nonet --output $(DUMPDIR)/$(arch)/ \
    166           $(PWD)/stylesheets/dump-commands.xsl $(PWD)/$(arch)-index.xml
    167 
    168 .PHONY: $(ARCHS_DLLIST)
     180        $(Q)xsltproc --xinclude --nonet \
     181          --output $(DUMPDIR)/$(arch)/ \
     182          $(PWD)/stylesheets/dump-commands.xsl \
     183          $(PWD)/$(arch)-index.xml
     184
     185ARCHS_DLLIST := $(ARCHS:%=%-dllist)
     186.PHONY: download-list $(ARCHS_DLLIST)
     187download-list: $(ARCHS_DLLIST)
    169188$(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
    170189$(ARCHS_DLLIST):
    171190        @echo "Creating download list for $(arch)..."
    172191        $(Q)mkdir -p $(DLLISTDIR)
    173         $(Q)xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(arch)/dl.list \
    174           $(PWD)/stylesheets/wget.xsl $(PWD)/$(arch)-index.xml
    175 
     192        $(Q)xsltproc --xinclude --nonet \
     193          --output $(DLLISTDIR)/$(arch).list \
     194          $(PWD)/stylesheets/wget.xsl \
     195          $(PWD)/$(arch)-index.xml
     196
     197FG_GREEN := $(shell echo -e '\e[0;32m')
     198FG_BLUE := $(shell echo -e '\e[0;34m')
     199FG_DEFAULT := $(shell echo -e '\e[0;0m')
    176200help:
    177         @echo "Output: $(WORKDIR)"
     201        @echo "Output: $(RENDERDIR)"
    178202        @echo
    179203        @echo "HTML Targets"
    180         @echo "  $(FG_GREEN)clfs lfs tidy render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
     204        @echo "  $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
    181205        @echo
    182206        @echo "NoChunks Targets"
    183207        @echo "  $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
    184208        @echo
     209        @echo "FO Targets"
     210        @echo "  $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
     211        @echo
    185212        @echo "PDF Targets"
    186213        @echo "  $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
Note: See TracChangeset for help on using the changeset viewer.