# Generated automatically from Makefile.in by configure.
# Makefile for check subdirectory in GNU gettext package.
# Copyright (C) 1995 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

PACKAGE = gettext
VERSION = 0.10

SHELL = /bin/sh


srcdir = .
top_srcdir = ..

subdir = checks

GETTEXT = ../src/gettext
MSGFMT = ../src/msgfmt
XGETTEXT = ../src/xgettext
MSGCMP = LANGUAGE= LC_ALL= LC_MESSAGES= LANG= ../src/msgcmp
MSGMERGE = LANGUAGE= LC_ALL= LC_MESSAGES= LANG= ../src/msgmerge
MSGUNFMT = ../src/msgunfmt

TESTSRCS = module1.po module2.po xg-test2.in test5.po \
mc-test1.in1 mc-test1.in2 mc-test2.in1 mc-test2.in2 \
mm-test1.in1 mm-test1.in2 mm-test2.in1 mm-test2.in2 \
mu-test1.in xg-test4.in xg-test5.in xg-test6.in xg-test7.in
OKFILES = xg-test1.ok xg-test2.ok test1.ok test2.ok mc-test2.ok \
mm-test1.ok mm-test2.ok xg-test4.ok xg-test5.ok xg-test6.ok xg-test7.ok
DISTFILES = ChangeLog Makefile.in $(TESTSRCS) $(OKFILES)

all:

check:
	$(XGETTEXT) -d xg-test1 -k_ --omit-header \
		$(top_srcdir)/src/xgettext.c \
		$(top_srcdir)/src/msgfmt.c $(top_srcdir)/src/gettextp.c
	@diff $(srcdir)/xg-test1.ok xg-test1.po \
	  || (echo "xgettext test 1 failed!"; exit 1)
	$(XGETTEXT) -d xg-test2 -k_ --omit-header $(srcdir)/xg-test2.in
	@diff $(srcdir)/xg-test2.ok xg-test2.po \
	  || (echo "xgettext test 2 failed!"; exit 1)
	TEXTDOMAINDIR=$(top_srcdir) LANG=checks LC_ALL= LC_MESSAGES= \
	  LANGUAGE= $(GETTEXT) test 'SYS_(C)' > test1.out
	@diff $(srcdir)/test1.ok test1.out \
	  || (echo "gettext test 1 failed!"; exit 1)
	TEXTDOMAINDIR=$(top_srcdir) LANG=checks LC_ALL= LC_MESSAGES= \
	  LANGUAGE= $(GETTEXT) test 'error 3' > test2.out
	@diff $(srcdir)/test2.ok test2.out \
	  || (echo "gettext test 2 failed!"; exit 1)
	# The else case in the following line is needed by Buglix' sh.
	if test ! -d LC_MESSAGES; then mkdir LC_MESSAGES; else :; fi
	$(MSGFMT) $(srcdir)/module1.po $(srcdir)/module2.po \
	  -o LC_MESSAGES/gen.mo
	TEXTDOMAINDIR=.. LANG=checks LC_ALL= LC_MESSAGES= \
	  LANGUAGE= $(GETTEXT) gen 'SYS_(C)' > test3.out
	@diff $(srcdir)/test1.ok test3.out \
	  || (echo "msgfmt test 1 failed!"; exit 1)
	TEXTDOMAINDIR=.. LANG=checks LC_ALL= LC_MESSAGES= \
	  LANGUAGE= $(GETTEXT) gen 'error 3' > test4.out
	@diff $(srcdir)/test2.ok test4.out \
	  || (echo "msgfmt test 2 failed!"; exit 1)
	$(MSGFMT) $(srcdir)/test5.po -o test5.mo
	@test ! -f test5.mo || (echo "msgfmt test 3 failed!"; exit 1)
	rm -f zero-domain.po
	$(XGETTEXT) -k_ -d zero-domain -x $(top_srcdir)/po/gettext.pot \
	  $(top_srcdir)/src/xgettext.c
	@test ! -f zero-domain.po || (echo "xgettext test 3 failed!"; exit 1)
	$(XGETTEXT) --omit-header --add-location $(srcdir)/xg-test4.in \
	  -d xg-test4
	sed -e 's@$(srcdir)/@@' < xg-test4.po > xg-test4.out
	@diff $(srcdir)/xg-test4.ok xg-test4.out \
	  || (echo "xgettext test 4 failed!"; exit 1)
	$(XGETTEXT) --omit-header --trigraphs $(srcdir)/xg-test5.in -d xg-test5
	@diff $(srcdir)/xg-test5.ok xg-test5.po \
	  || (echo "xgettext test 5 failed!"; exit 1)
	$(XGETTEXT) --omit-header --add-comments $(srcdir)/xg-test6.in \
	  -d xg-test6
	@diff $(srcdir)/xg-test6.ok xg-test6.po \
	  || (echo "xgettext test 6 failed!"; exit 1)
	@$(MSGCMP) $(srcdir)/mc-test1.in1 $(srcdir)/mc-test1.in2 \
	  || (echo "msgcmp test 1 failed!"; exit 1)
	$(MSGCMP) $(srcdir)/mc-test2.in1 $(srcdir)/mc-test2.in2 2>&1 \
	  | sed "s,^$(srcdir)/,," > mc-test2.out 2>&1 || :
	@diff $(srcdir)/mc-test2.ok mc-test2.out \
	  || (echo "msgcmp test 2 failed!"; exit 1)
	$(MSGMERGE) $(srcdir)/mm-test1.in1 $(srcdir)/mm-test1.in2 \
	  -o mm-test1.out
	@diff $(srcdir)/mm-test1.ok mm-test1.out \
	  || (echo "msgmerge test 1 failed!"; exit 1)
	$(MSGMERGE) $(srcdir)/mm-test2.in1 $(srcdir)/mm-test2.in2 \
	  -o /dev/stdout 2> tmp.out || :
	sed -e 's@$(srcdir)/@@' < tmp.out > mm-test2.out
	@diff $(srcdir)/mm-test2.ok mm-test2.out \
	  || (echo "msgmerge test 2 failed!"; exit 1)
	$(MSGFMT) -o mu-test1.out $(srcdir)/mu-test1.in
	$(MSGUNFMT) mu-test1.out mu-test1.out
	@diff $(srcdir)/mu-test1.in mu-test1.out \
	  || (echo "msgunfmt test 1 failed!"; exit 1)
	$(XGETTEXT) --omit-header --add-comments=XXX: $(srcdir)/xg-test7.in \
	  -d xg-test7 --c++
	@diff $(srcdir)/xg-test7.ok xg-test7.po \
	  || (echo "xgettext test 7 failed!"; exit 1)
	@echo '=========================='
	@echo 'All checks are successful.'
	@echo '=========================='

install uninstall install-src tags TAGS id ID:

mostlyclean:
	rm -f core core.*

clean: mostlyclean
	rm -f xg-test1.po xg-text2.po xg-test4.po xg-test5.po xg-test6.po
	rm -f xg-test7.po *.out LC_MESSAGES/gen.mo zero-domain.po

distclean: clean
	rm -f Makefile

maintainer-clean: distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist dist-gettext: Makefile $(DISTFILES)
	$(XGETTEXT) -d xg-test1.ok -p $(srcdir) -k_ --omit-header \
		$(top_srcdir)/src/xgettext.c $(top_srcdir)/src/msgfmt.c \
		$(top_srcdir)/src/gettextp.c
	for file in $(DISTFILES); do \
	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
	    || cp -p $(srcdir)/$$file $(distdir); \
	done
	mkdir $(distdir)/LC_MESSAGES
	chmod 777 $(distdir)/LC_MESSAGES
	ln $(srcdir)/LC_MESSAGES/test.mo $(distdir)/LC_MESSAGES 2> /dev/null \
	  || cp -p $(srcdir)/LC_MESSAGES/test.mo $(distdir)/LC_MESSAGES

Makefile: Makefile.in ../config.status
	cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
