Makefile 1.5 KB

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