X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gitk-git%2FMakefile;h=f90dfabffa894741f500e513d5380c7752d0195c;hb=319a36a5c2da8dd07993caac43b7820bff3b0d37;hp=9bc1e24082f80b09b08839c63cf67202833277c3;hpb=d9f405931fa3d96b2a80fe5ad8205eea7c443f56;p=git.git diff --git a/gitk-git/Makefile b/gitk-git/Makefile index 9bc1e2408..f90dfabff 100644 --- a/gitk-git/Makefile +++ b/gitk-git/Makefile @@ -3,6 +3,12 @@ all:: prefix ?= $(HOME) bindir ?= $(prefix)/bin +sharedir ?= $(prefix)/share +gitk_libdir ?= $(sharedir)/gitk/lib +msgsdir ?= $(gitk_libdir)/msgs +msgsdir_SQ = $(subst ','\'',$(msgsdir)) + +TCL_PATH ?= tclsh TCLTK_PATH ?= wish INSTALL ?= install RM ?= rm -f @@ -11,19 +17,51 @@ DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) bindir_SQ = $(subst ','\'',$(bindir)) TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) +## po-file creation rules +XGETTEXT ?= xgettext +ifdef NO_MSGFMT + MSGFMT ?= $(TCL_PATH) po/po2msg.sh +else + MSGFMT ?= msgfmt + ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0) + MSGFMT := $(TCL_PATH) po/po2msg.sh + endif +endif + +PO_TEMPLATE = po/gitk.pot +ALL_POFILES = $(wildcard po/*.po) +ALL_MSGFILES = $(subst .po,.msg,$(ALL_POFILES)) + ifndef V QUIET = @ QUIET_GEN = $(QUIET)echo ' ' GEN $@ && endif -all:: gitk-wish +all:: gitk-wish $(ALL_MSGFILES) + install:: all $(INSTALL) gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk + $(INSTALL) -d '$(DESTDIR_SQ)$(msgsdir_SQ)' + $(foreach p,$(ALL_MSGFILES), $(INSTALL) $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true + +uninstall:: + $(foreach p,$(ALL_MSGFILES), $(RM) '$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) &&) true + $(RM) '$(DESTDIR_SQ)$(bindir_SQ)'/gitk + clean:: - $(RM) gitk-wish + $(RM) gitk-wish po/*.msg gitk-wish: gitk $(QUIET_GEN)$(RM) $@ $@+ && \ sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' $@+ && \ chmod +x $@+ && \ mv -f $@+ $@ + +$(PO_TEMPLATE): gitk + $(XGETTEXT) -kmc -LTcl -o $@ gitk +update-po:: $(PO_TEMPLATE) + $(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; ) +$(ALL_MSGFILES): %.msg : %.po + @echo Generating catalog $@ + $(MSGFMT) --statistics --tcl $< -l $(basename $(notdir $<)) -d $(dir $@) +