Makefile 840 B

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