Add 'git bisect replay/log' documentation.
[git.git] / Makefile
index 18696fa..38f7054 100644 (file)
--- a/Makefile
+++ b/Makefile
 # a bundled SHA1 routine optimized for PowerPC.
 #
 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
+#
 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
-
+#
+# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
+# Patrick Mauritz).
+#
+# Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
+#
 # 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.
@@ -37,7 +43,7 @@
 GIT_VERSION = 0.99.6
 
 CFLAGS = -g -O2 -Wall
-ALL_CFLAGS = $(CFLAGS) $(DEFINES)
+ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES)
 
 prefix = $(HOME)
 bindir = $(prefix)/bin
@@ -71,7 +77,7 @@ SCRIPT_SH = \
 
 SCRIPT_PERL = \
        git-archimport.perl git-cvsimport.perl git-relink.perl \
-       git-rename.perl git-send-email.perl git-shortlog.perl
+       git-rename.perl git-shortlog.perl
 
 # The ones that do not have to link with lcrypto nor lz.
 SIMPLE_PROGRAMS = \
@@ -118,7 +124,7 @@ DIFF_OBJS = \
 
 LIB_OBJS = \
        blob.o commit.o connect.o count-delta.o csum-file.o \
-       date.o diff-delta.o entry.o gitenv.o ident.o index.o \
+       date.o diff-delta.o entry.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 rev-cache.o run-command.o \
        server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
@@ -131,6 +137,17 @@ ifeq ($(shell uname -s),Darwin)
        NEEDS_SSL_WITH_CRYPTO = YesPlease
        NEEDS_LIBICONV = YesPlease
 endif
+ifeq ($(shell uname -s),SunOS)
+       NEEDS_SOCKET = YesPlease
+       PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
+endif
+
+ifndef SHELL_PATH
+       SHELL_PATH = /bin/sh
+endif
+ifndef PERL_PATH
+       PERL_PATH = /usr/bin/perl
+endif
 
 ifndef NO_OPENSSL
        LIB_OBJS += epoch.o
@@ -162,18 +179,39 @@ else
                LIBS += $(LIB_4_CRYPTO)
        endif
 endif
+ifdef NEEDS_SOCKET
+       LIBS += -lsocket
+       SIMPLE_LIB += -lsocket
+endif
 
 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 
-SCRIPTS = $(SCRIPT_SH) $(SCRIPT_PERL) gitk
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
+         $(patsubst %.perl,%,$(SCRIPT_PERL)) gitk
 
 ### Build rules
 
-all: $(PROGRAMS)
+all: $(PROGRAMS) $(SCRIPTS)
 
 all:
        $(MAKE) -C templates
 
+git: git.sh Makefile
+       rm -f $@+ $@
+       sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
+       chmod +x $@+
+       mv $@+ $@
+
+$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
+       rm -f $@
+       sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@
+       chmod +x $@
+
+$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
+       rm -f $@
+       sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
+       chmod +x $@
+
 %.o: %.c
        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 %.o: %.S
@@ -230,19 +268,8 @@ check:
 
 install: $(PROGRAMS) $(SCRIPTS)
        $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
-       $(INSTALL) $(PROGRAMS) $(DESTDIR)$(bindir)
-       @for s in $(SCRIPTS); \
-       do \
-               case "$$s" in \
-               *.*) \
-                       e=`expr "$$s" : '\(.*\)\.[^.]*$$'` ;; \
-               *) \
-                       e="$$s" ;; \
-               esac && \
-               echo ": install $$s $(DESTDIR)$(bindir)/$$e" && \
-               $(INSTALL) $$s $(DESTDIR)$(bindir)/$$e || exit; \
-       done
-       $(INSTALL) git-revert.sh $(DESTDIR)$(bindir)/git-cherry-pick
+       $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
+       $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
        sh ./cmd-rename.sh $(DESTDIR)$(bindir)
        $(MAKE) -C templates install
 
@@ -279,6 +306,7 @@ deb: dist
 
 clean:
        rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
+       rm -f $(filter-out gitk,$(SCRIPTS))
        rm -f git-core.spec
        rm -rf $(GIT_TARNAME)
        rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz