Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. SHELL := /bin/bash
  2. default: html
  3. LFS_EN = /home/xry111/svn-repos/LFS-BOOK
  4. MLANG=zh_CN
  5. ALL_XML_FILES = $(shell find $(LFS_EN) -type f -name '*.xml')
  6. EXCLUDE_FILES = # empty for now
  7. XML_FILES = $(filter-out $(EXCLUDE_FILES), $(ALL_XML_FILES))
  8. PO_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/%.po, $(XML_FILES))
  9. $(MLANG)/chapter01/changelog.po: $(LFS_EN)/chapter01/changelog.xml changelogtranslator.py templatetranslator.py
  10. mkdir -pv "$(@D)"
  11. po4a-updatepo -f docbook -m $< -p $@
  12. ./changelogtranslator.py $(MLANG)
  13. $(MLANG)/%.po: $(LFS_EN)/%.xml
  14. mkdir -pv "$(@D)"
  15. po4a-updatepo -f docbook -m $< -p $@
  16. touch $@
  17. MXML_FILES = $(patsubst $(LFS_EN)/%.xml, %.xml, $(XML_FILES))
  18. BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(shell find $(LFS_EN) -type f -not -path "$(LFS_EN)/.svn/*" -not -path "$(LFS_EN)/render/*"))
  19. KEEP_FILES = $(filter-out $(MXML_FILES), KEEP_FILES)
  20. MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
  21. .PHONY: html booksrc nochunks pdf pofiles
  22. pofiles: $(PO_FILES)
  23. html: booksrc
  24. rm -rf $(MLANG)/book/render # without this tidy may be stupidly slow
  25. make -C $(MLANG)/book REV=$(REV) BASEDIR=render
  26. nochunks: booksrc
  27. rm -rf $(MLANG)/book/nochunks
  28. make -C $(MLANG)/book REV=$(REV) BASEDIR=nochunks nochunks
  29. pdf: booksrc
  30. rm -rf $(MLANG)/book/pdf
  31. pushd $(MLANG)/book; sh ../fetch_fonts.sh; popd
  32. make -C $(MLANG)/book REV=$(REV) BASEDIR=pdf pdf
  33. ORIG_FILES = $(MLANG)/book/general.ent.orig \
  34. $(MLANG)/book/Makefile.orig
  35. booksrc: $(MBOOK_FILES) $(PATCHES) $(ORIG_FILES)
  36. [ ! -e $(MLANG)/fix.sh ] || (pushd $(MLANG)/book; sh ../fix.sh; popd)
  37. $(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
  38. mkdir -pv "$(@D)"
  39. po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
  40. [ -e $@ ] || cp -v $< $@
  41. $(MLANG)/book/%: $(LFS_EN)/%
  42. mkdir -pv "$(@D)"
  43. cp -v $< $@
  44. $(MLANG)/book/general.ent.orig: $(LFS_EN)/general.ent
  45. mkdir -pv "$(@D)"
  46. cp -v $< $@
  47. $(MLANG)/book/Makefile.orig: $(LFS_EN)/Makefile
  48. mkdir -pv "$(@D)"
  49. cp -v $< $@