# $Id$
#
# locale/Makefile
#
# This is a replacement for locale/translate.sh to avoid remaking
# files that don't need to be remade.
#

POT_FILE = po/moniwiki.pot

.PHONY: all po mo clean dep ${POT_FILE}

all	: po mo
po 	: # dependencies are auto-generated by 'make dep' , see below
mo	: # dependencies are auto-generated by 'make dep' , see below

${POT_FILE} : # dependencies are auto-generated by 'make dep' , see below
	cp -f $@ $@~
	xgettext -L PHP -k_ -kt_ -k_t -k__printf -k__sprintf -k__vsprintf -kfmt -o $@.extracted $^
	msgmerge -o $@ $@~ $@.extracted && rm -f $@.extracted

po/%.po : ${POT_FILE}
	test -f $@ || touch $@
	cp -f $@ $@~
	msgmerge -o $@.new $@~ $^ && mv -f $@.new $@

%/LC_MESSAGES/moniwiki.mo : po/%.po
	mkdir -p $*/LC_MESSAGES
	msgfmt -o $@ $<

euckr:
	iconv -f UTF-8 -t EUC-KR po/ko.po |sed 's/UTF-8/EUC-KR/' >po/ko_KR.po
	mkdir -p ko_KR/LC_MESSAGES/
	make ko_KR/LC_MESSAGES/moniwiki.mo
	make ko_KR/LC_MESSAGES/moniwiki.php
	rm po/ko_KR.po

# Generate .php from .mo rather than .po to maximize
# the probability of agreement between .mo and .php files.
%/LC_MESSAGES/moniwiki.php : %/LC_MESSAGES/moniwiki.mo
	msgunfmt $< | awk -f make-php-trans.awk > $@

clean :
	rm -f ${MO_FILES} ${PHP_FILES}

dep :
	$(SHELL) update-makefile.sh


# DO NOT DELETE THIS LINE
#
# The remainder of this file is auto-generated
#
# (Run 'make dep' to regenerate this section.)
#
