# Makefile for various po files.

SUPERSERVICE = test
COPYRIGHT_HOLDER = Stichting LogReport Foundation
MSGID_BUGS_ADDRESS = bugs@logreport.org

LINGUAS = fr

# you should not modify anything below this line

SCHEMAS = $(srcdir)/../schemas/test.xml $(srcdir)/../schemas/test-extended.xml
CFGS = $(srcdir)/../data/test-l10n_cfg.xml
REPORTS = $(srcdir)/../reports/test/top-files.xml $(srcdir)/../reports/test/top-dirs.xml
FILTERS = $(srcdir)/../filters/test/select-file.xml

SPECS = $(addprefix report_cfg:, $(CFGS)) \
	$(addprefix schema:, $(basename $(notdir $(SCHEMAS)))) \
	$(addprefix report:$(SUPERSERVICE):, $(basename $(notdir $(REPORTS)))) \
	$(addprefix filter:$(SUPERSERVICE):, $(basename $(notdir $(FILTERS))))

SUFFIXES = .po .mo .pot

TEXTDOMAIN = lire-$(SUPERSERVICE)
XML_POT_SRC = $(TEXTDOMAIN).pot.pl

TEMPLATES = $(TEXTDOMAIN).pot
CATALOGS = $(addsuffix .po, $(LINGUAS))
MO_FILES = $(addsuffix .mo, $(LINGUAS))

# MSGMERGE, MSGFMT and XGETTEXT will be set by automake
CATOBJEXT = .po
TMPLOBJEXT = .pot

POTFILES = 

SUFFIXES = .po .mo .pot

BUILT_SOURCES = $(TEMPLATES) $(MO_FILES) $(XML_POT_SRC)

MAINTAINERCLEANFILES = $(BUILT_SOURCES)

$(XML_POT_SRC): $(SCHEMAS) $(FILTERS) $(REPORTS) $(CFGS)
	$(PERL) -w -I$(top_srcdir)/all/lib \
	    $(top_builddir)/all/script/lr_spec2pot \
	    --cfgspecdir $(top_srcdir)/all/lib/config-spec	   \
	    --schemasdir $(srcdir)/../schemas \
	    --reportsdir $(srcdir)/../reports \
	    --filtersdir $(srcdir)/../filters \
	    $(SPECS) > $(XML_POT_SRC) || ( rm -f $(XML_POT_SRC); false)

$(TEMPLATES): $(XML_POT_SRC)
	@echo Updating \'$@\' catalog template.
	$(XGETTEXT) --sort-output  --foreign-user \
		--add-comments=REFERENCE: \
		--copyright-holder="$(COPYRIGHT_HOLDER)" \
		--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
		--keyword='$$__' --keyword=__ --keyword=__x \
		--keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \
		--keyword=N__ --language=Perl --output $@ $^

$(CATALOGS): $(TEMPLATES)
	@if test -f $@; then : ; else cp $< $@; fi
	$(MSGMERGE) -U $@ $< && touch $@

.po.mo:
	@echo Generating \'$@\'.
	$(MSGFMT) --check --statistics --verbose -o $@ $<

EXTRA_DIST = $(MO_FILES) $(CATALOGS) $(TEMPLATES) $(XML_POT_SRC)


syntax highlighted by Code2HTML, v. 0.9.1