]>
Commit | Line | Data |
---|---|---|
62ba5143 JH |
1 | # The default target of this Makefile is... |
2 | all:: | |
3 | ||
4 | prefix ?= $(HOME) | |
5 | bindir ?= $(prefix)/bin | |
f85fd3f0 JH |
6 | sharedir ?= $(prefix)/share |
7 | gitk_libdir ?= $(sharedir)/gitk/lib | |
8 | msgsdir ?= $(gitk_libdir)/msgs | |
9 | msgsdir_SQ = $(subst ','\'',$(msgsdir)) | |
10 | ||
4698ef55 | 11 | TCL_PATH ?= tclsh |
62ba5143 JH |
12 | TCLTK_PATH ?= wish |
13 | INSTALL ?= install | |
14 | RM ?= rm -f | |
15 | ||
16 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) | |
17 | bindir_SQ = $(subst ','\'',$(bindir)) | |
18 | TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) | |
19 | ||
f85fd3f0 JH |
20 | ## po-file creation rules |
21 | XGETTEXT ?= xgettext | |
887ad798 JH |
22 | ifdef NO_MSGFMT |
23 | MSGFMT ?= $(TCL_PATH) po/po2msg.sh | |
24 | else | |
25 | MSGFMT ?= msgfmt | |
4698ef55 JH |
26 | ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0) |
27 | MSGFMT := $(TCL_PATH) po/po2msg.sh | |
28 | endif | |
887ad798 JH |
29 | endif |
30 | ||
f85fd3f0 JH |
31 | PO_TEMPLATE = po/gitk.pot |
32 | ALL_POFILES = $(wildcard po/*.po) | |
33 | ALL_MSGFILES = $(subst .po,.msg,$(ALL_POFILES)) | |
34 | ||
62ba5143 JH |
35 | ifndef V |
36 | QUIET = @ | |
37 | QUIET_GEN = $(QUIET)echo ' ' GEN $@ && | |
38 | endif | |
39 | ||
f85fd3f0 JH |
40 | all:: gitk-wish $(ALL_MSGFILES) |
41 | ||
62ba5143 | 42 | install:: all |
c7ea4536 JH |
43 | $(INSTALL) -m 755 gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk |
44 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)' | |
45 | $(foreach p,$(ALL_MSGFILES), $(INSTALL) -m 644 $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true | |
f85fd3f0 JH |
46 | |
47 | uninstall:: | |
48 | $(foreach p,$(ALL_MSGFILES), $(RM) '$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) &&) true | |
49 | $(RM) '$(DESTDIR_SQ)$(bindir_SQ)'/gitk | |
50 | ||
62ba5143 | 51 | clean:: |
f85fd3f0 | 52 | $(RM) gitk-wish po/*.msg |
62ba5143 JH |
53 | |
54 | gitk-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 $@+ $@ | |
f85fd3f0 JH |
59 | |
60 | $(PO_TEMPLATE): gitk | |
61 | $(XGETTEXT) -kmc -LTcl -o $@ gitk | |
62 | update-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 |