git-gui: add hotkey to toggle "Amend Last Commit"
[gitweb.git] / Makefile
index 01e0a46ba56faa8a17ed8710346b18dd215899c7..fe30be38dc8c534cabf8a0f7145c41aecd1e6989 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,10 +4,10 @@ all::
 #
 # Define NO_MSGFMT if you do not have msgfmt from the GNU gettext
 # package and want to use our rough pure Tcl po->msg translator.
-# TCL_PATH must be vaild for this to work.
+# TCL_PATH must be valid for this to work.
 #
 
-GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
+GIT-VERSION-FILE: FORCE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
 -include GIT-VERSION-FILE
 
@@ -34,8 +34,12 @@ ifndef gitexecdir
 endif
 
 ifndef sharedir
+ifeq (git-core,$(notdir $(gitexecdir)))
+       sharedir := $(dir $(patsubst %/,%,$(dir $(gitexecdir))))share
+else
        sharedir := $(dir $(gitexecdir))share
 endif
+endif
 
 ifndef INSTALL
        INSTALL = install
@@ -101,8 +105,11 @@ endif
 
 ifeq ($(uname_S),Darwin)
        TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
-       ifeq ($(shell expr "$(uname_R)" : '9\.'),2)
-               TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
+       ifeq ($(shell echo "$(uname_R)" | awk -F. '{if ($$1 >= 9) print "y"}')_$(shell test -d $(TKFRAMEWORK) || echo n),y_n)
+               TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish.app
+               ifeq ($(shell test -d $(TKFRAMEWORK) || echo n),n)
+                       TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
+               endif
        endif
        TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
 endif
@@ -156,6 +163,7 @@ endif
 ifneq (,$(findstring MINGW,$(uname_S)))
        NO_MSGFMT=1
        GITGUI_WINDOWS_WRAPPER := YesPlease
+       GITGUI_RELATIVE := 1
 endif
 
 ifdef GITGUI_MACOSXAPP
@@ -169,7 +177,8 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
        echo then >>$@+ && \
        echo '  'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
        echo else >>$@+ && \
-       echo '  'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
+       echo '  libdir="$${GIT_GUI_LIB_DIR:-$(libdir_SQ)}"' >>$@+ && \
+       echo '  'exec \"'$$libdir/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\" \
                '"$$0" "$$@"' >>$@+ && \
        echo fi >>$@+ && \
        chmod +x $@+ && \
@@ -207,6 +216,7 @@ endif
 $(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
        $(QUIET_GEN)rm -f $@ $@+ && \
        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
+               -e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
                -e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
                -e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
                -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
@@ -221,7 +231,7 @@ ifdef NO_MSGFMT
        MSGFMT ?= $(TCL_PATH) po/po2msg.sh
 else
        MSGFMT ?= msgfmt
-       ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+       ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0)
                MSGFMT := $(TCL_PATH) po/po2msg.sh
        endif
 endif
@@ -245,11 +255,11 @@ lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
          auto_mkindex lib '*.tcl' \
        | $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \
        else \
-        echo 1>&2 "    * $(TCL_PATH) failed; using unoptimized loading"; \
+        echo >&2 "    * $(TCL_PATH) failed; using unoptimized loading"; \
         rm -f $@ ; \
         echo '# Autogenerated by git-gui Makefile' >$@ && \
         echo >>$@ && \
-        $(foreach p,$(PRELOAD_FILES) $(ALL_LIBFILES),echo '$(subst lib/,,$p)' >>$@ &&) \
+        $(foreach p,$(PRELOAD_FILES) $(sort $(ALL_LIBFILES)),echo '$(subst lib/,,$p)' >>$@ &&) \
         echo >>$@ ; \
        fi
 
@@ -262,11 +272,11 @@ TRACK_VARS = \
        GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \
 #end TRACK_VARS
 
-GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
+GIT-GUI-VARS: FORCE
        @VARS='$(TRACK_VARS)'; \
        if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
-               echo 1>&2 "    * new locations or Tcl/Tk interpreter"; \
-               echo 1>$@ "$$VARS"; \
+               echo >&2 "    * new locations or Tcl/Tk interpreter"; \
+               echo >$@ "$$VARS"; \
        fi
 
 ifdef GITGUI_MACOSXAPP
@@ -280,6 +290,7 @@ all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
 install: all
        $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
        $(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
+       $(QUIET)$(INSTALL_X0)git-gui--askpass $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
        $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true
 ifdef GITGUI_WINDOWS_WRAPPER
        $(QUIET)$(INSTALL_R0)git-gui.tcl $(INSTALL_R1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
@@ -297,6 +308,7 @@ endif
 uninstall:
        $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
        $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui $(REMOVE_F1)
+       $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui--askpass $(REMOVE_F1)
        $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true
 ifdef GITGUI_WINDOWS_WRAPPER
        $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/git-gui.tcl $(REMOVE_F1)
@@ -330,5 +342,4 @@ ifdef GITGUI_WINDOWS_WRAPPER
 endif
 
 .PHONY: all install uninstall dist-version clean
-.PHONY: .FORCE-GIT-VERSION-FILE
-.PHONY: .FORCE-GIT-GUI-VARS
+.PHONY: FORCE