## Makefile for compiling UTF-8 message catalogs on Win32 with cygwin
##
## Use: make -f makefile.cygwin install
##
## To convert the clear-text message catalogs to binary form (.gmo)
## files in the UTF-8 encoding of Unicode that we want,
## you will need: - iconv, from the tests directory in libiconv
##		  - msgfmt, from GNU gettext

# This file is included from other po directories, too.
# They should define their own PACKAGE and possibly INSTALLSUBDIR
# and LOCALEDIR macros

ifndef PACKAGE
PACKAGE = gtk20
endif
ifndef INSTALLSUBDIR
INSTALLSUBDIR = $(PACKAGE)
endif
ifndef LOCALEDIR
# This is what I use as installation target, from where the installer-builder
# will pick it up. The user installation location will be asked by
# the installer (typically %WinDir%\gtk+).
LOCALEDIR = /install/$(INSTALLSUBDIR)/locale
endif

LANGUAGES = $(subst .po,,$(wildcard *.po))
LANGUAGES := $(subst .GB2312,,$(LANGUAGES))
LANGUAGES := $(subst .Big5,,$(LANGUAGES))

################################################################

all : $(addsuffix .gmo,$(LANGUAGES))

install : all
	mkdir -p $(addsuffix /LC_MESSAGES,$(addprefix $(LOCALEDIR)/,$(LANGUAGES)))
	for l in $(LANGUAGES); do cp $$l.gmo $(LOCALEDIR)/$$l/LC_MESSAGES/$(PACKAGE).mo; done

.SUFFIXES: .po .utf8 .gmo

.utf8.gmo:
	msgfmt -o $@ $<

ca.utf8: ca.po
	iconv -f ISO-8859-1 -t UTF-8 ca.po >$@

cs.utf8: cs.po
	iconv -f ISO-8859-2 -t UTF-8 cs.po >$@

da.utf8: da.po
	iconv -f ISO-8859-1 -t UTF-8 da.po >$@

de.utf8: de.po
	iconv -f ISO-8859-1 -t UTF-8 de.po >$@

el.utf8: el.po
	iconv -f ISO-8859-7 -t UTF-8 el.po >$@

en_GB.utf8: en_GB.po
	iconv -f ISO-8859-1 -t UTF-8 en_GB.po >$@

# IPA is already in UTF-8.
en@IPA.utf8: en@IPA.po
	cp en@IPA.po en@IPA.utf8

es.utf8: es.po
	iconv -f ISO-8859-1 -t UTF-8 es.po >$@

et.utf8: et.po
	iconv -f ISO-8859-1 -t UTF-8 et.po >$@

eu.utf8: eu.po
	iconv -f ISO-8859-1 -t UTF-8 eu.po >$@

# Farsi is already in UTF-8.
fa.utf8: fa.po
	cp fa.po fa.utf8

fi.utf8: fi.po
	iconv -f ISO-8859-1 -t UTF-8 fi.po >$@

fr.utf8: fr.po
	iconv -f ISO-8859-1 -t UTF-8 fr.po >$@

ga.utf8: ga.po
	iconv -f ISO-8859-1 -t UTF-8 ga.po >$@

gl.utf8: gl.po
	iconv -f ISO-8859-1 -t UTF-8 gl.po >$@

# Hebrew is already in UTF-8.
he.utf8: he.po
	cp he.po he.utf8

hr.utf8: hr.po
	iconv -f ISO-8859-2 -t UTF-8 hr.po >$@

hu.utf8: hu.po
	iconv -f ISO-8859-2 -t UTF-8 hu.po >$@

# Interlingua is in (7-bit) ASCII
ia.utf8: ia.po
	cp ia.po ia.utf8

it.utf8: it.po
	iconv -f ISO-8859-1 -t UTF-8 it.po >$@

ja.utf8: ja.po
	iconv -f EUC-JP -t UTF-8 ja.po >$@

ko.utf8: ko.po
	iconv -f EUC-KR -t UTF-8 ko.po >$@

lt.utf8: lt.po
	iconv -f ISO-8859-13 -t UTF-8 lt.po >$@

nl.utf8: nl.po
	iconv -f ISO-8859-1 -t UTF-8 nl.po >$@

no.utf8: no.po
	iconv -f ISO-8859-1 -t UTF-8 no.po >$@

pl.utf8: pl.po
	iconv -f ISO-8859-2 -t UTF-8 pl.po >$@

pt.utf8: pt.po
	iconv -f ISO-8859-1 -t UTF-8 pt.po >$@

pt_BR.utf8: pt_BR.po
	iconv -f ISO-8859-1 -t UTF-8 pt_BR.po >$@

ro.utf8: ru.po
	iconv -f ISO-8859-2 -t UTF-8 ro.po >$@

ru.utf8: ru.po
	iconv -f KOI8-R -t UTF-8 ru.po >$@

sk.utf8: sk.po
	iconv -f ISO-8859-2 -t UTF-8 sk.po >$@

sl.utf8: sl.po
	iconv -f ISO-8859-2 -t UTF-8 sl.po >$@

sv.utf8: sv.po
	iconv -f ISO-8859-1 -t UTF-8 sv.po >$@

sp.utf8: sp.po
	iconv -f ISO-8859-5 -t UTF-8 sp.po >$@

sr.utf8: sr.po
	iconv -f ISO-8859-2 -t UTF-8 sr.po >$@

uk.utf8: uk.po
	iconv -f KOI8-U -t UTF-8 uk.po >$@

tr.utf8: tr.po
	iconv -f ISO-8859-9 -t UTF-8 tr.po >$@

wa.utf8: wa.po
	iconv -f ISO-8859-1 -t UTF-8 wa.po >$@

zh_CN.gmo: zh_CN.utf8
	msgfmt -o $@ $<

zh_CN.utf8: zh_CN.GB2312.po
	iconv -f GB2312 -t UTF-8 zh_CN.GB2312.po >$@

zh_TW.gmo: zh_TW.utf8
	msgfmt -o $@ $<

zh_TW.utf8: zh_TW.Big5.po
	iconv -f BIG5 -t UTF-8 zh_TW.Big5.po >$@

clean:
	-rm *.utf8 *.gmo
