Changes in / [bcfbe5b:b54e969] in clfs-embedded


Ignore:
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rbcfbe5b rb54e969  
    1 /render/
    21*.swp
    32\#*#
  • BOOK/Makefile

    rbcfbe5b rb54e969  
    1 TOP             := $(PWD)
    2 RENDERDIR       := $(TOP)/../render
     1BASEDIR         := ~/cross-lfs-embedded-book
     2DUMPDIR         := ~/cross-lfs-embedded-commands
     3DLLISTDIR       := ~/cross-lfs-embedded-dllist
     4RENDERTMP       := $(HOME)/tmp
     5CHUNK_QUIET     := 1
     6ROOT_ID         :=
    37
    4 VALIDATEDIR     := $(RENDERDIR)/validate
    5 PROFILEDIR      := $(RENDERDIR)/profile
    6 
    7 HTMLDIR         := $(RENDERDIR)/html
    8 NOCHUNKDIR      := $(RENDERDIR)/nochunk
    9 
    10 FODIR           := $(RENDERDIR)/fo
    11 PDFDIR          := $(RENDERDIR)/pdf
    12 
    13 TROUBLEDIR      := $(RENDERDIR)/trouble
    14 DUMPDIR         := $(RENDERDIR)/commands
    15 DLLISTDIR       := $(RENDERDIR)/download-list
    16 
    17 CHUNK_QUIET     := 1
    18 ROOT_ID         :=
     8S               := -
    199
    2010ARCHS           := x86 mips wrt arm
     11
     12ARCHS_HTML      := $(ARCHS:%=%$(S)html)
     13ARCHS_NOCHUNKS  := $(ARCHS:%=%$(S)nochunks)
     14ARCHS_PDF       := $(ARCHS:%=%$(S)pdf)
     15ARCHS_VALIDATE  := $(ARCHS:%=%$(S)validate)
     16ARCHS_TROUBLE   := $(ARCHS:%=%$(S)trouble)
     17ARCHS_DUMP      := $(ARCHS:%=%$(S)dump)
     18ARCHS_DLLIST    := $(ARCHS:%=%$(S)dllist)
    2119
    2220ifdef V
     
    2624endif
    2725
    28 .PHONY: clfs lfs
    29 clfs lfs: html
     26.PHONY: lfs tidy render titlepage $(ARCHS_HTML) nochunks $(ARCHS_NOCHUNKS) pdf \
     27        $(ARCHS_PDF) validate $(ARCHS_VALIDATE) trouble $(ARCHS_TROUBLE) \
     28        dump-commands $(ARCHS_DUMP) download-list $(ARCHS_DLLIST) tmpdir
    3029
    31 .PHONY: tidy tidy-f tidy-d
    32 ifeq ($(shell which tidy >/dev/null 2>&1 && echo yes),yes)
     30lfs: tmpdir render tidy
     31
     32tmpdir:
     33        @echo "Creating and cleaning $(RENDERTMP)"
     34        $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
     35        $(Q)rm -f $(RENDERTMP)/*-{full,html,pdf}.xml
     36        $(Q)rm -f $(RENDERTMP)/*.fo
     37
     38ifeq ($(shell false which tidy >/dev/null 2>&1 && echo yes),yes)
    3339tidy:
    34         @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)
    35 
    36 tidy-f:
    37         @echo "Running tidy on F:$(shell basename $(TIDY_FILE))"
    38         @$(TOP)/tidy.sh "$(TIDY_FILE)"
    39 
    40 tidy-d:
    41         @echo "Running tidy on D:$(shell basename $(TIDY_DIR))"
    42         @$(TOP)/tidy.sh "$(TIDY_DIR)"
     40        @echo "Running tidy on the created HTML"
     41        $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
     42          tidy -config $(PWD)/tidy.conf $$filename; \
     43          true; \
     44          sh $(PWD)/obfuscate.sh $$filename; \
     45          sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
     46        done;
    4347else
    44 tidy tidy-f tidy-d:
     48tidy:
    4549        @echo "Tidy is not installed on this system"
    4650endif
    4751
    48 .PHONY: titlepage
     52render: $(ARCHS_HTML) titlepage
     53
    4954titlepage:
    50         @echo "Rendering the top-level index..."
    51         $(Q)xsltproc --nonet --output $(HTMLDIR)/index.html \
    52           $(PWD)/stylesheets/top-index.xsl \
    53           $(PWD)/index.xml
    54         @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(HTMLDIR)/index.html
     55        $(Q)xsltproc --nonet --output $(BASEDIR)/index.html \
     56          $(PWD)/stylesheets/top-index.xsl $(PWD)/index.xml
    5557
    56 ARCHS_VD_XML := $(ARCHS:%=%-validate_dump-xml)
    57 .PHONY: $(ARCHS_VD_XML)
    58 $(ARCHS_VD_XML): override arch = $(@:%-validate_dump-xml=%)
    59 $(ARCHS_VD_XML):
    60         @echo "Validating $(arch) book..."
    61         $(Q)mkdir -p $(VALIDATEDIR)
     58$(ARCHS_HTML): override html_arch = $(@:%$(S)html=%)
     59$(ARCHS_HTML):
     60        @echo "Validating $(html_arch) book..."
    6261        $(Q)xmllint --nonet --noent --xinclude --postvalid \
    63           -o $(VALIDATEDIR)/$(arch)-full.xml \
    64           $(PWD)/$(arch)-index.xml
     62          -o $(RENDERTMP)/$(html_arch)-full.xml $(PWD)/$(html_arch)-index.xml
    6563
    66 ARCHS_P_XML := $(ARCHS:%=%-profiled-xml)
    67 .PHONY: $(ARCHS_P_XML)
    68 $(ARCHS_P_XML): override arch = $(@:%-profiled-xml=%)
    69 $(ARCHS_P_XML):
    70         @$(MAKE) --no-print-directory $(arch)-validate_dump-xml
    71         @echo "Generating profiled $(arch) book..."
    72         $(Q)mkdir -p $(PROFILEDIR)
     64        @echo "Generating profiled $(html_arch) book for XHTML..."
    7365        $(Q)xsltproc --nonet --stringparam profile.condition html \
    74           --output $(PROFILEDIR)/$(arch)-html.xml \
    75           $(PWD)/stylesheets/lfs-xsl/profile.xsl \
    76           $(VALIDATEDIR)/$(arch)-full.xml
     66          --output $(RENDERTMP)/$(html_arch)-html.xml \
     67          $(PWD)/stylesheets/lfs-xsl/profile.xsl $(RENDERTMP)/$(html_arch)-full.xml
    7768
    78 ARCHS_HTML := $(ARCHS:%=%-html)
    79 .PHONY: html render $(ARCHS_HTML)
    80 html render: $(ARCHS_HTML) titlepage
    81 $(ARCHS_HTML): override arch = $(@:%-html=%)
    82 $(ARCHS_HTML):
    83         @$(MAKE) --no-print-directory $(arch)-profiled-xml
    84 
    85         @echo "Rendering chunked XHTML of $(arch)..."
    86         $(Q)mkdir -p $(HTMLDIR)/$(arch)
     69        @echo "Rendering chunked XHTML of $(html_arch)..."
     70        $(Q)mkdir -p $(BASEDIR)/$(html_arch)
    8771        $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
    8872          -stringparam rootid "$(ROOT_ID)" \
    89           -stringparam base.dir $(HTMLDIR)/$(arch)/ \
    90           $(PWD)/stylesheets/clfs-chunked.xsl \
    91           $(PROFILEDIR)/$(arch)-html.xml
     73          -stringparam base.dir $(BASEDIR)/$(html_arch)/ \
     74          $(PWD)/stylesheets/clfs-chunked.xsl $(RENDERTMP)/$(html_arch)-html.xml
    9275
    93         @echo "Copying CSS code and images for $(arch)..."
    94         $(Q)mkdir -p $(HTMLDIR)/$(arch)/stylesheets
    95         $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(HTMLDIR)/$(arch)/stylesheets
    96         $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(HTMLDIR)/$(arch)/*.html
    97         $(Q)mkdir -p $(HTMLDIR)/$(arch)/images
    98         $(Q)cp $(PWD)/images/*.png $(HTMLDIR)/$(arch)/images
    99         $(Q)sed -i -e "s@../images@images@g" $(HTMLDIR)/$(arch)/*.html
     76        @echo "Copying CSS code and images..."
     77        $(Q)mkdir -p $(BASEDIR)/$(html_arch)/stylesheets
     78        $(Q)cp $(PWD)/stylesheets/lfs-xsl/*.css $(BASEDIR)/$(html_arch)/stylesheets
     79        $(Q)sed -i -e "s@../stylesheets@stylesheets@g" $(BASEDIR)/$(html_arch)/*.html
     80        $(Q)mkdir -p $(BASEDIR)/$(html_arch)/images
     81        $(Q)cp $(PWD)/images/*.png $(BASEDIR)/$(html_arch)/images
     82        $(Q)sed -i -e "s@../images@images@g" $(BASEDIR)/$(html_arch)/*.html
    10083
    101         @$(MAKE) --no-print-directory tidy-d TIDY_DIR=$(HTMLDIR)/$(arch)
     84nochunks: tmpdir $(ARCHS_NOCHUNKS) tidy
    10285
    103 ARCHS_NOCHUNKS := $(ARCHS:%=%-nochunks)
    104 .PHONY: nochunks $(ARCHS_NOCHUNKS)
    105 nochunks: $(ARCHS_NOCHUNKS)
    106 $(ARCHS_NOCHUNKS): override arch = $(@:%-nochunks=%)
     86$(ARCHS_NOCHUNKS): override nochunk_arch = $(@:%$(S)nochunks=%)
    10787$(ARCHS_NOCHUNKS):
    108         @$(MAKE) --no-print-directory $(arch)-profiled-xml
     88        @echo "Validating $(nochunk_arch) book..."
     89        $(Q)xmllint --nonet --noent --xinclude --postvalid \
     90          -o $(RENDERTMP)/$(nochunk_arch)-full.xml $(PWD)/$(nochunk_arch)-index.xml
    10991
    110         @echo "Rendering Single File HTML of $(arch)..."
    111         $(Q)mkdir -p $(NOCHUNKDIR)
     92        @echo "Generating profiled $(nochunk_arch) book for XHTML..."
     93        $(Q)xsltproc --nonet --stringparam profile.condition html \
     94          --output $(RENDERTMP)/$(nochunk_arch)-html.xml \
     95          $(PWD)/stylesheets/lfs-xsl/profile.xsl \
     96          $(RENDERTMP)/$(nochunk_arch)-full.xml
     97
     98        @echo "Rendering Single File HTML of $(nochunk_arch)..."
     99        $(Q)mkdir -p $(BASEDIR)
    112100        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
    113           --output $(NOCHUNKDIR)/CLFS-$(arch).html \
    114           $(PWD)/stylesheets/clfs-nochunks.xsl \
    115           $(PROFILEDIR)/$(arch)-html.xml
     101          --output $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html \
     102          $(PWD)/stylesheets/clfs-nochunks.xsl $(RENDERTMP)/$(nochunk_arch)-html.xml
    116103
    117         @$(MAKE) --no-print-directory tidy-f TIDY_FILE=$(NOCHUNKDIR)/CLFS-$(arch).html
     104        @echo "Running Tidy..."
     105        $(Q)tidy -config $(PWD)/tidy.conf $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html || true
     106        @echo "Running obfuscate.sh..."
     107        $(Q)sh $(PWD)/obfuscate.sh $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html
     108        $(Q)sed -i -e "s@text/html@application/xhtml+xml@g"  \
     109          $(BASEDIR)/CLFS-EMBEDDED-$(nochunk_arch).html
    118110
    119 ARCHS_FO := $(ARCHS:%=%-fo)
    120 .PHONY: fo $(ARCHS_FO)
    121 fo: $(ARCHS_FO)
    122 $(ARCHS_FO): override arch = $(@:%-fo=%)
    123 $(ARCHS_FO):
    124         @$(MAKE) --no-print-directory $(arch)-profiled-xml
     111pdf: tmpdir $(ARCHS_PDF)
    125112
    126         @echo "Generating FO file of $(arch)..."
    127         @mkdir -p $(FODIR)
     113$(ARCHS_PDF): override pdf_arch =  $(@:%$(S)pdf=%)
     114$(ARCHS_PDF):
     115        @echo "Validating $(pdf_arch) book..."
     116        $(Q)xmllint --nonet --noent --xinclude --postvalid \
     117          -o $(RENDERTMP)/$(pdf_arch)-full.xml $(PWD)/$(pdf_arch)-index.xml
     118
     119        @echo "Generating profiled $(pdf_arch) book for PDF..."
     120        $(Q)xsltproc --nonet --stringparam profile.condition pdf \
     121          --output $(RENDERTMP)/$(pdf_arch)-pdf.xml \
     122          $(PWD)/stylesheets/lfs-xsl/profile.xsl \
     123          $(RENDERTMP)/$(pdf_arch)-full.xml
     124
     125        @echo "Generating FO file of $(pdf_arch)..."
    128126        $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
    129           --output $(FODIR)/$(arch).fo \
    130           $(PWD)/stylesheets/clfs-pdf.xsl \
    131           $(PROFILEDIR)/$(arch)-html.xml
    132         $(Q)sed -i -e 's/span="inherit"/span="all"/' $(FODIR)/$(arch).fo
     127          --output $(RENDERTMP)/$(pdf_arch).fo $(PWD)/stylesheets/clfs-pdf.xsl \
     128          $(RENDERTMP)/$(pdf_arch)-pdf.xml
     129        $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/$(pdf_arch).fo
    133130
    134 ARCHS_PDF := $(ARCHS:%=%-pdf)
    135 .PHONY: pdf $(ARCHS_PDF)
    136 pdf: $(ARCHS_PDF)
    137 $(ARCHS_PDF): override arch = $(@:%-pdf=%)
    138 $(ARCHS_PDF):
    139         @$(MAKE) --no-print-directory $(arch)-fo
     131        @echo "Rendering PDF of $(pdf_arch)..."
     132        $(Q)mkdir -p $(BASEDIR)
     133        $(Q)fop $(RENDERTMP)/$(pdf_arch).fo $(BASEDIR)/CLFS-EMBEDDED-$(pdf_arch).pdf
    140134
    141         @echo "Rendering PDF of $(arch)..."
    142         $(Q)mkdir -p $(PDFDIR)
    143         $(Q)fop $(FODIR)/$(arch).fo $(PDFDIR)/CLFS-$(arch).pdf
     135validate: $(ARCHS_VALIDATE)
    144136
    145 ARCHS_VALIDATE := $(ARCHS:%=%-validate)
    146 .PHONY: validate $(ARCHS_VALIDATE)
    147 validate: $(ARCHS_VALIDATE)
    148 $(ARCHS_VALIDATE): override arch =  $(@:%-validate=%)
     137$(ARCHS_VALIDATE): override validate_arch =  $(@:%$(S)validate=%)
    149138$(ARCHS_VALIDATE):
    150         @echo "Validating $(arch)..."
    151         $(Q)xmllint --xinclude --noout \
    152           --nonet --postvalid \
    153           $(PWD)/$(arch)-index.xml
     139        @echo "Validating $(validate_arch)..."
     140        $(Q)xmllint --xinclude --noout --nonet --postvalid $(PWD)/$(validate_arch)-index.xml
    154141
    155 ARCHS_TROUBLE := $(ARCHS:%=%-trouble)
    156 .PHONY: trouble $(ARCHS_TROUBLE)
    157 trouble: $(ARCHS_TROUBLE)
    158 $(ARCHS_TROUBLE): override arch = $(@:%-trouble=%)
     142trouble: tmpdir $(ARCHS_TROUBLE)
     143
     144$(ARCHS_TROUBLE): override trouble_arch =  $(@:%$(S)trouble=%)
    159145$(ARCHS_TROUBLE):
    160         @echo "Troubleshooting $(arch)..."
    161         @mkdir -p $(TROUBLEDIR)
     146        @echo "Troubleshooting $(trouble_arch)..."
    162147        $(Q)xmllint --xinclude --nonet --postvalid \
    163           -o $(TROUBLEDIR)/dump-$(arch) \
    164           $(PWD)/$(arch)-index.xml
    165         $(Q)xmllint --xinclude --noout --nonet --valid \
    166           $(TROUBLEDIR)/dump-$(arch)
    167         @echo "You can now look at $(TROUBLEDIR)/dump-$(arch) to see the errors"
     148          -o $(RENDERTMP)/dump-$(trouble_arch) $(PWD)/$(trouble_arch)-index.xml
     149        $(Q)xmllint --xinclude --noout --nonet --valid $(RENDERTMP)/dump-$(trouble_arch)
     150        @echo "You can now look at $(RENDERTMP)/dump-$(trouble_arch) to see the errors"
    168151
    169 ARCHS_DUMP := $(ARCHS:%=%-dump)
    170 .PHONY: dump-commands $(ARCHS_DUMP)
    171152dump-commands: $(ARCHS_DUMP)
    172 $(ARCHS_DUMP): override arch = $(@:%-dump=%)
     153
     154$(ARCHS_DUMP): override dump_arch =  $(@:%$(S)dump=%)
    173155$(ARCHS_DUMP):
    174         @echo "Extracting commands from $(arch)..."
    175         $(Q)mkdir -p $(DUMPDIR)/$(arch)
    176         $(Q)xsltproc --xinclude --nonet \
    177           --output $(DUMPDIR)/$(arch)/ \
    178           $(PWD)/stylesheets/dump-commands.xsl \
    179           $(PWD)/$(arch)-index.xml
     156        @echo "Extracting commands from $(dump_arch)..."
     157        $(Q)mkdir -p $(DUMPDIR)/$(dump_arch)
     158        $(Q)xsltproc --xinclude --nonet --output $(DUMPDIR)/$(dump_arch)/ \
     159          $(PWD)/stylesheets/dump-commands.xsl $(PWD)/$(dump_arch)-index.xml
    180160
    181 ARCHS_DLLIST := $(ARCHS:%=%-dllist)
    182 .PHONY: download-list $(ARCHS_DLLIST)
    183161download-list: $(ARCHS_DLLIST)
    184 $(ARCHS_DLLIST): override arch = $(@:%-dllist=%)
     162
     163$(ARCHS_DLLIST): override dllist_arch = $(@:%$(S)dllist=%)
    185164$(ARCHS_DLLIST):
    186         @echo "Creating download list for $(arch)..."
     165        @echo "Creating download list for $(dllist_arch)..."
    187166        $(Q)mkdir -p $(DLLISTDIR)
    188         $(Q)xsltproc --xinclude --nonet \
    189           --output $(DLLISTDIR)/$(arch).list \
    190           $(PWD)/stylesheets/wget.xsl \
    191           $(PWD)/$(arch)-index.xml
     167        $(Q)xsltproc --xinclude --nonet --output $(DLLISTDIR)/$(dllist_arch).dl.list \
     168          $(PWD)/stylesheets/wget.xsl $(PWD)/$(dllist_arch)-index.xml
    192169
    193 FG_GREEN := $(shell echo -e '\e[0;32m')
    194 FG_BLUE := $(shell echo -e '\e[0;34m')
    195 FG_DEFAULT := $(shell echo -e '\e[0;0m')
    196170help:
    197         @echo "Output: $(RENDERDIR)"
    198         @echo
    199171        @echo "HTML Targets"
    200         @echo "  $(FG_GREEN)clfs lfs tidy html render titlepage $(FG_BLUE)$(ARCHS_HTML)$(FG_DEFAULT)"
     172        @echo -e "  \e[0;32mlfs tidy render titlepage \e[0;34m$(ARCHS_HTML)\e[0;0m"
    201173        @echo
    202174        @echo "NoChunks Targets"
    203         @echo "  $(FG_GREEN)nochunks tidy $(FG_BLUE)$(ARCHS_NOCHUNKS)$(FG_DEFAULT)"
    204         @echo
    205         @echo "FO Targets"
    206         @echo "  $(FG_GREEN)fo $(FG_BLUE)$(ARCHS_FO)$(FG_DEFAULT)"
     175        @echo -e "  \e[0;32mnochunks tidy \e[0;34m$(ARCHS_NOCHUNKS)\e[0;0m"
    207176        @echo
    208177        @echo "PDF Targets"
    209         @echo "  $(FG_GREEN)pdf $(FG_BLUE)$(ARCHS_PDF)$(FG_DEFAULT)"
     178        @echo -e "  \e[0;32mpdf \e[0;34m$(ARCHS_PDF)\e[0;0m"
    210179        @echo
    211180        @echo "Validate Targets"
    212         @echo "  $(FG_GREEN)validate $(FG_BLUE)$(ARCHS_VALIDATE)$(FG_DEFAULT)"
     181        @echo -e "  \e[0;32mvalidate \e[0;34m$(ARCHS_VALIDATE)\e[0;0m"
    213182        @echo
    214183        @echo "Trouble Targets"
    215         @echo "  $(FG_GREEN)trouble $(FG_BLUE)$(ARCHS_TROUBLE)$(FG_DEFAULT)"
     184        @echo -e "  \e[0;32mtrouble \e[0;34m$(ARCHS_TROUBLE)\e[0;0m"
    216185        @echo
    217186        @echo "Dump-Commands Targets"
    218         @echo "  $(FG_GREEN)dump-commands $(FG_BLUE)$(ARCHS_DUMP)$(FG_DEFAULT)"
     187        @echo -e "  \e[0;32mdump-commands \e[0;34m$(ARCHS_DUMP)\e[0;0m"
    219188        @echo
    220189        @echo "Download-List Targets"
    221         @echo "  $(FG_GREEN)download-list $(FG_BLUE)$(ARCHS_DLLIST)$(FG_DEFAULT)"
     190        @echo -e "  \e[0;32mdownload-list \e[0;34m$(ARCHS_DLLIST)\e[0;0m"
Note: See TracChangeset for help on using the changeset viewer.