Index: head/share/mk/doc.translate.mk =================================================================== --- head/share/mk/doc.translate.mk +++ head/share/mk/doc.translate.mk @@ -42,9 +42,6 @@ MASTER_SRCS!= ${MAKE} -C ${EN_DIR} -V SRCS ${DOC}.translate.xml: -.if ${TRAN_DIR} == ${EN_DIR} - @${ECHO} "Please build PO file only in a non-English directory, ignored" -.else # some SRCS files might need to be generated, make sure they exist @${MAKE} -C ${EN_DIR} ${MASTER_SRCS} > /dev/null # normalize the English original into a single file @@ -52,32 +49,34 @@ # remove redundant namespace attributes @${PO_XMLLINT} --nsclean ${.TARGET}.tmp > ${.TARGET} @${RM} ${.TARGET}.tmp - @${MAKE} -C ${EN_DIR} clean > /dev/null -.endif .if ${TRAN_DIR} == ${EN_DIR} -po: +PO_FILE=${PO_LANG}.pot .else -po: ${PO_LANG}.po +PO_FILE=${PO_LANG}.po .endif +po: ${PO_FILE} .PHONY: po -${PO_LANG}.po: ${DOC}.translate.xml - @${ITSTOOL} -o ${PO_LANG}.po.tmp ${DOC}.translate.xml -.if exists(${PO_LANG}.po) - @${ECHO} "${PO_LANG}.po exists, merging" - @${MSGMERGE} -o ${PO_LANG}.po.new ${PO_LANG}.po ${PO_LANG}.po.tmp - @${MSGATTRIB} --no-obsolete -o ${PO_LANG}.po.tmp ${PO_LANG}.po.new - @${RM} ${PO_LANG}.po.new - @${MV} ${PO_LANG}.po.tmp ${PO_LANG}.po +${PO_FILE}: ${DOC}.translate.xml + @${ITSTOOL} -o ${PO_FILE}.tmp ${DOC}.translate.xml +.if exists(${PO_FILE}) + @${ECHO} "${PO_FILE} exists, merging" + @${MSGMERGE} -o ${PO_FILE}.new ${PO_FILE} ${PO_FILE}.tmp + @${MSGATTRIB} --no-obsolete -o ${PO_FILE}.tmp ${PO_FILE}.new + @${RM} ${PO_FILE}.new + @${MV} ${PO_FILE}.tmp ${PO_FILE} .else - @${ECHO} "${PO_LANG}.po created, please check and correct the settings in the header" - @${MV} ${PO_LANG}.po.tmp ${PO_LANG}.po + @${ECHO} "${PO_FILE} created, please check and correct the settings in the header" + # Just to wrap long message lines + @${MSGATTRIB} -o ${PO_FILE} ${PO_FILE}.tmp + @${RM} ${PO_FILE}.tmp @${POSET_CMD} ${.TARGET} .endif + @${MAKE} -C ${EN_DIR} clean > /dev/null -${PO_LANG}.mo: ${PO_LANG}.po +${PO_LANG}.mo: ${PO_FILE} @${MSGFMT} -o ${.TARGET} ${.ALLSRC} tran ${DOC}.xml: ${DOC}.translate.xml ${PO_LANG}.mo