Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/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 nochunks pdf pofiles
  24. pofiles: $(PO_FILES)
  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. pushd $(MLANG)/book; sh ../fetch_fonts.sh; popd
  34. make -C $(MLANG)/book REV=$(REV) BASEDIR=pdf pdf
  35. ORIG_FILES = $(MLANG)/book/general.ent.orig \
  36. $(MLANG)/book/Makefile.orig
  37. booksrc: $(MBOOK_FILES) $(PATCHES) $(ORIG_FILES)
  38. [ ! -e $(MLANG)/fix.sh ] || (pushd $(MLANG)/book; sh ../fix.sh; popd)
  39. $(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
  40. mkdir -pv "$(@D)"
  41. po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
  42. [ -e $@ ] || cp -v $< $@
  43. $(MLANG)/book/%: $(LFS_EN)/%
  44. mkdir -pv "$(@D)"
  45. cp -v $< $@
  46. $(MLANG)/book/general.ent.orig: $(LFS_EN)/general.ent
  47. mkdir -pv "$(@D)"
  48. cp -v $< $@
  49. $(MLANG)/book/Makefile.orig: $(LFS_EN)/Makefile
  50. mkdir -pv "$(@D)"
  51. cp -v $< $@