Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. XML_FILES = $(filter-out $(EXCLUDE_FILES), $(ALL_XML_FILES))
  9. PO_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/%.po, $(XML_FILES))
  10. $(MLANG)/chapter01/changelog.po: $(LFS_EN)/chapter01/changelog.xml changelogtranslator.py templatetranslator.py
  11. mkdir -pv "$(@D)"
  12. po4a-updatepo -f docbook -m $< -p $@
  13. ./changelogtranslator.py $(MLANG)
  14. $(MLANG)/%.po: $(LFS_EN)/%.xml
  15. mkdir -pv "$(@D)"
  16. po4a-updatepo -f docbook -m $< -p $@
  17. touch $@
  18. MXML_FILES = $(patsubst $(LFS_EN)/%.xml, %.xml, $(XML_FILES))
  19. BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(shell find $(LFS_EN) -type f -not -path "$(LFS_EN)/.svn/*" -not -path "$(LFS_EN)/render/*"))
  20. KEEP_FILES = $(filter-out $(MXML_FILES), KEEP_FILES)
  21. MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
  22. .PHONY: html booksrc
  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. booksrc: $(MBOOK_FILES) $(PATCHES)
  27. [ ! -e $(MLANG)/fix.sh ] || (pushd $(MLANG)/book; sh ../fix.sh; popd)
  28. $(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
  29. mkdir -pv "$(@D)"
  30. po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
  31. [ -e $@ ] || cp -v $< $@
  32. $(MLANG)/book/%: $(LFS_EN)/%
  33. mkdir -pv "$(@D)"
  34. cp -v $< $@