1
0

Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. SHELL := /bin/bash
  2. default: html
  3. LFS_EN = $(HOME)/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. PO4A_FLAGS = -f docbook --porefs none
  10. ifneq (,$(wildcard ./local.mk))
  11. include local.mk
  12. endif
  13. $(MLANG)/chapter01/changelog.po: $(LFS_EN)/chapter01/changelog.xml changelogtranslator.py templatetranslator.py
  14. mkdir -pv "$(@D)"
  15. po4a-updatepo $(PO4A_FLAGS) -m $< -p $@
  16. ./changelogtranslator.py $(MLANG)
  17. $(MLANG)/%.po: $(LFS_EN)/%.xml
  18. mkdir -pv "$(@D)"
  19. po4a-updatepo $(PO4A_FLAGS) -m $< -p $@
  20. touch $@
  21. MXML_FILES = $(patsubst $(LFS_EN)/%.xml, %.xml, $(XML_FILES))
  22. BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(shell find $(LFS_EN) -type f -not -path "$(LFS_EN)/.svn/*" -not -path "$(LFS_EN)/render/*"))
  23. KEEP_FILES = $(filter-out $(MXML_FILES), KEEP_FILES)
  24. MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
  25. .PHONY: html booksrc nochunks pdf pofiles
  26. pofiles: $(PO_FILES)
  27. html: booksrc
  28. rm -rf $(MLANG)/book/render # without this tidy may be stupidly slow
  29. make -C $(MLANG)/book REV=$(REV) BASEDIR=render
  30. nochunks: booksrc
  31. rm -rf $(MLANG)/book/nochunks
  32. make -C $(MLANG)/book REV=$(REV) BASEDIR=nochunks nochunks
  33. pdf: booksrc
  34. rm -rf $(MLANG)/book/pdf
  35. pushd $(MLANG)/book; sh ../fetch_fonts.sh; popd
  36. make -C $(MLANG)/book REV=$(REV) BASEDIR=pdf pdf
  37. ORIG_FILES = $(MLANG)/book/general.ent.orig \
  38. $(MLANG)/book/Makefile.orig
  39. booksrc: $(MBOOK_FILES) $(PATCHES) $(ORIG_FILES)
  40. [ ! -e $(MLANG)/fix.sh ] || (pushd $(MLANG)/book; sh ../fix.sh; popd)
  41. $(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
  42. mkdir -pv "$(@D)"
  43. po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
  44. [ -e $@ ] || cp -v $< $@
  45. $(MLANG)/book/%: $(LFS_EN)/%
  46. mkdir -pv "$(@D)"
  47. cp -v $< $@
  48. $(MLANG)/book/general.ent.orig: $(LFS_EN)/general.ent
  49. mkdir -pv "$(@D)"
  50. cp -v $< $@
  51. $(MLANG)/book/Makefile.orig: $(LFS_EN)/Makefile
  52. mkdir -pv "$(@D)"
  53. cp -v $< $@