Makefile 991 B

123456789101112131415161718192021222324252627282930313233
  1. LFS_EN = /home/xry111/svn-repos/LFS-BOOK
  2. MLANG=zh_CN
  3. ALL_XML_FILES = $(shell find $(LFS_EN) -type f -name '*.xml')
  4. EXCLUDE_FILES = $(LFS_EN)/chapter01/changelog.xml \
  5. $(LFS_EN)/chapter01/livecd.xml
  6. XML_FILES = $(filter-out $(EXCLUDE_FILES), $(ALL_XML_FILES))
  7. PO_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/%.po, $(XML_FILES))
  8. run: $(PO_FILES)
  9. $(MLANG)/%.po: $(LFS_EN)/%.xml
  10. mkdir -pv "$(@D)"
  11. po4a-updatepo -f docbook -m $< -p $@
  12. MXML_FILES = $(patsubst $(LFS_EN)/%.xml, %.xml, $(XML_FILES))
  13. BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(shell find $(LFS_EN) -type f -not -path "$(LFS_EN)/.svn/*"))
  14. KEEP_FILES = $(filter-out $(MXML_FILES), KEEP_FILES)
  15. MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
  16. booksrc: $(MBOOK_FILES)
  17. $(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
  18. mkdir -pv "$(@D)"
  19. po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
  20. [ -e $@ ] || cp -v $< $@
  21. $(MLANG)/book/%: $(LFS_EN)/%
  22. mkdir -pv "$(@D)"
  23. cp -v $< $@
  24. test:
  25. echo $(XML_FILES)