# po/Makefile for libelf.
# Copyright (C) 1995 - 2006 Michael Riepe
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# This library 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
# Library General Public License for more details.
# 
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

# @(#) $Id: Makefile.in,v 1.18 2008/05/23 08:16:46 michael Exp $

instroot =

prefix = @prefix@
exec_prefix = @exec_prefix@
localedir = @localedir@

CC = @CC@
RM = rm -f
MV = mv -f
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

GENCAT = @GENCAT@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@

CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
DEFS = -DHAVE_CONFIG_H
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
LIBINTL = @LIBINTL@

# no user serviceable parts below

PACKAGE = @PACKAGE@
VERSION = @VERSION@

SHELL = /bin/sh
@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

topdir = ..
subdir = po

.SUFFIXES:
.SUFFIXES: .po .mo .gmo .msg .cat

.po.mo:
	@$(RM) $@
	$(MSGFMT) -o $@ $<

.po.gmo:
	file=$(srcdir)/`echo $*|sed 's,.*/,,'`.gmo; \
	  $(RM) $$file && $(GMSGFMT) -o $$file $<

.msg.cat:
	@$(RM) $@
	$(GENCAT) $@ $<

POFILES = @POFILES@
GMOFILES = @GMOFILES@
MSGFILES = @MSGFILES@

DISTFILES = \
	gmo2msg.c Makefile.in $(PACKAGE).pot stamp-po \
	$(POFILES) $(GMOFILES) $(MSGFILES)

POTFILES = $(top_srcdir)/lib/errors.h

CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@

all: $(CATALOGS)

check:

install: all install-data

install-data: $(top_srcdir)/mkinstalldirs
	catalogs="$(CATALOGS)"; for cat in $$catalogs; do \
	  lang=`echo $$cat | sed 's,$(CATOBJEXT)$$,,'`; \
	  dir=$(localedir)/$$lang/LC_MESSAGES; \
	  $(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir; \
	  if test -r $$cat; then \
	    $(INSTALL_DATA) $$cat $(instroot)$$dir/$(PACKAGE)$(INSTOBJEXT); \
	  else \
	    $(INSTALL_DATA) $(srcdir)/$$cat $(instroot)$$dir/$(PACKAGE)$(INSTOBJEXT); \
	  fi; \
	done

uninstall:
	catalogs="$(CATALOGS)"; for cat in $$catalogs; do \
	  lang=`echo $$cat | sed 's,$(CATOBJEXT)$$,,'`; \
	  $(RM) $(instroot)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
	done

mostlyclean:
	$(RM) core core.* $(PACKAGE).po *.po.tmp

clean: mostlyclean

distclean: clean
	$(RM) gmo2msg *.mo *.cat
	$(RM) Makefile

maintainer-clean: distclean
	$(RM) stamp-po

$(PACKAGE).pot: $(POTFILES)
	$(XGETTEXT) -c -d$(PACKAGE) -k_ $(POTFILES)
	if cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \
	  $(RM) $(PACKAGE).po; \
	else \
	  $(RM) $(srcdir)/$(PACKAGE).pot && \
	    $(MV) $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; \
	fi

update-po: stamp-po
stamp-po: $(PACKAGE).pot
	pofiles="$(POFILES)"; cd $(srcdir) && for po in $$pofiles; do \
	  $(RM) $$po.tmp; \
	  if $(MSGMERGE) $$po $(PACKAGE).pot > $$po.tmp; then \
	    $(RM) $$po; \
	    $(MV) $$po.tmp $$po; \
	  else \
	    echo "update for $$po failed!"; \
	    $(RM) $$po.tmp; \
	  fi; \
	done
	$(RM) $@ && echo timestamp > $@

# Create X/Open message catalog sources from .gmo files.

.gmo.msg:
	$(MAKE) $(srcdir)/gmo2msg
	cd $(srcdir) && ./gmo2msg `echo $*|sed 's,.*/,,'`

.SUFFIXES: .c

.c:
	@$(RM) $@
	$(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) \
	  $(LDFLAGS) $*.c $(LIBS) $(LIBINTL) -o $@

INCLUDES = -I$(topdir) -I. -I$(topdir)/lib -I$(srcdir) -I$(top_srcdir)/lib

# maintainer only

MAINT = @MAINT@

distdir = $(PACKAGE)-$(VERSION)
distsubdir = $(topdir)/$(distdir)/$(subdir)
$(MAINT)dist: update-po $(DISTFILES)
	if test -d $(distsubdir); then true; else mkdir $(distsubdir); fi
	files="$(DISTFILES)"; for file in $$files; do \
	  ln $(srcdir)/$$file $(distsubdir) >/dev/null 2>&1 || \
	    cp -p $(srcdir)/$$file $(distsubdir) || exit 1; \
	done

# For the justification of the following Makefile rules, see node
# `Automatic Remaking' in GNU Autoconf documentation.

$(MAINT)Makefile: Makefile.in $(topdir)/config.status
	cd $(topdir) && 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:
