# vim:ts=2
# makefile for realpath

ALL_TARGET=build-local
SUBDIRS=
include ../../common.mk

NLS_SOURCES 		:= ../../src/realpath.c
POFILES					:= $(sort $(wildcard *.po))
MOFILES				  := $(patsubst %.po,$(bdir)/%.mo,$(POFILES))


build-local: $(MOFILES)


install-local: override ATT := $(AT)
install-local: override AT  :=
install-local: $(MOFILES)
	$(ATT) $(foreach file,$(MOFILES),	\
		$(call install,$(nlsdir)/$(notdir $(basename $(file)))/LC_MESSAGES/$(PACKAGE).mo,$(file),notdir))

$(bdir)/%.mo: %.po
	$(AT) mkdir -p $(bdir)
	msgfmt  -o $@ $<

$(PACKAGE).pot:	$(NLS_SOURCES) | $(MAKEFILE_LIST)
	xgettext -L C  -k -k_  $(XGETTEXT_COMMON_OPTIONS) -o $@.new $^
	$(call pochanged,$@,$@.new)

%.po: $(PACKAGE).pot
	msgmerge --previous $@ $< > $@.new
	$(call pochanged,$@,$@.new)

update-po: 
	$(MAKE) -W $(firstword $(NLS_SOURCES)) $(POFILES) 


.PHONY: update-po
