Makefileon commit git-gui: Ensure version number is always current. (f1cee4e)
   1all::
   2
   3GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
   4        @$(SHELL_PATH) ./GIT-VERSION-GEN
   5-include GIT-VERSION-FILE
   6
   7SCRIPT_SH = git-gui.sh
   8GITGUI_BUILT_INS = git-citool
   9ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
  10
  11ifndef SHELL_PATH
  12        SHELL_PATH = /bin/sh
  13endif
  14
  15gitexecdir := $(shell git --exec-path)
  16INSTALL = install
  17
  18DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
  19gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
  20
  21SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
  22
  23$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
  24        rm -f $@ $@+
  25        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
  26                -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
  27                $@.sh >$@+
  28        chmod +x $@+
  29        mv $@+ $@
  30
  31$(GITGUI_BUILT_INS): git-gui
  32        rm -f $@ && ln git-gui $@
  33
  34# These can record GIT_VERSION
  35$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
  36
  37all:: $(ALL_PROGRAMS)
  38
  39install: all
  40        $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
  41        $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
  42        $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
  43
  44clean::
  45        rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
  46
  47.PHONY: all install clean
  48.PHONY: .FORCE-GIT-VERSION-FILE