Junio C Hamano | 2731d04 | 2005-12-01 12:26:41 -0800 | [diff] [blame] | 1 | # The default target of this Makefile is... |
| 2 | all: |
| 3 | |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 4 | # Define MOZILLA_SHA1 environment variable when running make to make use of |
| 5 | # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast |
| 6 | # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default |
| 7 | # choice) has very fast version optimized for i586. |
| 8 | # |
Linus Torvalds | 765ac8e | 2006-02-28 15:07:20 -0800 | [diff] [blame] | 9 | # Define NO_OPENSSL environment variable if you do not have OpenSSL. |
| 10 | # This also implies MOZILLA_SHA1. |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 11 | # |
Nick Hengeveld | 58e60dd | 2005-11-02 11:19:24 -0800 | [diff] [blame] | 12 | # Define NO_CURL if you do not have curl installed. git-http-pull and |
| 13 | # git-http-push are not built, and you cannot use http:// and https:// |
| 14 | # transports. |
Johannes Schindelin | b2c0bd6 | 2005-07-31 02:14:23 +0200 | [diff] [blame] | 15 | # |
Patrick Mauritz | 6d9bbc5 | 2005-09-19 16:11:19 +0200 | [diff] [blame] | 16 | # Define CURLDIR=/foo/bar if your curl header and library files are in |
| 17 | # /foo/bar/include and /foo/bar/lib directories. |
| 18 | # |
Nick Hengeveld | 58e60dd | 2005-11-02 11:19:24 -0800 | [diff] [blame] | 19 | # Define NO_EXPAT if you do not have expat installed. git-http-push is |
| 20 | # not built, and you cannot push using http:// and https:// transports. |
| 21 | # |
Junio C Hamano | 35a730f | 2006-01-19 17:13:51 -0800 | [diff] [blame] | 22 | # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. |
| 23 | # |
Junio C Hamano | 63be37b | 2006-01-19 17:13:57 -0800 | [diff] [blame] | 24 | # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks |
| 25 | # d_type in struct dirent (latest Cygwin -- will be fixed soonish). |
| 26 | # |
Linus Torvalds | ef34af2 | 2005-09-18 18:30:50 -0700 | [diff] [blame] | 27 | # Define NO_STRCASESTR if you don't have strcasestr. |
| 28 | # |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 29 | # Define NO_SETENV if you don't have setenv in the C library. |
| 30 | # |
Pavel Roskin | 2fabd21 | 2005-11-15 00:59:50 -0500 | [diff] [blame] | 31 | # Define USE_SYMLINK_HEAD if you want .git/HEAD to be a symbolic link. |
| 32 | # Don't enable it on Windows. |
| 33 | # |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 34 | # Define PPC_SHA1 environment variable when running make to make use of |
| 35 | # a bundled SHA1 routine optimized for PowerPC. |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 36 | # |
Nicolas Pitre | 7c6ef2f | 2005-09-20 12:27:13 -0400 | [diff] [blame] | 37 | # Define ARM_SHA1 environment variable when running make to make use of |
| 38 | # a bundled SHA1 routine optimized for ARM. |
| 39 | # |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 40 | # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin). |
Patrick Mauritz | f0ebff0 | 2005-09-06 01:24:03 +0200 | [diff] [blame] | 41 | # |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 42 | # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin). |
Patrick Mauritz | f0ebff0 | 2005-09-06 01:24:03 +0200 | [diff] [blame] | 43 | # |
| 44 | # Define NEEDS_SOCKET if linking with libc is not enough (SunOS, |
| 45 | # Patrick Mauritz). |
| 46 | # |
Johannes Schindelin | 730d48a | 2005-10-08 15:54:36 -0700 | [diff] [blame] | 47 | # Define NO_MMAP if you want to avoid mmap. |
| 48 | # |
Junio C Hamano | 343d35c | 2005-09-19 19:47:54 -0700 | [diff] [blame] | 49 | # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3. |
| 50 | # |
hpa | 49744d6 | 2005-09-28 16:52:21 -0700 | [diff] [blame] | 51 | # Define NO_IPV6 if you lack IPv6 support and getaddrinfo(). |
| 52 | # |
Junio C Hamano | bdc37f5 | 2006-01-19 17:13:32 -0800 | [diff] [blame] | 53 | # Define NO_SOCKADDR_STORAGE if your platform does not have struct |
| 54 | # sockaddr_storage. |
| 55 | # |
Fernando J. Pereda | b6e56ec | 2006-02-16 09:38:01 +0100 | [diff] [blame] | 56 | # Define NO_ICONV if your libc does not properly support iconv. |
| 57 | # |
Johannes Schindelin | 5b5d4d9 | 2006-02-17 15:23:16 +0100 | [diff] [blame] | 58 | # Define NO_ACCURATE_DIFF if your diff program at least sometimes misses |
| 59 | # a missing newline at the end of the file. |
| 60 | # |
Johannes Schindelin | abb7c7b | 2006-02-18 13:01:18 +0100 | [diff] [blame] | 61 | # Define NO_PYTHON if you want to loose all benefits of the recursive merge. |
| 62 | # |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 63 | # Define COLLISION_CHECK below if you believe that SHA1's |
Petr Baudis | 5c2a7fb | 2005-04-13 02:14:06 -0700 | [diff] [blame] | 64 | # 1461501637330902918203684832716283019655932542976 hashes do not give you |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 65 | # sufficient guarantee that no collisions between objects will ever happen. |
| 66 | |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 67 | # Define USE_NSEC below if you want git to care about sub-second file mtimes |
| 68 | # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and |
| 69 | # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely |
| 70 | # randomly break unless your underlying filesystem supports those sub-second |
| 71 | # times (my ext3 doesn't). |
| 72 | |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 73 | # Define USE_STDEV below if you want git to care about the underlying device |
| 74 | # change being considered an inode change from the update-cache perspective. |
| 75 | |
Junio C Hamano | 9b88fce | 2005-12-27 14:40:17 -0800 | [diff] [blame] | 76 | GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE |
Fredrik Kuivinen | 3654638 | 2006-02-14 00:15:14 +0100 | [diff] [blame] | 77 | @$(SHELL_PATH) ./GIT-VERSION-GEN |
Junio C Hamano | 9b88fce | 2005-12-27 14:40:17 -0800 | [diff] [blame] | 78 | -include GIT-VERSION-FILE |
Petr Baudis | 5bdac8b | 2005-07-29 17:48:26 +0200 | [diff] [blame] | 79 | |
Paul Jakma | e15f545 | 2006-02-20 23:36:28 +0000 | [diff] [blame] | 80 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
| 81 | uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') |
| 82 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') |
| 83 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') |
| 84 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') |
| 85 | |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 86 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 87 | |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 88 | CFLAGS = -g -O2 -Wall |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 89 | LDFLAGS = |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 90 | ALL_CFLAGS = $(CFLAGS) |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 91 | ALL_LDFLAGS = $(LDFLAGS) |
Junio C Hamano | 4dc0002 | 2006-01-12 21:42:25 -0800 | [diff] [blame] | 92 | STRIP ?= strip |
Thomas Glanzmann | 29c2cce | 2005-05-07 10:41:54 +0200 | [diff] [blame] | 93 | |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 94 | prefix = $(HOME) |
| 95 | bindir = $(prefix)/bin |
Paul Jakma | e15f545 | 2006-02-20 23:36:28 +0000 | [diff] [blame] | 96 | gitexecdir = $(bindir) |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 97 | template_dir = $(prefix)/share/git-core/templates/ |
Junio C Hamano | 720d150 | 2005-09-10 17:46:27 -0700 | [diff] [blame] | 98 | GIT_PYTHON_DIR = $(prefix)/share/git-core/python |
Petr Baudis | a682ef9 | 2005-08-05 01:56:38 +0200 | [diff] [blame] | 99 | # DESTDIR= |
Petr Baudis | 5c2a7fb | 2005-04-13 02:14:06 -0700 | [diff] [blame] | 100 | |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 101 | CC = gcc |
| 102 | AR = ar |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 103 | TAR = tar |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 104 | INSTALL = install |
| 105 | RPMBUILD = rpmbuild |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 106 | |
Linus Torvalds | 44c9e85 | 2005-07-03 10:02:35 -0700 | [diff] [blame] | 107 | # sparse is architecture-neutral, which means that we need to tell it |
| 108 | # explicitly what architecture to check for. Fix this up for yours.. |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 109 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
Linus Torvalds | 44c9e85 | 2005-07-03 10:02:35 -0700 | [diff] [blame] | 110 | |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 111 | |
| 112 | |
| 113 | ### --- END CONFIGURATION SECTION --- |
| 114 | |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 115 | SCRIPT_SH = \ |
| 116 | git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \ |
| 117 | git-cherry.sh git-clone.sh git-commit.sh \ |
| 118 | git-count-objects.sh git-diff.sh git-fetch.sh \ |
| 119 | git-format-patch.sh git-log.sh git-ls-remote.sh \ |
Junio C Hamano | e32faa8 | 2005-12-19 18:03:31 -0800 | [diff] [blame] | 120 | git-merge-one-file.sh git-parse-remote.sh \ |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 121 | git-prune.sh git-pull.sh git-push.sh git-rebase.sh \ |
| 122 | git-repack.sh git-request-pull.sh git-reset.sh \ |
Carl Worth | d4a1cab | 2006-02-21 15:04:51 -0800 | [diff] [blame] | 123 | git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \ |
Junio C Hamano | 27dedf0 | 2005-11-16 21:32:44 -0800 | [diff] [blame] | 124 | git-tag.sh git-verify-tag.sh git-whatchanged.sh \ |
Junio C Hamano | d1c5f2a | 2005-10-07 03:44:18 -0700 | [diff] [blame] | 125 | git-applymbox.sh git-applypatch.sh git-am.sh \ |
Junio C Hamano | 2276aa6 | 2005-09-10 17:56:19 -0700 | [diff] [blame] | 126 | git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ |
Junio C Hamano | 04e7ca1 | 2005-11-07 15:15:34 -0800 | [diff] [blame] | 127 | git-merge-resolve.sh git-merge-ours.sh git-grep.sh \ |
Junio C Hamano | 0086e2c | 2005-11-13 02:07:02 -0800 | [diff] [blame] | 128 | git-lost-found.sh |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 129 | |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 130 | SCRIPT_PERL = \ |
| 131 | git-archimport.perl git-cvsimport.perl git-relink.perl \ |
Junio C Hamano | 8389b52 | 2006-01-28 23:15:24 -0800 | [diff] [blame] | 132 | git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \ |
Junio C Hamano | 98214e9 | 2006-02-22 19:20:55 -0800 | [diff] [blame] | 133 | git-annotate.perl git-cvsserver.perl \ |
Martin Langhoff | 5e0306a | 2005-11-07 17:57:08 +1300 | [diff] [blame] | 134 | git-svnimport.perl git-mv.perl git-cvsexportcommit.perl |
Junio C Hamano | 60036a4 | 2005-07-30 17:31:47 -0700 | [diff] [blame] | 135 | |
Junio C Hamano | 720d150 | 2005-09-10 17:46:27 -0700 | [diff] [blame] | 136 | SCRIPT_PYTHON = \ |
Fredrik Kuivinen | e4cf17c | 2005-09-13 08:22:26 +0200 | [diff] [blame] | 137 | git-merge-recursive.py |
Junio C Hamano | 720d150 | 2005-09-10 17:46:27 -0700 | [diff] [blame] | 138 | |
Andreas Ericsson | d6ebd25 | 2005-11-22 00:44:15 +0100 | [diff] [blame] | 139 | SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ |
| 140 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ |
| 141 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ |
Junio C Hamano | cf7bb58 | 2006-02-10 00:45:59 -0800 | [diff] [blame] | 142 | git-cherry-pick git-show git-status |
Andreas Ericsson | d6ebd25 | 2005-11-22 00:44:15 +0100 | [diff] [blame] | 143 | |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 144 | # The ones that do not have to link with lcrypto nor lz. |
| 145 | SIMPLE_PROGRAMS = \ |
Johannes Schindelin | 2a3763e | 2006-02-19 21:16:08 +0100 | [diff] [blame] | 146 | git-get-tar-commit-id$X git-mailsplit$X \ |
Junio C Hamano | 27dedf0 | 2005-11-16 21:32:44 -0800 | [diff] [blame] | 147 | git-stripspace$X git-daemon$X |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 148 | |
Junio C Hamano | b42934d | 2006-01-12 21:37:17 -0800 | [diff] [blame] | 149 | # ... and all the rest that could be moved out of bindir to gitexecdir |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 150 | PROGRAMS = \ |
Peter Anvin | 79a9d8e | 2005-10-03 12:04:44 -0700 | [diff] [blame] | 151 | git-apply$X git-cat-file$X \ |
| 152 | git-checkout-index$X git-clone-pack$X git-commit-tree$X \ |
| 153 | git-convert-objects$X git-diff-files$X \ |
| 154 | git-diff-index$X git-diff-stages$X \ |
| 155 | git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \ |
Junio C Hamano | 43f72af | 2006-02-24 16:16:10 -0800 | [diff] [blame] | 156 | git-hash-object$X git-index-pack$X git-init-db$X git-local-fetch$X \ |
| 157 | git-ls-files$X git-ls-tree$X git-mailinfo$X git-merge-base$X \ |
Junio C Hamano | 83f5053 | 2006-02-20 21:50:01 -0800 | [diff] [blame] | 158 | git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \ |
Peter Anvin | 79a9d8e | 2005-10-03 12:04:44 -0700 | [diff] [blame] | 159 | git-peek-remote$X git-prune-packed$X git-read-tree$X \ |
| 160 | git-receive-pack$X git-rev-list$X git-rev-parse$X \ |
Linus Torvalds | 35eb2d3 | 2005-10-23 14:30:45 -0700 | [diff] [blame] | 161 | git-send-pack$X git-show-branch$X git-shell$X \ |
Peter Anvin | 79a9d8e | 2005-10-03 12:04:44 -0700 | [diff] [blame] | 162 | git-show-index$X git-ssh-fetch$X \ |
| 163 | git-ssh-upload$X git-tar-tree$X git-unpack-file$X \ |
| 164 | git-unpack-objects$X git-update-index$X git-update-server-info$X \ |
| 165 | git-upload-pack$X git-verify-pack$X git-write-tree$X \ |
Junio C Hamano | 03feddd | 2005-10-13 18:57:39 -0700 | [diff] [blame] | 166 | git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \ |
Linus Torvalds | 908e531 | 2005-12-24 13:50:45 -0800 | [diff] [blame] | 167 | git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \ |
Mike McCormack | f2561fd | 2006-03-10 14:32:50 +0900 | [diff] [blame^] | 168 | git-describe$X git-merge-tree$X git-blame$X git-imap-send$X |
Andreas Ericsson | d6ebd25 | 2005-11-22 00:44:15 +0100 | [diff] [blame] | 169 | |
Junio C Hamano | b42934d | 2006-01-12 21:37:17 -0800 | [diff] [blame] | 170 | # what 'all' will build and 'install' will install, in gitexecdir |
Michal Ostrowski | 77cb17e | 2006-01-10 21:12:17 -0500 | [diff] [blame] | 171 | ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 172 | |
Junio C Hamano | 894a8a8 | 2005-09-30 00:27:11 -0700 | [diff] [blame] | 173 | # Backward compatibility -- to be removed after 1.0 |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 174 | PROGRAMS += git-ssh-pull$X git-ssh-push$X |
Junio C Hamano | f71a69a | 2005-09-15 14:56:37 -0700 | [diff] [blame] | 175 | |
Ryan Anderson | 3d32051 | 2005-11-21 00:11:22 -0500 | [diff] [blame] | 176 | # Set paths to tools early so that they can be used for version tests. |
| 177 | ifndef SHELL_PATH |
| 178 | SHELL_PATH = /bin/sh |
| 179 | endif |
| 180 | ifndef PERL_PATH |
| 181 | PERL_PATH = /usr/bin/perl |
| 182 | endif |
| 183 | ifndef PYTHON_PATH |
| 184 | PYTHON_PATH = /usr/bin/python |
| 185 | endif |
| 186 | |
Junio C Hamano | 720d150 | 2005-09-10 17:46:27 -0700 | [diff] [blame] | 187 | PYMODULES = \ |
| 188 | gitMergeCommon.py |
| 189 | |
Linus Torvalds | 0a02ce7 | 2005-04-18 12:49:39 -0700 | [diff] [blame] | 190 | LIB_FILE=libgit.a |
| 191 | |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 192 | LIB_H = \ |
| 193 | blob.h cache.h commit.h count-delta.h csum-file.h delta.h \ |
Linus Torvalds | 765ac8e | 2006-02-28 15:07:20 -0800 | [diff] [blame] | 194 | diff.h object.h pack.h pkt-line.h quote.h refs.h \ |
Linus Torvalds | ae56354 | 2006-02-25 16:19:46 -0800 | [diff] [blame] | 195 | run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h |
Junio C Hamano | 8f3f9b0 | 2005-07-23 17:54:41 -0700 | [diff] [blame] | 196 | |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 197 | DIFF_OBJS = \ |
| 198 | diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \ |
Junio C Hamano | 6541675 | 2006-02-28 16:01:36 -0800 | [diff] [blame] | 199 | diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \ |
| 200 | diffcore-delta.o |
Josef Weidendorfer | b1bf95b | 2005-07-31 21:17:43 +0200 | [diff] [blame] | 201 | |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 202 | LIB_OBJS = \ |
| 203 | blob.o commit.o connect.o count-delta.o csum-file.o \ |
Michal Ostrowski | 77cb17e | 2006-01-10 21:12:17 -0500 | [diff] [blame] | 204 | date.o diff-delta.o entry.o exec_cmd.o ident.o index.o \ |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 205 | object.o pack-check.o patch-delta.o path.o pkt-line.o \ |
Junio C Hamano | 0f56479 | 2005-09-14 13:08:55 -0700 | [diff] [blame] | 206 | quote.o read-cache.o refs.o run-command.o \ |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 207 | server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \ |
Junio C Hamano | f3123c4 | 2005-10-22 01:28:13 -0700 | [diff] [blame] | 208 | tag.o tree.o usage.o config.o environment.o ctype.o copy.o \ |
Linus Torvalds | f67b45f | 2006-02-28 11:26:21 -0800 | [diff] [blame] | 209 | fetch-clone.o revision.o pager.o \ |
Linus Torvalds | 4546738 | 2005-10-13 11:03:18 -0700 | [diff] [blame] | 210 | $(DIFF_OBJS) |
Junio C Hamano | d19938a | 2005-05-09 17:57:56 -0700 | [diff] [blame] | 211 | |
Linus Torvalds | cc1ad5c | 2005-04-21 12:14:46 -0700 | [diff] [blame] | 212 | LIBS = $(LIB_FILE) |
| 213 | LIBS += -lz |
Linus Torvalds | cef661f | 2005-04-21 12:33:22 -0700 | [diff] [blame] | 214 | |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 215 | # |
| 216 | # Platform specific tweaks |
| 217 | # |
Junio C Hamano | f7c1534 | 2005-10-09 12:52:35 -0700 | [diff] [blame] | 218 | |
| 219 | # We choose to avoid "if .. else if .. else .. endif endif" |
| 220 | # because maintaining the nesting to match is a pain. If |
| 221 | # we had "elif" things would have been much nicer... |
Junio C Hamano | f7c1534 | 2005-10-09 12:52:35 -0700 | [diff] [blame] | 222 | |
| 223 | ifeq ($(uname_S),Darwin) |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 224 | NEEDS_SSL_WITH_CRYPTO = YesPlease |
| 225 | NEEDS_LIBICONV = YesPlease |
Randal L. Schwartz | 0cfddac | 2005-11-06 04:33:07 -0800 | [diff] [blame] | 226 | ## fink |
Shawn Pearce | e3601e8 | 2006-02-28 09:03:48 -0500 | [diff] [blame] | 227 | ifeq ($(shell test -d /sw/lib && echo y),y) |
| 228 | ALL_CFLAGS += -I/sw/include |
| 229 | ALL_LDFLAGS += -L/sw/lib |
| 230 | endif |
Randal L. Schwartz | 0cfddac | 2005-11-06 04:33:07 -0800 | [diff] [blame] | 231 | ## darwinports |
Shawn Pearce | e3601e8 | 2006-02-28 09:03:48 -0500 | [diff] [blame] | 232 | ifeq ($(shell test -d /opt/local/lib && echo y),y) |
| 233 | ALL_CFLAGS += -I/opt/local/include |
| 234 | ALL_LDFLAGS += -L/opt/local/lib |
| 235 | endif |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 236 | endif |
Junio C Hamano | f7c1534 | 2005-10-09 12:52:35 -0700 | [diff] [blame] | 237 | ifeq ($(uname_S),SunOS) |
Patrick Mauritz | f0ebff0 | 2005-09-06 01:24:03 +0200 | [diff] [blame] | 238 | NEEDS_SOCKET = YesPlease |
Junio C Hamano | 5a90d4a | 2005-09-11 22:25:49 -0700 | [diff] [blame] | 239 | NEEDS_NSL = YesPlease |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 240 | SHELL_PATH = /bin/bash |
| 241 | NO_STRCASESTR = YesPlease |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 242 | ifeq ($(uname_R),5.8) |
Paul Jakma | e15f545 | 2006-02-20 23:36:28 +0000 | [diff] [blame] | 243 | NEEDS_LIBICONV = YesPlease |
Jason Riedy | 731043f | 2006-01-25 12:38:36 -0800 | [diff] [blame] | 244 | NO_UNSETENV = YesPlease |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 245 | NO_SETENV = YesPlease |
| 246 | endif |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 247 | INSTALL = ginstall |
| 248 | TAR = gtar |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 249 | ALL_CFLAGS += -D__EXTENSIONS__ |
Patrick Mauritz | f0ebff0 | 2005-09-06 01:24:03 +0200 | [diff] [blame] | 250 | endif |
Junio C Hamano | f7c1534 | 2005-10-09 12:52:35 -0700 | [diff] [blame] | 251 | ifeq ($(uname_O),Cygwin) |
Junio C Hamano | 63be37b | 2006-01-19 17:13:57 -0800 | [diff] [blame] | 252 | NO_D_TYPE_IN_DIRENT = YesPlease |
Junio C Hamano | 35a730f | 2006-01-19 17:13:51 -0800 | [diff] [blame] | 253 | NO_D_INO_IN_DIRENT = YesPlease |
hpa | 1775451 | 2005-09-28 16:37:37 -0700 | [diff] [blame] | 254 | NO_STRCASESTR = YesPlease |
| 255 | NEEDS_LIBICONV = YesPlease |
Junio C Hamano | 2e67a5f | 2005-11-17 11:29:47 -0800 | [diff] [blame] | 256 | # There are conflicting reports about this. |
| 257 | # On some boxes NO_MMAP is needed, and not so elsewhere. |
| 258 | # Try uncommenting this if you see things break -- YMMV. |
| 259 | # NO_MMAP = YesPlease |
hpa | 49744d6 | 2005-09-28 16:52:21 -0700 | [diff] [blame] | 260 | NO_IPV6 = YesPlease |
Peter Anvin | a23cd8e | 2005-09-28 19:08:37 -0700 | [diff] [blame] | 261 | X = .exe |
Nicolas Pitre | 7c6ef2f | 2005-09-20 12:27:13 -0400 | [diff] [blame] | 262 | endif |
Alecs King | b3bf974 | 2006-01-27 02:04:30 +0800 | [diff] [blame] | 263 | ifeq ($(uname_S),FreeBSD) |
| 264 | NEEDS_LIBICONV = YesPlease |
| 265 | ALL_CFLAGS += -I/usr/local/include |
| 266 | ALL_LDFLAGS += -L/usr/local/lib |
| 267 | endif |
Junio C Hamano | f7c1534 | 2005-10-09 12:52:35 -0700 | [diff] [blame] | 268 | ifeq ($(uname_S),OpenBSD) |
Junio C Hamano | 5fb41e8 | 2005-10-10 11:51:11 -0700 | [diff] [blame] | 269 | NO_STRCASESTR = YesPlease |
Han Boetes | 18c5a52 | 2005-10-01 08:23:26 +0200 | [diff] [blame] | 270 | NEEDS_LIBICONV = YesPlease |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 271 | ALL_CFLAGS += -I/usr/local/include |
| 272 | ALL_LDFLAGS += -L/usr/local/lib |
| 273 | endif |
| 274 | ifeq ($(uname_S),NetBSD) |
| 275 | NEEDS_LIBICONV = YesPlease |
| 276 | ALL_CFLAGS += -I/usr/pkg/include |
| 277 | ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib |
Han Boetes | 18c5a52 | 2005-10-01 08:23:26 +0200 | [diff] [blame] | 278 | endif |
Jason Riedy | a6da939 | 2005-12-06 14:20:16 -0800 | [diff] [blame] | 279 | ifeq ($(uname_S),AIX) |
| 280 | NO_STRCASESTR=YesPlease |
| 281 | NEEDS_LIBICONV=YesPlease |
| 282 | endif |
Johannes Schindelin | 289c4b3 | 2006-02-17 15:23:41 +0100 | [diff] [blame] | 283 | ifeq ($(uname_S),IRIX64) |
| 284 | NO_IPV6=YesPlease |
| 285 | NO_SETENV=YesPlease |
| 286 | NO_STRCASESTR=YesPlease |
| 287 | NO_SOCKADDR_STORAGE=YesPlease |
| 288 | SHELL_PATH=/usr/gnu/bin/bash |
| 289 | ALL_CFLAGS += -DPATH_MAX=1024 |
| 290 | # for now, build 32-bit version |
| 291 | ALL_LDFLAGS += -L/usr/lib32 |
| 292 | endif |
Junio C Hamano | f7c1534 | 2005-10-09 12:52:35 -0700 | [diff] [blame] | 293 | ifneq (,$(findstring arm,$(uname_M))) |
| 294 | ARM_SHA1 = YesPlease |
| 295 | endif |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 296 | |
Johannes Schindelin | f2d6a25 | 2005-10-11 15:22:47 -0700 | [diff] [blame] | 297 | -include config.mak |
Linus Torvalds | cef661f | 2005-04-21 12:33:22 -0700 | [diff] [blame] | 298 | |
Timo Hirvonen | b34403a | 2005-12-01 03:32:01 +0200 | [diff] [blame] | 299 | ifdef WITH_OWN_SUBPROCESS_PY |
| 300 | PYMODULES += compat/subprocess.py |
| 301 | else |
Johannes Schindelin | a348ab7 | 2006-02-19 21:13:48 +0100 | [diff] [blame] | 302 | ifeq ($(NO_PYTHON),) |
| 303 | ifneq ($(shell $(PYTHON_PATH) -c 'import subprocess;print"OK"' 2>/dev/null),OK) |
| 304 | PYMODULES += compat/subprocess.py |
| 305 | endif |
Timo Hirvonen | b34403a | 2005-12-01 03:32:01 +0200 | [diff] [blame] | 306 | endif |
| 307 | endif |
| 308 | |
| 309 | ifdef WITH_SEND_EMAIL |
| 310 | SCRIPT_PERL += git-send-email.perl |
| 311 | endif |
| 312 | |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 313 | ifndef NO_CURL |
| 314 | ifdef CURLDIR |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 315 | # This is still problematic -- gcc does not always want -R. |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 316 | ALL_CFLAGS += -I$(CURLDIR)/include |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 317 | CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl |
| 318 | else |
| 319 | CURL_LIBCURL = -lcurl |
| 320 | endif |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 321 | PROGRAMS += git-http-fetch$X |
Nick Hengeveld | 0890098 | 2005-11-18 17:08:36 -0800 | [diff] [blame] | 322 | curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p) |
| 323 | ifeq "$(curl_check)" "070908" |
| 324 | ifndef NO_EXPAT |
| 325 | EXPAT_LIBEXPAT = -lexpat |
| 326 | PROGRAMS += git-http-push$X |
| 327 | endif |
Nick Hengeveld | 58e60dd | 2005-11-02 11:19:24 -0800 | [diff] [blame] | 328 | endif |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 329 | endif |
| 330 | |
Petr Baudis | dd53c7a | 2005-07-29 17:50:51 +0200 | [diff] [blame] | 331 | ifndef NO_OPENSSL |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 332 | OPENSSL_LIBSSL = -lssl |
Junio C Hamano | 455a7f3 | 2005-09-30 13:31:16 -0700 | [diff] [blame] | 333 | ifdef OPENSSLDIR |
| 334 | # Again this may be problematic -- gcc does not always want -R. |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 335 | ALL_CFLAGS += -I$(OPENSSLDIR)/include |
Junio C Hamano | 455a7f3 | 2005-09-30 13:31:16 -0700 | [diff] [blame] | 336 | OPENSSL_LINK = -L$(OPENSSLDIR)/lib -R$(OPENSSLDIR)/lib |
| 337 | else |
| 338 | OPENSSL_LINK = |
| 339 | endif |
Petr Baudis | dd53c7a | 2005-07-29 17:50:51 +0200 | [diff] [blame] | 340 | else |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 341 | ALL_CFLAGS += -DNO_OPENSSL |
Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 342 | MOZILLA_SHA1 = 1 |
| 343 | OPENSSL_LIBSSL = |
Petr Baudis | dd53c7a | 2005-07-29 17:50:51 +0200 | [diff] [blame] | 344 | endif |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 345 | ifdef NEEDS_SSL_WITH_CRYPTO |
Junio C Hamano | 455a7f3 | 2005-09-30 13:31:16 -0700 | [diff] [blame] | 346 | LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 347 | else |
Junio C Hamano | 455a7f3 | 2005-09-30 13:31:16 -0700 | [diff] [blame] | 348 | LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 349 | endif |
| 350 | ifdef NEEDS_LIBICONV |
Junio C Hamano | 455a7f3 | 2005-09-30 13:31:16 -0700 | [diff] [blame] | 351 | ifdef ICONVDIR |
| 352 | # Again this may be problematic -- gcc does not always want -R. |
Junio C Hamano | 12aa745 | 2005-11-04 23:50:09 -0800 | [diff] [blame] | 353 | ALL_CFLAGS += -I$(ICONVDIR)/include |
Junio C Hamano | 455a7f3 | 2005-09-30 13:31:16 -0700 | [diff] [blame] | 354 | ICONV_LINK = -L$(ICONVDIR)/lib -R$(ICONVDIR)/lib |
| 355 | else |
| 356 | ICONV_LINK = |
| 357 | endif |
| 358 | LIB_4_ICONV = $(ICONV_LINK) -liconv |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 359 | else |
| 360 | LIB_4_ICONV = |
| 361 | endif |
Patrick Mauritz | f0ebff0 | 2005-09-06 01:24:03 +0200 | [diff] [blame] | 362 | ifdef NEEDS_SOCKET |
| 363 | LIBS += -lsocket |
| 364 | SIMPLE_LIB += -lsocket |
| 365 | endif |
Junio C Hamano | 5a90d4a | 2005-09-11 22:25:49 -0700 | [diff] [blame] | 366 | ifdef NEEDS_NSL |
| 367 | LIBS += -lnsl |
| 368 | SIMPLE_LIB += -lnsl |
| 369 | endif |
Junio C Hamano | 63be37b | 2006-01-19 17:13:57 -0800 | [diff] [blame] | 370 | ifdef NO_D_TYPE_IN_DIRENT |
| 371 | ALL_CFLAGS += -DNO_D_TYPE_IN_DIRENT |
| 372 | endif |
Junio C Hamano | 35a730f | 2006-01-19 17:13:51 -0800 | [diff] [blame] | 373 | ifdef NO_D_INO_IN_DIRENT |
| 374 | ALL_CFLAGS += -DNO_D_INO_IN_DIRENT |
| 375 | endif |
Linus Torvalds | ef34af2 | 2005-09-18 18:30:50 -0700 | [diff] [blame] | 376 | ifdef NO_STRCASESTR |
Junio C Hamano | 4050c0d | 2005-12-05 11:54:29 -0800 | [diff] [blame] | 377 | COMPAT_CFLAGS += -DNO_STRCASESTR |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 378 | COMPAT_OBJS += compat/strcasestr.o |
| 379 | endif |
| 380 | ifdef NO_SETENV |
Junio C Hamano | 4050c0d | 2005-12-05 11:54:29 -0800 | [diff] [blame] | 381 | COMPAT_CFLAGS += -DNO_SETENV |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 382 | COMPAT_OBJS += compat/setenv.o |
Linus Torvalds | ef34af2 | 2005-09-18 18:30:50 -0700 | [diff] [blame] | 383 | endif |
Jason Riedy | 731043f | 2006-01-25 12:38:36 -0800 | [diff] [blame] | 384 | ifdef NO_SETENV |
| 385 | COMPAT_CFLAGS += -DNO_UNSETENV |
| 386 | COMPAT_OBJS += compat/unsetenv.o |
| 387 | endif |
Johannes Schindelin | 730d48a | 2005-10-08 15:54:36 -0700 | [diff] [blame] | 388 | ifdef NO_MMAP |
Junio C Hamano | 4050c0d | 2005-12-05 11:54:29 -0800 | [diff] [blame] | 389 | COMPAT_CFLAGS += -DNO_MMAP |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 390 | COMPAT_OBJS += compat/mmap.o |
Johannes Schindelin | 730d48a | 2005-10-08 15:54:36 -0700 | [diff] [blame] | 391 | endif |
hpa | 49744d6 | 2005-09-28 16:52:21 -0700 | [diff] [blame] | 392 | ifdef NO_IPV6 |
Junio C Hamano | bdc37f5 | 2006-01-19 17:13:32 -0800 | [diff] [blame] | 393 | ALL_CFLAGS += -DNO_IPV6 |
| 394 | endif |
| 395 | ifdef NO_SOCKADDR_STORAGE |
| 396 | ifdef NO_IPV6 |
| 397 | ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in |
| 398 | else |
| 399 | ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in6 |
| 400 | endif |
hpa | 49744d6 | 2005-09-28 16:52:21 -0700 | [diff] [blame] | 401 | endif |
Linus Torvalds | cef661f | 2005-04-21 12:33:22 -0700 | [diff] [blame] | 402 | |
Fernando J. Pereda | b6e56ec | 2006-02-16 09:38:01 +0100 | [diff] [blame] | 403 | ifdef NO_ICONV |
| 404 | ALL_CFLAGS += -DNO_ICONV |
| 405 | endif |
| 406 | |
Nicolas Pitre | 7c6ef2f | 2005-09-20 12:27:13 -0400 | [diff] [blame] | 407 | ifdef PPC_SHA1 |
| 408 | SHA1_HEADER = "ppc/sha1.h" |
| 409 | LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o |
| 410 | else |
| 411 | ifdef ARM_SHA1 |
| 412 | SHA1_HEADER = "arm/sha1.h" |
| 413 | LIB_OBJS += arm/sha1.o arm/sha1_arm.o |
| 414 | else |
| 415 | ifdef MOZILLA_SHA1 |
| 416 | SHA1_HEADER = "mozilla-sha1/sha1.h" |
| 417 | LIB_OBJS += mozilla-sha1/sha1.o |
| 418 | else |
| 419 | SHA1_HEADER = <openssl/sha.h> |
| 420 | LIBS += $(LIB_4_CRYPTO) |
| 421 | endif |
| 422 | endif |
| 423 | endif |
Johannes Schindelin | 5b5d4d9 | 2006-02-17 15:23:16 +0100 | [diff] [blame] | 424 | ifdef NO_ACCURATE_DIFF |
| 425 | ALL_CFLAGS += -DNO_ACCURATE_DIFF |
| 426 | endif |
Nicolas Pitre | 7c6ef2f | 2005-09-20 12:27:13 -0400 | [diff] [blame] | 427 | |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 428 | # Shell quote (do not use $(call) to accomodate ancient setups); |
| 429 | |
| 430 | SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) |
| 431 | |
| 432 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
| 433 | bindir_SQ = $(subst ','\'',$(bindir)) |
| 434 | gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) |
| 435 | template_dir_SQ = $(subst ','\'',$(template_dir)) |
| 436 | |
| 437 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) |
| 438 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) |
| 439 | PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) |
| 440 | GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR)) |
| 441 | |
| 442 | ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS) |
Jason Riedy | e40b61f | 2005-12-02 15:08:28 -0800 | [diff] [blame] | 443 | LIB_OBJS += $(COMPAT_OBJS) |
Tom Prince | ec2d151 | 2005-10-11 18:47:33 -0700 | [diff] [blame] | 444 | export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 445 | ### Build rules |
Linus Torvalds | 8996702 | 2005-04-30 13:19:56 -0700 | [diff] [blame] | 446 | |
Junio C Hamano | b42934d | 2006-01-12 21:37:17 -0800 | [diff] [blame] | 447 | all: $(ALL_PROGRAMS) git$X gitk |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 448 | |
Junio C Hamano | d3af621 | 2005-08-06 12:50:14 -0700 | [diff] [blame] | 449 | all: |
| 450 | $(MAKE) -C templates |
Nicolas Pitre | a310d43 | 2005-05-19 10:27:14 -0400 | [diff] [blame] | 451 | |
Junio C Hamano | 4dc0002 | 2006-01-12 21:42:25 -0800 | [diff] [blame] | 452 | strip: $(PROGRAMS) git$X |
| 453 | $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X |
| 454 | |
Fredrik Kuivinen | a87cd02 | 2006-03-09 17:24:19 +0100 | [diff] [blame] | 455 | git$X: git.c common-cmds.h $(LIB_FILE) |
Michal Ostrowski | 77cb17e | 2006-01-10 21:12:17 -0500 | [diff] [blame] | 456 | $(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \ |
Linus Torvalds | 70b006b | 2006-02-28 11:30:19 -0800 | [diff] [blame] | 457 | $(ALL_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE) $(LIBS) |
Junio C Hamano | 6a2e50f | 2005-09-07 21:26:52 -0700 | [diff] [blame] | 458 | |
Fredrik Kuivinen | a87cd02 | 2006-03-09 17:24:19 +0100 | [diff] [blame] | 459 | common-cmds.h: Documentation/git-*.txt |
| 460 | ./generate-cmdlist.sh > $@ |
| 461 | |
Andreas Ericsson | d6ebd25 | 2005-11-22 00:44:15 +0100 | [diff] [blame] | 462 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
Junio C Hamano | bc6146d | 2005-09-08 18:50:33 -0700 | [diff] [blame] | 463 | rm -f $@ |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 464 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ |
Junio C Hamano | 3ff8cbe | 2005-10-04 12:41:35 -0700 | [diff] [blame] | 465 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ |
Fernando J. Pereda | 6c5c62f | 2006-02-15 12:37:30 +0100 | [diff] [blame] | 466 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ |
Johannes Schindelin | abb7c7b | 2006-02-18 13:01:18 +0100 | [diff] [blame] | 467 | -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \ |
Junio C Hamano | 3ff8cbe | 2005-10-04 12:41:35 -0700 | [diff] [blame] | 468 | $@.sh >$@ |
Junio C Hamano | bc6146d | 2005-09-08 18:50:33 -0700 | [diff] [blame] | 469 | chmod +x $@ |
| 470 | |
| 471 | $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl |
| 472 | rm -f $@ |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 473 | sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ |
Junio C Hamano | 3ff8cbe | 2005-10-04 12:41:35 -0700 | [diff] [blame] | 474 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ |
| 475 | $@.perl >$@ |
Junio C Hamano | bc6146d | 2005-09-08 18:50:33 -0700 | [diff] [blame] | 476 | chmod +x $@ |
| 477 | |
Junio C Hamano | 720d150 | 2005-09-10 17:46:27 -0700 | [diff] [blame] | 478 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py |
| 479 | rm -f $@ |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 480 | sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ |
| 481 | -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR_SQ)|g' \ |
Junio C Hamano | 3ff8cbe | 2005-10-04 12:41:35 -0700 | [diff] [blame] | 482 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ |
| 483 | $@.py >$@ |
Junio C Hamano | 720d150 | 2005-09-10 17:46:27 -0700 | [diff] [blame] | 484 | chmod +x $@ |
| 485 | |
Johannes Schindelin | 4eba0f3 | 2005-10-20 17:13:24 +0200 | [diff] [blame] | 486 | git-cherry-pick: git-revert |
| 487 | cp $< $@ |
| 488 | |
Junio C Hamano | 80d48ac | 2006-02-05 16:42:49 -0800 | [diff] [blame] | 489 | git-show: git-whatchanged |
| 490 | cp $< $@ |
| 491 | |
Junio C Hamano | cf7bb58 | 2006-02-10 00:45:59 -0800 | [diff] [blame] | 492 | git-status: git-commit |
| 493 | cp $< $@ |
| 494 | |
Junio C Hamano | 9b88fce | 2005-12-27 14:40:17 -0800 | [diff] [blame] | 495 | # These can record GIT_VERSION |
| 496 | git$X git.spec \ |
| 497 | $(patsubst %.sh,%,$(SCRIPT_SH)) \ |
| 498 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ |
| 499 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ |
| 500 | : GIT-VERSION-FILE |
Johannes Schindelin | e99fcf9 | 2005-12-22 20:38:23 +0100 | [diff] [blame] | 501 | |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 502 | %.o: %.c |
| 503 | $(CC) -o $*.o -c $(ALL_CFLAGS) $< |
| 504 | %.o: %.S |
| 505 | $(CC) -o $*.o -c $(ALL_CFLAGS) $< |
| 506 | |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 507 | exec_cmd.o: exec_cmd.c |
| 508 | $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $< |
Michal Ostrowski | 77cb17e | 2006-01-10 21:12:17 -0500 | [diff] [blame] | 509 | |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 510 | git-%$X: %.o $(LIB_FILE) |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 511 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) |
Daniel Barkalow | 6eb7ed5 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 512 | |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 513 | $(SIMPLE_PROGRAMS) : $(LIB_FILE) |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 514 | $(SIMPLE_PROGRAMS) : git-%$X : %.o |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 515 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
| 516 | $(LIB_FILE) $(SIMPLE_LIB) |
Junio C Hamano | 597c9cc | 2005-09-07 12:22:56 -0700 | [diff] [blame] | 517 | |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 518 | git-mailinfo$X: mailinfo.o $(LIB_FILE) |
| 519 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
| 520 | $(LIB_FILE) $(SIMPLE_LIB) $(LIB_4_ICONV) |
| 521 | |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 522 | git-local-fetch$X: fetch.o |
| 523 | git-ssh-fetch$X: rsh.o fetch.o |
| 524 | git-ssh-upload$X: rsh.o |
| 525 | git-ssh-pull$X: rsh.o fetch.o |
| 526 | git-ssh-push$X: rsh.o |
Daniel Barkalow | 6eb7ed5 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 527 | |
Mike McCormack | f2561fd | 2006-03-10 14:32:50 +0900 | [diff] [blame^] | 528 | git-imap-send$X: imap-send.o $(LIB_FILE) |
| 529 | |
Johannes Schindelin | b992933 | 2006-02-21 13:08:21 +0100 | [diff] [blame] | 530 | git-http-fetch$X: fetch.o http.o http-fetch.o $(LIB_FILE) |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 531 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
| 532 | $(LIBS) $(CURL_LIBCURL) |
| 533 | |
Nick Hengeveld | aa1dbc9 | 2006-03-07 16:13:20 -0800 | [diff] [blame] | 534 | git-http-push$X: revision.o http.o http-push.o $(LIB_FILE) |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 535 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
| 536 | $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) |
| 537 | |
Johannes Schindelin | b992933 | 2006-02-21 13:08:21 +0100 | [diff] [blame] | 538 | git-rev-list$X: rev-list.o $(LIB_FILE) |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 539 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
| 540 | $(LIBS) $(OPENSSL_LIBSSL) |
Daniel Barkalow | 6eb7ed5 | 2005-04-23 18:47:23 -0700 | [diff] [blame] | 541 | |
Junio C Hamano | d3af621 | 2005-08-06 12:50:14 -0700 | [diff] [blame] | 542 | init-db.o: init-db.c |
Pavel Roskin | b05701c | 2005-08-06 01:36:15 -0400 | [diff] [blame] | 543 | $(CC) -c $(ALL_CFLAGS) \ |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 544 | -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $*.c |
Junio C Hamano | d3af621 | 2005-08-06 12:50:14 -0700 | [diff] [blame] | 545 | |
Petr Baudis | e468305 | 2005-07-29 17:48:50 +0200 | [diff] [blame] | 546 | $(LIB_OBJS): $(LIB_H) |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 547 | $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) |
Petr Baudis | e468305 | 2005-07-29 17:48:50 +0200 | [diff] [blame] | 548 | $(DIFF_OBJS): diffcore.h |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 549 | |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 550 | $(LIB_FILE): $(LIB_OBJS) |
| 551 | $(AR) rcs $@ $(LIB_OBJS) |
| 552 | |
| 553 | doc: |
| 554 | $(MAKE) -C Documentation all |
| 555 | |
| 556 | |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 557 | ### Testing rules |
| 558 | |
Johannes Schindelin | abb7c7b | 2006-02-18 13:01:18 +0100 | [diff] [blame] | 559 | # GNU make supports exporting all variables by "export" without parameters. |
| 560 | # However, the environment gets quite big, and some programs have problems |
| 561 | # with that. |
| 562 | |
| 563 | export NO_PYTHON |
| 564 | |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 565 | test: all |
| 566 | $(MAKE) -C t/ all |
| 567 | |
Junio C Hamano | 4ccafd7 | 2005-11-02 12:01:06 -0800 | [diff] [blame] | 568 | test-date$X: test-date.c date.o ctype.o |
Junio C Hamano | 94d2331 | 2005-11-13 01:46:13 -0800 | [diff] [blame] | 569 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 570 | |
H. Peter Anvin | 2f29dd5 | 2005-09-30 10:46:25 -0700 | [diff] [blame] | 571 | test-delta$X: test-delta.c diff-delta.o patch-delta.o |
Nicolas Pitre | 3d99a7f | 2006-03-08 13:19:19 -0500 | [diff] [blame] | 572 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^ -lz |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 573 | |
| 574 | check: |
Junio C Hamano | 773b633 | 2005-12-14 13:32:52 -0800 | [diff] [blame] | 575 | for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 576 | |
| 577 | |
| 578 | |
| 579 | ### Installation rules |
| 580 | |
Andreas Ericsson | d6ebd25 | 2005-11-22 00:44:15 +0100 | [diff] [blame] | 581 | install: all |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 582 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(bindir_SQ)' |
| 583 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)' |
| 584 | $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)' |
| 585 | $(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)' |
Junio C Hamano | 8d5afef | 2005-08-02 16:45:21 -0700 | [diff] [blame] | 586 | $(MAKE) -C templates install |
Johannes Schindelin | 39c015c | 2006-02-18 12:40:22 +0100 | [diff] [blame] | 587 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)' |
| 588 | $(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)' |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 589 | |
| 590 | install-doc: |
| 591 | $(MAKE) -C Documentation install |
| 592 | |
| 593 | |
| 594 | |
| 595 | |
| 596 | ### Maintainer's dist rules |
| 597 | |
Junio C Hamano | 9b88fce | 2005-12-27 14:40:17 -0800 | [diff] [blame] | 598 | git.spec: git.spec.in |
Chris Wright | a9db297 | 2005-07-07 13:09:50 -0700 | [diff] [blame] | 599 | sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@ |
| 600 | |
Junio C Hamano | 27dedf0 | 2005-11-16 21:32:44 -0800 | [diff] [blame] | 601 | GIT_TARNAME=git-$(GIT_VERSION) |
| 602 | dist: git.spec git-tar-tree |
Chris Wright | b1de9de | 2005-07-11 14:03:09 -0700 | [diff] [blame] | 603 | ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar |
Chris Wright | a9db297 | 2005-07-07 13:09:50 -0700 | [diff] [blame] | 604 | @mkdir -p $(GIT_TARNAME) |
Junio C Hamano | 27dedf0 | 2005-11-16 21:32:44 -0800 | [diff] [blame] | 605 | @cp git.spec $(GIT_TARNAME) |
H. Peter Anvin | 181129d | 2006-01-09 18:07:01 -0800 | [diff] [blame] | 606 | @echo $(GIT_VERSION) > $(GIT_TARNAME)/version |
| 607 | $(TAR) rf $(GIT_TARNAME).tar \ |
| 608 | $(GIT_TARNAME)/git.spec $(GIT_TARNAME)/version |
Chris Wright | a9db297 | 2005-07-07 13:09:50 -0700 | [diff] [blame] | 609 | @rm -rf $(GIT_TARNAME) |
Eric W. Biederman | 9dce3c0 | 2005-07-14 19:20:50 -0600 | [diff] [blame] | 610 | gzip -f -9 $(GIT_TARNAME).tar |
Chris Wright | a9db297 | 2005-07-07 13:09:50 -0700 | [diff] [blame] | 611 | |
| 612 | rpm: dist |
Junio C Hamano | 27dedf0 | 2005-11-16 21:32:44 -0800 | [diff] [blame] | 613 | $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz |
Chris Wright | a9db297 | 2005-07-07 13:09:50 -0700 | [diff] [blame] | 614 | |
Petr Baudis | 28818ff | 2005-07-29 17:50:24 +0200 | [diff] [blame] | 615 | ### Cleaning rules |
Eric W. Biederman | 87a81c8 | 2005-07-14 19:21:57 -0600 | [diff] [blame] | 616 | |
Linus Torvalds | e83c516 | 2005-04-07 15:13:13 -0700 | [diff] [blame] | 617 | clean: |
Junio C Hamano | 9ce392f | 2005-11-21 22:52:37 -0800 | [diff] [blame] | 618 | rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o $(LIB_FILE) |
Junio C Hamano | b42934d | 2006-01-12 21:37:17 -0800 | [diff] [blame] | 619 | rm -f $(ALL_PROGRAMS) git$X |
Fredrik Kuivinen | a87cd02 | 2006-03-09 17:24:19 +0100 | [diff] [blame] | 620 | rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h |
Junio C Hamano | f29eaed | 2005-08-06 22:29:21 -0700 | [diff] [blame] | 621 | rm -rf $(GIT_TARNAME) |
Junio C Hamano | 5a571cd | 2005-08-12 01:03:07 -0700 | [diff] [blame] | 622 | rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz |
Thomas Glanzmann | ca67f00 | 2005-05-22 20:27:28 +0200 | [diff] [blame] | 623 | $(MAKE) -C Documentation/ clean |
Junio C Hamano | 229a7ed | 2005-09-23 10:41:40 -0700 | [diff] [blame] | 624 | $(MAKE) -C templates clean |
Junio C Hamano | 4b7581f | 2005-08-02 17:24:11 -0700 | [diff] [blame] | 625 | $(MAKE) -C t/ clean |
Junio C Hamano | 9b88fce | 2005-12-27 14:40:17 -0800 | [diff] [blame] | 626 | rm -f GIT-VERSION-FILE |
| 627 | |
Junio C Hamano | 4dc0002 | 2006-01-12 21:42:25 -0800 | [diff] [blame] | 628 | .PHONY: all install clean strip |
Junio C Hamano | 9b88fce | 2005-12-27 14:40:17 -0800 | [diff] [blame] | 629 | .PHONY: .FORCE-GIT-VERSION-FILE |
Junio C Hamano | d89056c | 2005-12-19 17:59:58 -0800 | [diff] [blame] | 630 | |