diff-tree -c: show a merge commit a bit more sensibly.
[gitweb.git] / Makefile
index 9fd2ed3d92edc7b15e13411fb09e8a2b81dd010c..2aa2385b6bed4733ba9f8f2d673596e386e7fe8e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,10 +19,18 @@ all:
 # Define NO_EXPAT if you do not have expat installed.  git-http-push is
 # not built, and you cannot push using http:// and https:// transports.
 #
+# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
+#
+# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
+# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
+#
 # Define NO_STRCASESTR if you don't have strcasestr.
 #
 # Define NO_SETENV if you don't have setenv in the C library.
 #
+# Define USE_SYMLINK_HEAD if you want .git/HEAD to be a symbolic link.
+# Don't enable it on Windows.
+#
 # Define PPC_SHA1 environment variable when running make to make use of
 # a bundled SHA1 routine optimized for PowerPC.
 #
@@ -42,6 +50,9 @@ all:
 #
 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
 #
+# Define NO_SOCKADDR_STORAGE if your platform does not have struct
+# sockaddr_storage.
+#
 # Define COLLISION_CHECK below if you believe that SHA1's
 # 1461501637330902918203684832716283019655932542976 hashes do not give you
 # sufficient guarantee that no collisions between objects will ever happen.
@@ -55,7 +66,9 @@ all:
 # Define USE_STDEV below if you want git to care about the underlying device
 # change being considered an inode change from the update-cache perspective.
 
-GIT_VERSION = 0.99.9.GIT
+GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
+       @$(SHELL) ./GIT-VERSION-GEN
+-include GIT-VERSION-FILE
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
@@ -63,9 +76,11 @@ CFLAGS = -g -O2 -Wall
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
+STRIP ?= strip
 
 prefix = $(HOME)
 bindir = $(prefix)/bin
+gitexecdir = $(prefix)/bin
 template_dir = $(prefix)/share/git-core/templates/
 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
 # DESTDIR=
@@ -89,7 +104,7 @@ SCRIPT_SH = \
        git-cherry.sh git-clone.sh git-commit.sh \
        git-count-objects.sh git-diff.sh git-fetch.sh \
        git-format-patch.sh git-log.sh git-ls-remote.sh \
-       git-merge-one-file.sh git-octopus.sh git-parse-remote.sh \
+       git-merge-one-file.sh git-parse-remote.sh \
        git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
        git-repack.sh git-request-pull.sh git-reset.sh \
        git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \
@@ -110,14 +125,14 @@ SCRIPT_PYTHON = \
 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
          $(patsubst %.perl,%,$(SCRIPT_PERL)) \
          $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
-         gitk git-cherry-pick
+         git-cherry-pick
 
 # The ones that do not have to link with lcrypto nor lz.
 SIMPLE_PROGRAMS = \
        git-get-tar-commit-id$X git-mailinfo$X git-mailsplit$X \
        git-stripspace$X git-daemon$X
 
-# ... and all the rest
+# ... and all the rest that could be moved out of bindir to gitexecdir
 PROGRAMS = \
        git-apply$X git-cat-file$X \
        git-checkout-index$X git-clone-pack$X git-commit-tree$X \
@@ -135,10 +150,11 @@ PROGRAMS = \
        git-unpack-objects$X git-update-index$X git-update-server-info$X \
        git-upload-pack$X git-verify-pack$X git-write-tree$X \
        git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
-       git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X
+       git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \
+       git-describe$X
 
-# what 'all' will build and 'install' will install.
-ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) git$X
+# what 'all' will build and 'install' will install, in gitexecdir
+ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
 
 # Backward compatibility -- to be removed after 1.0
 PROGRAMS += git-ssh-pull$X git-ssh-push$X
@@ -166,11 +182,11 @@ LIB_H = \
 
 DIFF_OBJS = \
        diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
-       diffcore-pickaxe.o diffcore-rename.o tree-diff.o
+       diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o
 
 LIB_OBJS = \
        blob.o commit.o connect.o count-delta.o csum-file.o \
-       date.o diff-delta.o entry.o ident.o index.o \
+       date.o diff-delta.o entry.o exec_cmd.o ident.o index.o \
        object.o pack-check.o patch-delta.o path.o pkt-line.o \
        quote.o read-cache.o refs.o run-command.o \
        server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
@@ -216,6 +232,7 @@ ifeq ($(uname_S),SunOS)
        SHELL_PATH = /bin/bash
        NO_STRCASESTR = YesPlease
        ifeq ($(uname_R),5.8)
+               NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
        endif
        INSTALL = ginstall
@@ -223,6 +240,8 @@ ifeq ($(uname_S),SunOS)
        ALL_CFLAGS += -D__EXTENSIONS__
 endif
 ifeq ($(uname_O),Cygwin)
+       NO_D_TYPE_IN_DIRENT = YesPlease
+       NO_D_INO_IN_DIRENT = YesPlease
        NO_STRCASESTR = YesPlease
        NEEDS_LIBICONV = YesPlease
        # There are conflicting reports about this.
@@ -231,7 +250,11 @@ ifeq ($(uname_O),Cygwin)
        # NO_MMAP = YesPlease
        NO_IPV6 = YesPlease
        X = .exe
-       ALL_CFLAGS += -DUSE_SYMLINK_HEAD=0
+endif
+ifeq ($(uname_S),FreeBSD)
+       NEEDS_LIBICONV = YesPlease
+       ALL_CFLAGS += -I/usr/local/include
+       ALL_LDFLAGS += -L/usr/local/lib
 endif
 ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
@@ -324,6 +347,12 @@ ifdef NEEDS_NSL
        LIBS += -lnsl
        SIMPLE_LIB += -lnsl
 endif
+ifdef NO_D_TYPE_IN_DIRENT
+       ALL_CFLAGS += -DNO_D_TYPE_IN_DIRENT
+endif
+ifdef NO_D_INO_IN_DIRENT
+       ALL_CFLAGS += -DNO_D_INO_IN_DIRENT
+endif
 ifdef NO_STRCASESTR
        COMPAT_CFLAGS += -DNO_STRCASESTR
        COMPAT_OBJS += compat/strcasestr.o
@@ -332,12 +361,23 @@ ifdef NO_SETENV
        COMPAT_CFLAGS += -DNO_SETENV
        COMPAT_OBJS += compat/setenv.o
 endif
+ifdef NO_SETENV
+       COMPAT_CFLAGS += -DNO_UNSETENV
+       COMPAT_OBJS += compat/unsetenv.o
+endif
 ifdef NO_MMAP
        COMPAT_CFLAGS += -DNO_MMAP
        COMPAT_OBJS += compat/mmap.o
 endif
 ifdef NO_IPV6
-       ALL_CFLAGS += -DNO_IPV6 -Dsockaddr_storage=sockaddr_in
+       ALL_CFLAGS += -DNO_IPV6
+endif
+ifdef NO_SOCKADDR_STORAGE
+ifdef NO_IPV6
+       ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in
+else
+       ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in6
+endif
 endif
 
 ifdef PPC_SHA1
@@ -363,13 +403,16 @@ LIB_OBJS += $(COMPAT_OBJS)
 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
 ### Build rules
 
-all: $(ALL_PROGRAMS)
+all: $(ALL_PROGRAMS) git$X gitk
 
 all:
        $(MAKE) -C templates
 
-git$X: git.c $(LIB_FILE) Makefile
-       $(CC) -DGIT_EXEC_PATH='"$(bindir)"' -DGIT_VERSION='"$(GIT_VERSION)"' \
+strip: $(PROGRAMS) git$X
+       $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
+
+git$X: git.c $(LIB_FILE)
+       $(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
                $(CFLAGS) $(COMPAT_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE)
 
 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
@@ -397,11 +440,20 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
 git-cherry-pick: git-revert
        cp $< $@
 
+# These can record GIT_VERSION
+git$X git.spec \
+       $(patsubst %.sh,%,$(SCRIPT_SH)) \
+       $(patsubst %.perl,%,$(SCRIPT_PERL)) \
+       $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
+       : GIT-VERSION-FILE
+
 %.o: %.c
        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 %.o: %.S
        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
+exec_cmd.o: ALL_CFLAGS += -DGIT_EXEC_PATH=\"$(gitexecdir)\"
+
 git-%$X: %.o $(LIB_FILE)
        $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
 
@@ -458,7 +510,9 @@ check:
 
 install: all
        $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
-       $(INSTALL) $(ALL_PROGRAMS) $(call shellquote,$(DESTDIR)$(bindir))
+       $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(gitexecdir))
+       $(INSTALL) $(ALL_PROGRAMS) $(call shellquote,$(DESTDIR)$(gitexecdir))
+       $(INSTALL) git$X gitk $(call shellquote,$(DESTDIR)$(bindir))
        $(MAKE) -C templates install
        $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
        $(INSTALL) $(PYMODULES) $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
@@ -471,7 +525,7 @@ install-doc:
 
 ### Maintainer's dist rules
 
-git.spec: git.spec.in Makefile
+git.spec: git.spec.in
        sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
 
 GIT_TARNAME=git-$(GIT_VERSION)
@@ -479,30 +533,28 @@ dist: git.spec git-tar-tree
        ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
        @mkdir -p $(GIT_TARNAME)
        @cp git.spec $(GIT_TARNAME)
-       $(TAR) rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git.spec
+       @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
+       $(TAR) rf $(GIT_TARNAME).tar \
+               $(GIT_TARNAME)/git.spec $(GIT_TARNAME)/version
        @rm -rf $(GIT_TARNAME)
        gzip -f -9 $(GIT_TARNAME).tar
 
 rpm: dist
        $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
 
-deb: dist
-       rm -rf $(GIT_TARNAME)
-       $(TAR) zxf $(GIT_TARNAME).tar.gz
-       dpkg-source -b $(GIT_TARNAME)
-       cd $(GIT_TARNAME) && fakeroot debian/rules binary
-
 ### Cleaning rules
 
 clean:
        rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o $(LIB_FILE)
-       rm -f $(PROGRAMS) $(SIMPLE_PROGRAMS) git$X
-       rm -f $(filter-out gitk,$(SCRIPTS))
-       rm -f *.spec *.pyc *.pyo
+       rm -f $(ALL_PROGRAMS) git$X
+       rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo
        rm -rf $(GIT_TARNAME)
        rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
-       rm -f git-core_$(GIT_VERSION)-*.dsc
-       rm -f git-*_$(GIT_VERSION)-*.deb
        $(MAKE) -C Documentation/ clean
        $(MAKE) -C templates clean
        $(MAKE) -C t/ clean
+       rm -f GIT-VERSION-FILE
+
+.PHONY: all install clean strip
+.PHONY: .FORCE-GIT-VERSION-FILE
+