blob: f90dfabffa894741f500e513d5380c7752d0195c [file] [log] [blame]
Junio C Hamano62ba5142007-11-17 10:51:16 -08001# The default target of this Makefile is...
2all::
3
4prefix ?= $(HOME)
5bindir ?= $(prefix)/bin
Junio C Hamanof85fd3f2008-01-08 22:41:15 -08006sharedir ?= $(prefix)/share
7gitk_libdir ?= $(sharedir)/gitk/lib
8msgsdir ?= $(gitk_libdir)/msgs
9msgsdir_SQ = $(subst ','\'',$(msgsdir))
10
Junio C Hamano4698ef52008-03-14 17:49:40 -070011TCL_PATH ?= tclsh
Junio C Hamano62ba5142007-11-17 10:51:16 -080012TCLTK_PATH ?= wish
13INSTALL ?= install
14RM ?= rm -f
15
16DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
17bindir_SQ = $(subst ','\'',$(bindir))
18TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
19
Junio C Hamanof85fd3f2008-01-08 22:41:15 -080020## po-file creation rules
21XGETTEXT ?= xgettext
Junio C Hamano887ad792008-01-11 00:51:30 -080022ifdef NO_MSGFMT
23 MSGFMT ?= $(TCL_PATH) po/po2msg.sh
24else
25 MSGFMT ?= msgfmt
Junio C Hamano4698ef52008-03-14 17:49:40 -070026 ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0)
27 MSGFMT := $(TCL_PATH) po/po2msg.sh
28 endif
Junio C Hamano887ad792008-01-11 00:51:30 -080029endif
30
Junio C Hamanof85fd3f2008-01-08 22:41:15 -080031PO_TEMPLATE = po/gitk.pot
32ALL_POFILES = $(wildcard po/*.po)
33ALL_MSGFILES = $(subst .po,.msg,$(ALL_POFILES))
34
Junio C Hamano62ba5142007-11-17 10:51:16 -080035ifndef V
36 QUIET = @
37 QUIET_GEN = $(QUIET)echo ' ' GEN $@ &&
38endif
39
Junio C Hamanof85fd3f2008-01-08 22:41:15 -080040all:: gitk-wish $(ALL_MSGFILES)
41
Junio C Hamano62ba5142007-11-17 10:51:16 -080042install:: all
43 $(INSTALL) gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
Junio C Hamanof85fd3f2008-01-08 22:41:15 -080044 $(INSTALL) -d '$(DESTDIR_SQ)$(msgsdir_SQ)'
45 $(foreach p,$(ALL_MSGFILES), $(INSTALL) $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
46
47uninstall::
48 $(foreach p,$(ALL_MSGFILES), $(RM) '$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) &&) true
49 $(RM) '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
50
Junio C Hamano62ba5142007-11-17 10:51:16 -080051clean::
Junio C Hamanof85fd3f2008-01-08 22:41:15 -080052 $(RM) gitk-wish po/*.msg
Junio C Hamano62ba5142007-11-17 10:51:16 -080053
54gitk-wish: gitk
55 $(QUIET_GEN)$(RM) $@ $@+ && \
56 sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
57 chmod +x $@+ && \
58 mv -f $@+ $@
Junio C Hamanof85fd3f2008-01-08 22:41:15 -080059
60$(PO_TEMPLATE): gitk
61 $(XGETTEXT) -kmc -LTcl -o $@ gitk
62update-po:: $(PO_TEMPLATE)
63 $(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; )
64$(ALL_MSGFILES): %.msg : %.po
65 @echo Generating catalog $@
66 $(MSGFMT) --statistics --tcl $< -l $(basename $(notdir $<)) -d $(dir $@)
67