Browse Source

add target for translated book XML source

Xℹ Ruoyao 4 years ago
parent
commit
44ee5b6536
1 changed files with 20 additions and 3 deletions
  1. 20 3
      Makefile

+ 20 - 3
Makefile

@@ -3,11 +3,28 @@ MLANG=zh_CN
 XML_FILES = $(shell find $(LFS_EN) -type f -name '*.xml')
 PO_FILES = $(patsubst $(LFS_EN)/%.xml, $(MLANG)/%.po, $(XML_FILES))
 
-test:
-	echo $(PO_FILES)
-
 run: $(PO_FILES)
 
 $(MLANG)/%.po: $(LFS_EN)/%.xml
 	mkdir -pv "$(@D)"
 	po4a-updatepo -f docbook -m $< -p $@
+
+MXML_FILES = $(patsubst $(LFS_EN)/%.xml, %.xml, $(XML_FILES))
+BOOK_FILES = $(patsubst $(LFS_EN)/%, %, $(shell find $(LFS_EN) -type f -not -path "$(LFS_EN)/.svn/*"))
+KEEP_FILES = $(filter-out $(MXML_FILES), KEEP_FILES)
+
+MBOOK_FILES = $(patsubst %, $(MLANG)/book/%, $(BOOK_FILES))
+
+booksrc: $(MBOOK_FILES)
+
+$(MLANG)/book/%.xml: $(LFS_EN)/%.xml $(MLANG)/%.po
+	mkdir -pv "$(@D)"
+	po4a-translate -f docbook -m $< -p $(filter-out $<, $^) -l $@
+	[ -e $@ ] || cp -v $< $@
+
+$(MLANG)/book/%: $(LFS_EN)/%
+	mkdir -pv "$(@D)"
+	cp -v $< $@
+
+test:
+	echo $(BOOK_FILES)