Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 = $(LFS_EN)/chapter01/livecd.xml \
  7. $(LFS_EN)/chapter04/creatingtoolsdir.xml \
  8. $(LFS_EN)/chapter04/aboutlfs.xml \
  9. $(LFS_EN)/chapter08/adjusting.xml
  10. XML_FILES = $(filter-out $(EXCLUDE_FILES), $(ALL_XML_FILES))
  11. PO_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/%.po, $(XML_FILES))
  12. $(MLANG)/chapter01/changelog.po: $(LFS_EN)/chapter01/changelog.xml changelogtranslator.py templatetranslator.py
  13. mkdir -pv "$(@D)"
  14. po4a-updatepo -f docbook -m $< -p $@
  15. ./changelogtranslator.py $(MLANG)
  16. $(MLANG)/%.po: $(LFS_EN)/%.xml
  17. mkdir -pv "$(@D)"
  18. po4a-updatepo -f docbook -m $< -p $@
  19. touch $@
  20. MXML_FILES = $(patsubst $(LFS_EN)/%.xml, %.xml, $(XML_FILES))
  21. BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(shell find $(LFS_EN) -type f -not -path "$(LFS_EN)/.svn/*" -not -path "$(LFS_EN)/render/*"))
  22. KEEP_FILES = $(filter-out $(MXML_FILES), KEEP_FILES)
  23. MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
  24. .PHONY: html booksrc nochunks pdf
  25. html: booksrc
  26. rm -rf $(MLANG)/book/render # without this tidy may be stupidly slow
  27. make -C $(MLANG)/book REV=$(REV) BASEDIR=render
  28. nochunks: booksrc
  29. rm -rf $(MLANG)/book/nochunks
  30. make -C $(MLANG)/book REV=$(REV) BASEDIR=nochunks nochunks
  31. pdf: booksrc
  32. rm -rf $(MLANG)/book/pdf
  33. make -C $(MLANG)/book REV=$(REV) BASEDIR=pdf pdf
  34. booksrc: $(MBOOK_FILES) $(PATCHES)
  35. [ ! -e $(MLANG)/fix.sh ] || (pushd $(MLANG)/book; sh ../fix.sh; popd)
  36. $(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
  37. mkdir -pv "$(@D)"
  38. po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
  39. [ -e $@ ] || cp -v $< $@
  40. $(MLANG)/book/%: $(LFS_EN)/%
  41. mkdir -pv "$(@D)"
  42. cp -v $< $@