blob: 668dbc96ca3ccefb5117155012275cc5b2fe28da [file] [log] [blame]
Junio C Hamano2731d042005-12-01 12:26:41 -08001# The default target of this Makefile is...
Junio C Hamano6fc301b2007-01-10 12:24:54 -08002all::
Junio C Hamano2731d042005-12-01 12:26:41 -08003
Shawn O. Pearce2314c942007-03-06 02:09:14 -05004# Define V=1 to have a more verbose compile.
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05005#
Junio C Hamano0e0aea52009-06-05 18:36:15 -05006# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
7#
8# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
9# to PATH if your tools in /usr/bin are broken.
10#
Michal Rokosc4582f92008-03-05 16:46:13 +010011# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
12# or vsnprintf() return -1 instead of number of characters which would
13# have been written to the final string if enough space had been available.
14#
Brandon Caseycba22522008-02-08 20:32:47 -060015# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
16# when attempting to read from an fopen'ed directory.
17#
Linus Torvalds765ac8e2006-02-28 15:07:20 -080018# Define NO_OPENSSL environment variable if you do not have OpenSSL.
Nicolas Pitre30ae47b2009-08-17 20:09:56 -040019# This also implies BLK_SHA1.
Petr Baudis5bdac8b2005-07-29 17:48:26 +020020#
Johan Herland8da1e212008-06-15 12:14:12 +020021# Define NO_CURL if you do not have libcurl installed. git-http-pull and
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080022# git-http-push are not built, and you cannot use http:// and https://
23# transports.
Johannes Schindelinb2c0bd62005-07-31 02:14:23 +020024#
Patrick Mauritz6d9bbc52005-09-19 16:11:19 +020025# Define CURLDIR=/foo/bar if your curl header and library files are in
26# /foo/bar/include and /foo/bar/lib directories.
27#
Nick Hengeveld58e60dd2005-11-02 11:19:24 -080028# Define NO_EXPAT if you do not have expat installed. git-http-push is
29# not built, and you cannot push using http:// and https:// transports.
30#
Serge van den Boom85b45182009-01-28 21:43:57 +010031# Define EXPATDIR=/foo/bar if your expat header and library files are in
32# /foo/bar/include and /foo/bar/lib directories.
33#
Junio C Hamano35a730f2006-01-19 17:13:51 -080034# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
35#
Junio C Hamano63be37b2006-01-19 17:13:57 -080036# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
Eric Blakea50dec22010-04-01 16:43:54 -060037# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
Junio C Hamano63be37b2006-01-19 17:13:57 -080038#
Ramsay Allan Jones579d1fb2006-07-30 16:38:28 +010039# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
40# do not support the 'size specifiers' introduced by C99, namely ll, hh,
41# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
Jakub Narebski465e6492006-08-04 17:55:58 +020042# some C compilers supported these specifiers prior to C99 as an extension.
Ramsay Allan Jones579d1fb2006-07-30 16:38:28 +010043#
Linus Torvaldsef34af22005-09-18 18:30:50 -070044# Define NO_STRCASESTR if you don't have strcasestr.
45#
René Scharfeb21b9f12007-09-07 00:32:54 +020046# Define NO_MEMMEM if you don't have memmem.
47#
Peter Eriksen817151e2006-06-24 16:01:25 +020048# Define NO_STRLCPY if you don't have strlcpy.
49#
Jason Riedybc6b4f52007-02-19 16:22:56 -080050# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
51# If your compiler also does not support long long or does not have
52# strtoull, define NO_STRTOULL.
53#
Jason Riedye40b61f2005-12-02 15:08:28 -080054# Define NO_SETENV if you don't have setenv in the C library.
55#
Jakub Narebskibfa8fcc2008-01-18 02:03:51 +010056# Define NO_UNSETENV if you don't have unsetenv in the C library.
57#
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -040058# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
59#
David Aguilar0620b392009-05-31 01:35:50 -070060# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
61#
David Aguilare1c06882009-05-31 01:35:51 -070062# Define NO_LIBGEN_H if you don't have libgen.h.
63#
Brandon Caseyecc395c2009-07-10 12:10:45 -050064# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
65#
Robert Schiele26009732008-01-24 19:34:46 +010066# Define NO_SYS_SELECT_H if you don't have sys/select.h.
67#
Junio C Hamano9f0bb902006-05-02 00:40:24 -070068# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
69# Enable it on Windows. By default, symrefs are still used.
Pavel Roskin2fabd212005-11-15 00:59:50 -050070#
Pavel Roskin02853582006-07-09 02:44:58 -070071# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
Eric Wong60d02cc2006-07-06 00:14:16 -070072# tests. These tests take up a significant amount of the total test time
73# but are not needed unless you plan to talk to SVN repos.
74#
Shawn Pearce8eb38ca2006-07-24 00:28:28 -040075# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
76# installed in /sw, but don't want GIT to link against any libraries
77# installed there. If defined you may specify your own (or Fink's)
78# include directories and library directories by defining CFLAGS
79# and LDFLAGS appropriately.
80#
81# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
82# have DarwinPorts installed in /opt/local, but don't want GIT to
83# link against any libraries installed there. If defined you may
84# specify your own (or DarwinPort's) include directories and
85# library directories by defining CFLAGS and LDFLAGS appropriately.
86#
Linus Torvaldsd7c208a2009-08-05 16:13:20 -070087# Define BLK_SHA1 environment variable if you want the C version
88# of the SHA1 that assumes you can do unaligned 32-bit loads and
89# have a fast htonl() function.
90#
Petr Baudis5bdac8b2005-07-29 17:48:26 +020091# Define PPC_SHA1 environment variable when running make to make use of
92# a bundled SHA1 routine optimized for PowerPC.
Junio C Hamano597c9cc2005-09-07 12:22:56 -070093#
Brian Gernhardt0460dba2009-09-08 09:54:38 -040094# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
95#
96# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +020097#
Junio C Hamano597c9cc2005-09-07 12:22:56 -070098# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
Patrick Mauritzf0ebff02005-09-06 01:24:03 +020099#
100# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
101# Patrick Mauritz).
102#
Brandon Casey70cf9912009-06-05 18:36:10 -0500103# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
104# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
105# inet_ntop and inet_pton additionally reside there.
106#
Johannes Schindelin730d48a2005-10-08 15:54:36 -0700107# Define NO_MMAP if you want to avoid mmap.
108#
Junio C Hamano46059cc2008-11-15 04:08:14 -0800109# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
110#
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100111# Define NO_PREAD if you have a problem with pread() system call (e.g.
Eric Blakea50dec22010-04-01 16:43:54 -0600112# cygwin1.dll before v1.5.22).
Stefan-W. Hahn69006792007-01-09 22:04:12 +0100113#
Shawn O. Pearce1510fea2006-12-14 06:15:57 -0500114# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
115# generally faster on your platform than accessing the working directory.
116#
Shawn O. Pearcec8697532006-12-30 23:53:55 -0500117# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
118# the executable mode bit, but doesn't really do so.
119#
hpa49744d62005-09-28 16:52:21 -0700120# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
121#
Junio C Hamanobdc37f52006-01-19 17:13:32 -0800122# Define NO_SOCKADDR_STORAGE if your platform does not have struct
123# sockaddr_storage.
124#
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +0100125# Define NO_ICONV if your libc does not properly support iconv.
126#
Ramsay Jonesfd547a92007-03-03 18:29:03 +0000127# Define OLD_ICONV if your library has an old iconv(), where the second
128# (input buffer pointer) parameter is declared with type (const char **).
129#
David Symonds609a2282007-11-07 14:24:28 +1100130# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
131#
Matt Kraai20648872007-06-30 10:05:03 -0700132# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
133# that tells runtime paths to dynamic libraries;
134# "-Wl,-rpath=/path/lib" is used instead.
Junio C Hamanobbfc63d2006-12-27 14:17:35 -0800135#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200136# Define USE_NSEC below if you want git to care about sub-second file mtimes
137# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
138# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
139# randomly break unless your underlying filesystem supports those sub-second
140# times (my ext3 doesn't).
Junio C Hamanof6af75d2006-06-23 17:57:48 -0700141#
Brian Gernhardtc5673832009-03-08 16:04:28 -0400142# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
143# "st_ctim"
144#
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100145# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
146# available. This automatically turns USE_NSEC off.
147#
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200148# Define USE_STDEV below if you want git to care about the underlying device
Johannes Schindelin10455d22007-11-30 11:35:23 +0000149# change being considered an inode change from the update-index perspective.
Alex Riesenf8487182006-12-04 10:50:04 +0100150#
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +0200151# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
152# field that counts the on-disk footprint in 512-byte blocks.
153#
Junio C Hamano4c7100a2007-06-14 22:20:16 -0700154# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
155#
Jonathan Nieder162213d2009-10-09 05:15:29 -0500156# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72
157# (not v1.73 or v1.71).
158#
159# Define ASCIIDOC_NO_ROFF if your DocBook XSL escapes raw roff directives
160# (versions 1.72 and later and 1.68.1 and earlier).
Jonas Fonseca7f55cf42007-11-14 10:38:46 +0100161#
Thomas Rast204d3632009-10-22 10:19:06 +0200162# Define GNU_ROFF if your target system uses GNU groff. This forces
163# apostrophes to be ASCII so that cut&pasting examples to the shell
164# will work.
165#
Alex Riesenf8487182006-12-04 10:50:04 +0100166# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
167# MakeMaker (e.g. using ActiveState under Cygwin).
168#
Jeff King499c2932009-04-03 15:32:20 -0400169# Define NO_PERL if you do not want Perl scripts or libraries at all.
170#
Johan Herlandd4e1b472009-11-18 02:42:31 +0100171# Define NO_PYTHON if you do not want Python scripts or libraries at all.
172#
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700173# Define NO_TCLTK if you do not want Tcl/Tk GUI.
174#
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400175# The TCL_PATH variable governs the location of the Tcl interpreter
176# used to optimize git-gui for your system. Only used if NO_TCLTK
177# is not set. Defaults to the bare 'tclsh'.
178#
179# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700180# If not set it defaults to the bare 'wish'. If it is set to the empty
181# string then NO_TCLTK will be forced (this is used by configure script).
182#
Brian Downing43fe9012008-02-05 15:10:44 -0600183# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
184# is a simplified version of the merge sort used in glibc. This is
185# recommended if Git triggers O(n^2) behavior in your platform's qsort().
186#
Johannes Sixt34779c52009-04-20 10:17:00 +0200187# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
188# information on a not yet closed file that lstat would return for the same
189# file after it was closed.
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200190#
Johannes Schindelin348df162009-04-28 00:32:25 +0200191# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
192# when hardlinking a file to another name and unlinking the original file right
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +0200193# away (some NTFS drivers seem to zero the contents in that scenario).
Junio C Hamano2c8f8b12009-05-23 01:43:08 -0700194#
Johannes Schindelin3426e342009-05-11 13:02:18 +0200195# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
196# programs as a tar, where bin/ and libexec/ might be on different file systems.
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +0200197#
198# Define USE_NED_ALLOCATOR if you want to replace the platforms default
199# memory allocators with the nedmalloc allocator written by Niall Douglas.
Jeff King02232ad2009-06-16 15:07:40 -0400200#
201# Define NO_REGEX if you have no or inferior regex support in your C library.
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500202#
Jakub Narebski63267de2009-09-01 13:39:20 +0200203# Define JSMIN to point to JavaScript minifier that functions as
204# a filter to have gitweb.js minified.
Junio C Hamano8678bc02009-12-01 11:28:15 -0800205#
Mark Rada0e6ce212010-04-02 20:35:05 -0400206# Define CSSMIN to point to a CSS minifier in order to generate a minified
207# version of gitweb.css
208#
Junio C Hamanoa3d023d2009-10-30 20:45:34 -0500209# Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
210# you want to use something different. The value will be interpreted by the
211# shell at runtime when it is used.
212#
Jonathan Nieder8f4b5762009-10-30 20:44:41 -0500213# Define DEFAULT_EDITOR to a sensible editor command (defaults to "vi") if you
214# want to use something different. The value will be interpreted by the shell
215# if necessary when it is used. Examples:
216#
217# DEFAULT_EDITOR='~/bin/vi',
218# DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',
219# DEFAULT_EDITOR='"C:\Program Files\Vim\gvim.exe" --nofork'
Jonathan Niederdfea5752010-01-26 09:52:49 -0600220#
221# Define COMPUTE_HEADER_DEPENDENCIES if your compiler supports the -MMD option
222# and you want to avoid rebuilding objects when an unrelated header file
223# changes.
Jonathan Niederf2fabbf2010-01-26 09:57:15 -0600224#
225# Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded
226# dependency rules.
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200227
Jonathan Nieder13fca9f2010-01-06 02:06:58 -0600228GIT-VERSION-FILE: FORCE
Fredrik Kuivinen36546382006-02-14 00:15:14 +0100229 @$(SHELL_PATH) ./GIT-VERSION-GEN
Junio C Hamano9b88fce2005-12-27 14:40:17 -0800230-include GIT-VERSION-FILE
Petr Baudis5bdac8b2005-07-29 17:48:26 +0200231
Paul Jakmae15f5452006-02-20 23:36:28 +0000232uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
233uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
234uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
235uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
236uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
Junio C Hamano46059cc2008-11-15 04:08:14 -0800237uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
Paul Jakmae15f5452006-02-20 23:36:28 +0000238
Ramsay Jonesd691d842009-11-07 20:08:01 +0000239ifdef MSVC
240 # avoid the MingW and Cygwin configuration sections
241 uname_S := Windows
242 uname_O := Windows
243endif
244
Junio C Hamano94d23312005-11-13 01:46:13 -0800245# CFLAGS and LDFLAGS are for the users to override from the command line.
Junio C Hamano12aa7452005-11-04 23:50:09 -0800246
Pavel Roskinb05701c2005-08-06 01:36:15 -0400247CFLAGS = -g -O2 -Wall
Junio C Hamano94d23312005-11-13 01:46:13 -0800248LDFLAGS =
Gary V. Vaughanebef8272010-05-14 09:31:32 +0000249ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
Junio C Hamano94d23312005-11-13 01:46:13 -0800250ALL_LDFLAGS = $(LDFLAGS)
Junio C Hamano4dc00022006-01-12 21:42:25 -0800251STRIP ?= strip
Thomas Glanzmann29c2cce2005-05-07 10:41:54 +0200252
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200253# Among the variables below, these:
254# gitexecdir
255# template_dir
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100256# mandir
257# infodir
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200258# htmldir
259# ETC_GITCONFIG (but not sysconfdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100260# can be specified as a relative path some/where/else;
261# this is interpreted as relative to $(prefix) and "git" at
Johannes Sixt49fa65a2008-07-23 21:12:18 +0200262# runtime figures out where they are based on the path to the executable.
263# This can help installing the suite in a relocatable way.
264
Pavel Roskinb05701c2005-08-06 01:36:15 -0400265prefix = $(HOME)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100266bindir_relative = bin
267bindir = $(prefix)/$(bindir_relative)
268mandir = share/man
269infodir = share/info
270gitexecdir = libexec/git-core
Johannes Sixt93547682007-06-11 10:02:17 +0200271sharedir = $(prefix)/share
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100272template_dir = share/git-core/templates
273htmldir = share/doc/git-doc
Josh Triplettb51b8bb2007-04-24 00:51:35 -0700274ifeq ($(prefix),/usr)
275sysconfdir = /etc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100276ETC_GITCONFIG = $(sysconfdir)/gitconfig
Josh Triplettb51b8bb2007-04-24 00:51:35 -0700277else
278sysconfdir = $(prefix)/etc
Steffen Prohaska026fa0d2009-01-18 13:00:09 +0100279ETC_GITCONFIG = etc/gitconfig
Josh Triplettb51b8bb2007-04-24 00:51:35 -0700280endif
Robert Schiele10861be2007-08-01 06:30:35 +0200281lib = lib
Petr Baudisa682ef92005-08-05 01:56:38 +0200282# DESTDIR=
Johannes Schindelin352c8112009-05-23 10:04:48 +0200283pathsep = :
Petr Baudis5c2a7fb2005-04-13 02:14:06 -0700284
Michael J Gruber8ea7ad62009-02-10 16:14:13 +0100285export prefix bindir sharedir sysconfdir
Jakub Narebskie14421b2006-06-29 22:11:25 +0200286
Pavel Roskinb05701c2005-08-06 01:36:15 -0400287CC = gcc
288AR = ar
Emil Medve4cb08df2007-07-14 12:51:44 -0500289RM = rm -f
Gary V. Vaughand1b1a912010-05-14 09:31:36 +0000290DIFF = diff
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700291TAR = tar
David Kastrup89b2f192007-07-29 15:23:28 -0700292FIND = find
Pavel Roskinb05701c2005-08-06 01:36:15 -0400293INSTALL = install
294RPMBUILD = rpmbuild
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400295TCL_PATH = tclsh
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -0700296TCLTK_PATH = wish
David M. Syzdek158629b2008-11-02 14:43:20 -0900297PTHREAD_LIBS = -lpthread
Gary V. Vaughan48793cf2010-05-14 09:31:34 +0000298PTHREAD_CFLAGS =
Linus Torvaldse83c5162005-04-07 15:13:13 -0700299
Shawn O. Pearce5f5dbd72007-05-07 23:36:31 -0400300export TCL_PATH TCLTK_PATH
301
Linus Torvalds44c9e852005-07-03 10:02:35 -0700302# sparse is architecture-neutral, which means that we need to tell it
303# explicitly what architecture to check for. Fix this up for yours..
Pavel Roskinb05701c2005-08-06 01:36:15 -0400304SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
Linus Torvalds44c9e852005-07-03 10:02:35 -0700305
Petr Baudis28818ff2005-07-29 17:50:24 +0200306
307
308### --- END CONFIGURATION SECTION ---
309
Petr Baudis8d7f5862006-06-25 03:47:03 +0200310# Those must not be GNU-specific; they are shared with perl/ which may
Petr Baudis18b0fc12006-09-23 20:20:47 +0200311# be built by a different compiler. (Note that this is an artifact now
312# but it still might be nice to keep that distinction.)
Linus Torvalds81b50f32010-02-22 08:42:18 -0800313BASIC_CFLAGS = -I.
Petr Baudis18b0fc12006-09-23 20:20:47 +0200314BASIC_LDFLAGS =
Petr Baudis8d7f5862006-06-25 03:47:03 +0200315
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100316# Guard against environment variables
317BUILTIN_OBJS =
318BUILT_INS =
319COMPAT_CFLAGS =
320COMPAT_OBJS =
Jonathan Niedera673cfe2010-03-19 22:20:12 -0500321EXTRA_CPPFLAGS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100322LIB_H =
323LIB_OBJS =
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600324PROGRAM_OBJS =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100325PROGRAMS =
326SCRIPT_PERL =
Johan Herlandd4e1b472009-11-18 02:42:31 +0100327SCRIPT_PYTHON =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100328SCRIPT_SH =
Jonathan Nieder46bac902010-01-31 11:46:53 -0800329SCRIPT_LIB =
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600330TEST_PROGRAMS_NEED_X =
Johannes Schindelin5c928c02009-03-25 17:27:28 +0100331
Jonathan Niederc40d92e2010-03-19 19:06:15 -0500332# Having this variable in your environment would break pipelines because
333# you cause "cd" to echo its destination to stdout. It can also take
334# scripts to unexpected places. If you like CDPATH, define it for your
335# interactive shell sessions without exporting it.
336unexport CDPATH
337
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700338SCRIPT_SH += git-am.sh
339SCRIPT_SH += git-bisect.sh
David Aguilarafcbc8e2009-04-07 01:21:20 -0700340SCRIPT_SH += git-difftool--helper.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700341SCRIPT_SH += git-filter-branch.sh
342SCRIPT_SH += git-lost-found.sh
343SCRIPT_SH += git-merge-octopus.sh
344SCRIPT_SH += git-merge-one-file.sh
345SCRIPT_SH += git-merge-resolve.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700346SCRIPT_SH += git-mergetool.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700347SCRIPT_SH += git-pull.sh
348SCRIPT_SH += git-quiltimport.sh
349SCRIPT_SH += git-rebase--interactive.sh
350SCRIPT_SH += git-rebase.sh
351SCRIPT_SH += git-repack.sh
352SCRIPT_SH += git-request-pull.sh
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700353SCRIPT_SH += git-stash.sh
354SCRIPT_SH += git-submodule.sh
355SCRIPT_SH += git-web--browse.sh
Petr Baudis28818ff2005-07-29 17:50:24 +0200356
Jonathan Nieder46bac902010-01-31 11:46:53 -0800357SCRIPT_LIB += git-mergetool--lib
358SCRIPT_LIB += git-parse-remote
359SCRIPT_LIB += git-sh-setup
360
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700361SCRIPT_PERL += git-add--interactive.perl
David Aguilarafcbc8e2009-04-07 01:21:20 -0700362SCRIPT_PERL += git-difftool.perl
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700363SCRIPT_PERL += git-archimport.perl
364SCRIPT_PERL += git-cvsexportcommit.perl
365SCRIPT_PERL += git-cvsimport.perl
366SCRIPT_PERL += git-cvsserver.perl
367SCRIPT_PERL += git-relink.perl
368SCRIPT_PERL += git-send-email.perl
369SCRIPT_PERL += git-svn.perl
Junio C Hamano60036a42005-07-30 17:31:47 -0700370
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100371SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
372 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
Johan Herlandd4e1b472009-11-18 02:42:31 +0100373 $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
Shawn O. Pearcee475fe12007-11-23 15:35:08 -0500374 git-instaweb
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100375
Junio C Hamano42f77402006-08-15 21:38:07 -0700376# Empty...
377EXTRA_PROGRAMS =
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100378
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700379# ... and all the rest that could be moved out of bindir to gitexecdir
380PROGRAMS += $(EXTRA_PROGRAMS)
Jonathan Nieder1b22c992010-01-26 09:54:23 -0600381
382PROGRAM_OBJS += fast-import.o
383PROGRAM_OBJS += imap-send.o
384PROGRAM_OBJS += shell.o
385PROGRAM_OBJS += show-index.o
386PROGRAM_OBJS += upload-pack.o
387PROGRAM_OBJS += http-backend.o
388
389PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700390
Jonathan Nieder225f78c2010-01-26 10:08:44 -0600391TEST_PROGRAMS_NEED_X += test-chmtime
392TEST_PROGRAMS_NEED_X += test-ctype
393TEST_PROGRAMS_NEED_X += test-date
394TEST_PROGRAMS_NEED_X += test-delta
395TEST_PROGRAMS_NEED_X += test-dump-cache-tree
396TEST_PROGRAMS_NEED_X += test-genrandom
397TEST_PROGRAMS_NEED_X += test-match-trees
398TEST_PROGRAMS_NEED_X += test-parse-options
399TEST_PROGRAMS_NEED_X += test-path-utils
400TEST_PROGRAMS_NEED_X += test-run-command
401TEST_PROGRAMS_NEED_X += test-sha1
402TEST_PROGRAMS_NEED_X += test-sigchain
403TEST_PROGRAMS_NEED_X += test-index-version
404
Junio C Hamanoa026d532010-03-02 12:44:08 -0800405TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
Andreas Ericssond6ebd252005-11-22 00:44:15 +0100406
Junio C Hamano17368552008-02-23 11:08:25 -0800407# List built-in command $C whose implementation cmd_$C() is not in
Linus Torvalds81b50f32010-02-22 08:42:18 -0800408# builtin/$C.o but is linked in as part of some other command.
409BUILT_INS += $(patsubst builtin/%.o,git-%$X,$(BUILTIN_OBJS))
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700410
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700411BUILT_INS += git-cherry$X
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100412BUILT_INS += git-cherry-pick$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700413BUILT_INS += git-format-patch$X
414BUILT_INS += git-fsck-objects$X
415BUILT_INS += git-get-tar-commit-id$X
416BUILT_INS += git-init$X
417BUILT_INS += git-merge-subtree$X
418BUILT_INS += git-peek-remote$X
419BUILT_INS += git-repo-config$X
420BUILT_INS += git-show$X
Junio C Hamano24b1f652008-12-03 00:30:34 -0800421BUILT_INS += git-stage$X
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700422BUILT_INS += git-status$X
423BUILT_INS += git-whatchanged$X
Junio C Hamano91730802006-04-10 17:37:58 -0700424
Junio C Hamanoad17f012009-08-07 12:09:29 -0700425# what 'all' will build and 'install' will install in gitexecdir,
426# excluding programs for built-in commands
Junio C Hamano6506e152007-02-06 21:27:09 -0800427ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
Linus Torvaldse83c5162005-04-07 15:13:13 -0700428
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700429# what 'all' will build but not install in gitexecdir
Jeff King499c2932009-04-03 15:32:20 -0400430OTHER_PROGRAMS = git$X
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -0700431
Matthew Ogilvieea925192009-12-02 22:14:05 -0700432# what test wrappers are needed and 'install' will install, in bindir
433BINDIR_PROGRAMS_NEED_X += git
434BINDIR_PROGRAMS_NEED_X += git-upload-pack
435BINDIR_PROGRAMS_NEED_X += git-receive-pack
436BINDIR_PROGRAMS_NEED_X += git-upload-archive
437BINDIR_PROGRAMS_NEED_X += git-shell
438
439BINDIR_PROGRAMS_NO_X += git-cvsserver
440
Ryan Anderson3d320512005-11-21 00:11:22 -0500441# Set paths to tools early so that they can be used for version tests.
442ifndef SHELL_PATH
443 SHELL_PATH = /bin/sh
444endif
445ifndef PERL_PATH
446 PERL_PATH = /usr/bin/perl
447endif
Johan Herlandd4e1b472009-11-18 02:42:31 +0100448ifndef PYTHON_PATH
449 PYTHON_PATH = /usr/bin/python
450endif
Junio C Hamano720d1502005-09-10 17:46:27 -0700451
Luben Tuikov3a793472006-12-14 23:03:03 -0800452export PERL_PATH
Johan Herlandd4e1b472009-11-18 02:42:31 +0100453export PYTHON_PATH
Luben Tuikov3a793472006-12-14 23:03:03 -0800454
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700455LIB_FILE=libgit.a
Linus Torvalds34435462006-03-24 20:13:22 -0800456XDIFF_LIB=xdiff/lib.a
Linus Torvalds0a02ce72005-04-18 12:49:39 -0700457
Jeff King75194432009-09-09 07:38:58 -0400458LIB_H += advice.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700459LIB_H += archive.h
460LIB_H += attr.h
461LIB_H += blob.h
462LIB_H += builtin.h
463LIB_H += cache.h
464LIB_H += cache-tree.h
Jonathan Nieder21528ab2010-01-26 09:44:47 -0600465LIB_H += color.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700466LIB_H += commit.h
Dmitry V. Levin75457122009-11-02 02:09:05 +0300467LIB_H += compat/bswap.h
Dmitry Potapovadbc0b62008-09-30 17:53:47 +0400468LIB_H += compat/cygwin.h
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100469LIB_H += compat/mingw.h
Andrzej K. Haczewski44626dc2010-01-15 21:12:20 +0100470LIB_H += compat/win32/pthread.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700471LIB_H += csum-file.h
472LIB_H += decorate.h
473LIB_H += delta.h
474LIB_H += diffcore.h
475LIB_H += diff.h
476LIB_H += dir.h
Jonathan Nieder21528ab2010-01-26 09:44:47 -0600477LIB_H += exec_cmd.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700478LIB_H += fsck.h
479LIB_H += git-compat-util.h
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700480LIB_H += graph.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700481LIB_H += grep.h
482LIB_H += hash.h
Miklos Vajna940208a2008-07-30 01:16:58 +0200483LIB_H += help.h
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200484LIB_H += levenshtein.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700485LIB_H += list-objects.h
486LIB_H += ll-merge.h
487LIB_H += log-tree.h
488LIB_H += mailmap.h
Miklos Vajnadb3a9542008-09-03 01:49:05 +0200489LIB_H += merge-recursive.h
Johannes Schindelina97a7462009-10-09 12:21:57 +0200490LIB_H += notes.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700491LIB_H += object.h
492LIB_H += pack.h
Johan Herland94e724a2008-06-15 16:05:06 +0200493LIB_H += pack-refs.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700494LIB_H += pack-revindex.h
495LIB_H += parse-options.h
496LIB_H += patch-ids.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700497LIB_H += pkt-line.h
498LIB_H += progress.h
499LIB_H += quote.h
500LIB_H += reflog-walk.h
501LIB_H += refs.h
502LIB_H += remote.h
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200503LIB_H += rerere.h
Junio C Hamanocfc57892009-12-25 00:30:51 -0800504LIB_H += resolve-undo.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700505LIB_H += revision.h
506LIB_H += run-command.h
Junio C Hamano628522e2007-12-29 02:05:47 -0800507LIB_H += sha1-lookup.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700508LIB_H += sideband.h
Jeff King4a16d072009-01-22 01:02:35 -0500509LIB_H += sigchain.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700510LIB_H += strbuf.h
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100511LIB_H += string-list.h
Johannes Schindelin752c0c22009-10-19 14:38:32 +0200512LIB_H += submodule.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700513LIB_H += tag.h
514LIB_H += transport.h
515LIB_H += tree.h
516LIB_H += tree-walk.h
517LIB_H += unpack-trees.h
Jeff Kingbe58e702008-10-05 17:43:21 -0400518LIB_H += userdiff.h
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700519LIB_H += utf8.h
Jonathan Nieder21528ab2010-01-26 09:44:47 -0600520LIB_H += xdiff-interface.h
521LIB_H += xdiff/xdiff.h
Junio C Hamano8f3f9b02005-07-23 17:54:41 -0700522
Dmitry Potapov5b8e6f82008-06-28 00:46:42 +0400523LIB_OBJS += abspath.o
Jeff King75194432009-09-09 07:38:58 -0400524LIB_OBJS += advice.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700525LIB_OBJS += alias.o
526LIB_OBJS += alloc.o
527LIB_OBJS += archive.o
528LIB_OBJS += archive-tar.o
529LIB_OBJS += archive-zip.o
530LIB_OBJS += attr.o
531LIB_OBJS += base85.o
Christian Coudera2ad79c2009-03-26 05:55:24 +0100532LIB_OBJS += bisect.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700533LIB_OBJS += blob.o
534LIB_OBJS += branch.o
535LIB_OBJS += bundle.o
536LIB_OBJS += cache-tree.o
537LIB_OBJS += color.o
538LIB_OBJS += combine-diff.o
539LIB_OBJS += commit.o
540LIB_OBJS += config.o
541LIB_OBJS += connect.o
542LIB_OBJS += convert.o
543LIB_OBJS += copy.o
544LIB_OBJS += csum-file.o
545LIB_OBJS += ctype.o
546LIB_OBJS += date.o
547LIB_OBJS += decorate.o
548LIB_OBJS += diffcore-break.o
549LIB_OBJS += diffcore-delta.o
550LIB_OBJS += diffcore-order.o
551LIB_OBJS += diffcore-pickaxe.o
552LIB_OBJS += diffcore-rename.o
553LIB_OBJS += diff-delta.o
554LIB_OBJS += diff-lib.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100555LIB_OBJS += diff-no-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700556LIB_OBJS += diff.o
557LIB_OBJS += dir.o
Stephan Beyerd82f33e2008-07-25 18:28:41 +0200558LIB_OBJS += editor.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700559LIB_OBJS += entry.o
560LIB_OBJS += environment.o
561LIB_OBJS += exec_cmd.o
562LIB_OBJS += fsck.o
Adam Simpkinsc12172d2008-05-04 03:36:53 -0700563LIB_OBJS += graph.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700564LIB_OBJS += grep.o
565LIB_OBJS += hash.o
566LIB_OBJS += help.o
Linus Torvaldsa5031212010-01-21 15:25:19 -0800567LIB_OBJS += hex.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700568LIB_OBJS += ident.o
Johannes Schindelin8af84da2008-08-31 15:50:23 +0200569LIB_OBJS += levenshtein.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700570LIB_OBJS += list-objects.o
571LIB_OBJS += ll-merge.o
572LIB_OBJS += lockfile.o
573LIB_OBJS += log-tree.o
574LIB_OBJS += mailmap.o
575LIB_OBJS += match-trees.o
576LIB_OBJS += merge-file.o
Miklos Vajna9047ebb2008-08-12 18:45:14 +0200577LIB_OBJS += merge-recursive.o
Linus Torvalds96872bc2008-03-21 13:16:24 -0700578LIB_OBJS += name-hash.o
Johannes Schindelina97a7462009-10-09 12:21:57 +0200579LIB_OBJS += notes.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700580LIB_OBJS += object.o
581LIB_OBJS += pack-check.o
Johan Herland94e724a2008-06-15 16:05:06 +0200582LIB_OBJS += pack-refs.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700583LIB_OBJS += pack-revindex.o
584LIB_OBJS += pack-write.o
585LIB_OBJS += pager.o
586LIB_OBJS += parse-options.o
587LIB_OBJS += patch-delta.o
588LIB_OBJS += patch-ids.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700589LIB_OBJS += path.o
590LIB_OBJS += pkt-line.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100591LIB_OBJS += preload-index.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700592LIB_OBJS += pretty.o
593LIB_OBJS += progress.o
594LIB_OBJS += quote.o
595LIB_OBJS += reachable.o
596LIB_OBJS += read-cache.o
597LIB_OBJS += reflog-walk.o
598LIB_OBJS += refs.o
599LIB_OBJS += remote.o
Christian Couder68095572009-01-23 10:06:53 +0100600LIB_OBJS += replace_object.o
Stephan Beyer5b2fd952008-07-09 14:58:57 +0200601LIB_OBJS += rerere.o
Junio C Hamanocfc57892009-12-25 00:30:51 -0800602LIB_OBJS += resolve-undo.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700603LIB_OBJS += revision.o
604LIB_OBJS += run-command.o
605LIB_OBJS += server-info.o
606LIB_OBJS += setup.o
Junio C Hamano628522e2007-12-29 02:05:47 -0800607LIB_OBJS += sha1-lookup.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100608LIB_OBJS += sha1_file.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700609LIB_OBJS += sha1_name.o
610LIB_OBJS += shallow.o
611LIB_OBJS += sideband.o
Jeff King4a16d072009-01-22 01:02:35 -0500612LIB_OBJS += sigchain.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700613LIB_OBJS += strbuf.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100614LIB_OBJS += string-list.o
Johannes Schindelin752c0c22009-10-19 14:38:32 +0200615LIB_OBJS += submodule.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700616LIB_OBJS += symlinks.o
617LIB_OBJS += tag.o
618LIB_OBJS += trace.o
619LIB_OBJS += transport.o
Daniel Barkalow6eb996b2009-08-05 01:01:53 -0400620LIB_OBJS += transport-helper.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700621LIB_OBJS += tree-diff.o
622LIB_OBJS += tree.o
623LIB_OBJS += tree-walk.o
624LIB_OBJS += unpack-trees.o
625LIB_OBJS += usage.o
Stephan Beyerfcb6c072009-02-09 23:00:45 +0100626LIB_OBJS += userdiff.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700627LIB_OBJS += utf8.o
628LIB_OBJS += walker.o
Linus Torvalds112db552008-06-22 12:19:25 -0700629LIB_OBJS += wrapper.o
Junio C Hamano74ca5e62008-03-12 01:46:26 -0700630LIB_OBJS += write_or_die.o
631LIB_OBJS += ws.o
632LIB_OBJS += wt-status.o
633LIB_OBJS += xdiff-interface.o
Josef Weidendorferb1bf95b2005-07-31 21:17:43 +0200634
Linus Torvalds81b50f32010-02-22 08:42:18 -0800635BUILTIN_OBJS += builtin/add.o
636BUILTIN_OBJS += builtin/annotate.o
637BUILTIN_OBJS += builtin/apply.o
638BUILTIN_OBJS += builtin/archive.o
639BUILTIN_OBJS += builtin/bisect--helper.o
640BUILTIN_OBJS += builtin/blame.o
641BUILTIN_OBJS += builtin/branch.o
642BUILTIN_OBJS += builtin/bundle.o
643BUILTIN_OBJS += builtin/cat-file.o
644BUILTIN_OBJS += builtin/check-attr.o
645BUILTIN_OBJS += builtin/check-ref-format.o
646BUILTIN_OBJS += builtin/checkout-index.o
647BUILTIN_OBJS += builtin/checkout.o
648BUILTIN_OBJS += builtin/clean.o
649BUILTIN_OBJS += builtin/clone.o
650BUILTIN_OBJS += builtin/commit-tree.o
651BUILTIN_OBJS += builtin/commit.o
652BUILTIN_OBJS += builtin/config.o
653BUILTIN_OBJS += builtin/count-objects.o
654BUILTIN_OBJS += builtin/describe.o
655BUILTIN_OBJS += builtin/diff-files.o
656BUILTIN_OBJS += builtin/diff-index.o
657BUILTIN_OBJS += builtin/diff-tree.o
658BUILTIN_OBJS += builtin/diff.o
659BUILTIN_OBJS += builtin/fast-export.o
660BUILTIN_OBJS += builtin/fetch-pack.o
661BUILTIN_OBJS += builtin/fetch.o
662BUILTIN_OBJS += builtin/fmt-merge-msg.o
663BUILTIN_OBJS += builtin/for-each-ref.o
664BUILTIN_OBJS += builtin/fsck.o
665BUILTIN_OBJS += builtin/gc.o
666BUILTIN_OBJS += builtin/grep.o
667BUILTIN_OBJS += builtin/hash-object.o
668BUILTIN_OBJS += builtin/help.o
669BUILTIN_OBJS += builtin/index-pack.o
670BUILTIN_OBJS += builtin/init-db.o
671BUILTIN_OBJS += builtin/log.o
672BUILTIN_OBJS += builtin/ls-files.o
673BUILTIN_OBJS += builtin/ls-remote.o
674BUILTIN_OBJS += builtin/ls-tree.o
675BUILTIN_OBJS += builtin/mailinfo.o
676BUILTIN_OBJS += builtin/mailsplit.o
677BUILTIN_OBJS += builtin/merge.o
678BUILTIN_OBJS += builtin/merge-base.o
679BUILTIN_OBJS += builtin/merge-file.o
680BUILTIN_OBJS += builtin/merge-index.o
681BUILTIN_OBJS += builtin/merge-ours.o
682BUILTIN_OBJS += builtin/merge-recursive.o
683BUILTIN_OBJS += builtin/merge-tree.o
684BUILTIN_OBJS += builtin/mktag.o
685BUILTIN_OBJS += builtin/mktree.o
686BUILTIN_OBJS += builtin/mv.o
687BUILTIN_OBJS += builtin/name-rev.o
Junio C Hamano29491512010-03-15 00:52:06 -0700688BUILTIN_OBJS += builtin/notes.o
Linus Torvalds81b50f32010-02-22 08:42:18 -0800689BUILTIN_OBJS += builtin/pack-objects.o
690BUILTIN_OBJS += builtin/pack-redundant.o
691BUILTIN_OBJS += builtin/pack-refs.o
692BUILTIN_OBJS += builtin/patch-id.o
693BUILTIN_OBJS += builtin/prune-packed.o
694BUILTIN_OBJS += builtin/prune.o
695BUILTIN_OBJS += builtin/push.o
696BUILTIN_OBJS += builtin/read-tree.o
697BUILTIN_OBJS += builtin/receive-pack.o
698BUILTIN_OBJS += builtin/reflog.o
699BUILTIN_OBJS += builtin/remote.o
700BUILTIN_OBJS += builtin/replace.o
701BUILTIN_OBJS += builtin/rerere.o
702BUILTIN_OBJS += builtin/reset.o
703BUILTIN_OBJS += builtin/rev-list.o
704BUILTIN_OBJS += builtin/rev-parse.o
705BUILTIN_OBJS += builtin/revert.o
706BUILTIN_OBJS += builtin/rm.o
707BUILTIN_OBJS += builtin/send-pack.o
708BUILTIN_OBJS += builtin/shortlog.o
709BUILTIN_OBJS += builtin/show-branch.o
710BUILTIN_OBJS += builtin/show-ref.o
711BUILTIN_OBJS += builtin/stripspace.o
712BUILTIN_OBJS += builtin/symbolic-ref.o
713BUILTIN_OBJS += builtin/tag.o
714BUILTIN_OBJS += builtin/tar-tree.o
715BUILTIN_OBJS += builtin/unpack-file.o
716BUILTIN_OBJS += builtin/unpack-objects.o
717BUILTIN_OBJS += builtin/update-index.o
718BUILTIN_OBJS += builtin/update-ref.o
719BUILTIN_OBJS += builtin/update-server-info.o
720BUILTIN_OBJS += builtin/upload-archive.o
721BUILTIN_OBJS += builtin/var.o
722BUILTIN_OBJS += builtin/verify-pack.o
723BUILTIN_OBJS += builtin/verify-tag.o
724BUILTIN_OBJS += builtin/write-tree.o
Linus Torvalds70827b12006-04-21 10:27:34 -0700725
Johannes Schindelin54c261f2006-03-27 01:14:52 +0200726GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
Robert Schielebef19da2007-07-29 20:35:45 +0200727EXTLIBS =
Linus Torvaldscef661f2005-04-21 12:33:22 -0700728
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700729#
730# Platform specific tweaks
731#
Junio C Hamanof7c15342005-10-09 12:52:35 -0700732
733# We choose to avoid "if .. else if .. else .. endif endif"
734# because maintaining the nesting to match is a pain. If
735# we had "elif" things would have been much nicer...
Junio C Hamanof7c15342005-10-09 12:52:35 -0700736
Peter Eriksen817151e2006-06-24 16:01:25 +0200737ifeq ($(uname_S),Linux)
738 NO_STRLCPY = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700739 NO_MKSTEMPS = YesPlease
Peter Eriksen817151e2006-06-24 16:01:25 +0200740endif
Gerrit Papeca7a7412006-07-29 16:26:18 +0000741ifeq ($(uname_S),GNU/kFreeBSD)
742 NO_STRLCPY = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700743 NO_MKSTEMPS = YesPlease
Gerrit Papeca7a7412006-07-29 16:26:18 +0000744endif
Boyd Lynn Gerber457bb452008-06-08 14:47:54 -0600745ifeq ($(uname_S),UnixWare)
746 CC = cc
747 NEEDS_SOCKET = YesPlease
748 NEEDS_NSL = YesPlease
749 NEEDS_SSL_WITH_CRYPTO = YesPlease
750 NEEDS_LIBICONV = YesPlease
751 SHELL_PATH = /usr/local/bin/bash
752 NO_IPV6 = YesPlease
753 NO_HSTRERROR = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700754 NO_MKSTEMPS = YesPlease
Boyd Lynn Gerber457bb452008-06-08 14:47:54 -0600755 BASIC_CFLAGS += -Kthread
756 BASIC_CFLAGS += -I/usr/local/include
757 BASIC_LDFLAGS += -L/usr/local/lib
758 INSTALL = ginstall
759 TAR = gtar
760 NO_STRCASESTR = YesPlease
761 NO_MEMMEM = YesPlease
762endif
763ifeq ($(uname_S),SCO_SV)
764 ifeq ($(uname_R),3.2)
765 CFLAGS = -O2
766 endif
767 ifeq ($(uname_R),5)
768 CC = cc
769 BASIC_CFLAGS += -Kthread
770 endif
771 NEEDS_SOCKET = YesPlease
772 NEEDS_NSL = YesPlease
773 NEEDS_SSL_WITH_CRYPTO = YesPlease
774 NEEDS_LIBICONV = YesPlease
775 SHELL_PATH = /usr/bin/bash
776 NO_IPV6 = YesPlease
777 NO_HSTRERROR = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700778 NO_MKSTEMPS = YesPlease
Boyd Lynn Gerber457bb452008-06-08 14:47:54 -0600779 BASIC_CFLAGS += -I/usr/local/include
780 BASIC_LDFLAGS += -L/usr/local/lib
781 NO_STRCASESTR = YesPlease
782 NO_MEMMEM = YesPlease
783 INSTALL = ginstall
784 TAR = gtar
785endif
Junio C Hamanof7c15342005-10-09 12:52:35 -0700786ifeq ($(uname_S),Darwin)
Brian Gernhardt0460dba2009-09-08 09:54:38 -0400787 NEEDS_CRYPTO_WITH_SSL = YesPlease
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700788 NEEDS_SSL_WITH_CRYPTO = YesPlease
789 NEEDS_LIBICONV = YesPlease
Jay Soffian7233d222009-02-05 01:09:08 -0500790 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
Wincent Colaiutafe4aafb2007-12-06 20:07:03 +0100791 OLD_ICONV = UnfortunatelyYes
792 endif
Jay Soffian7233d222009-02-05 01:09:08 -0500793 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
794 NO_STRLCPY = YesPlease
795 endif
Shawn O. Pearce3d594052007-09-09 01:09:17 -0400796 NO_MEMMEM = YesPlease
Brian Gernhardtc5673832009-03-08 16:04:28 -0400797 USE_ST_TIMESPEC = YesPlease
Junio C Hamano597c9cc2005-09-07 12:22:56 -0700798endif
Junio C Hamanof7c15342005-10-09 12:52:35 -0700799ifeq ($(uname_S),SunOS)
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200800 NEEDS_SOCKET = YesPlease
Junio C Hamano5a90d4a2005-09-11 22:25:49 -0700801 NEEDS_NSL = YesPlease
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700802 SHELL_PATH = /bin/bash
Junio C Hamano0e0aea52009-06-05 18:36:15 -0500803 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700804 NO_STRCASESTR = YesPlease
René Scharfeb21b9f12007-09-07 00:32:54 +0200805 NO_MEMMEM = YesPlease
Guido Ostkamp4e0da762007-11-16 19:59:58 +0100806 NO_MKDTEMP = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700807 NO_MKSTEMPS = YesPlease
Jeff Kingee78cac2009-06-16 15:08:21 -0400808 NO_REGEX = YesPlease
Brandon Caseya7a24ee2009-06-05 18:36:16 -0500809 ifeq ($(uname_R),5.7)
810 NEEDS_RESOLV = YesPlease
811 NO_IPV6 = YesPlease
812 NO_SOCKADDR_STORAGE = YesPlease
813 NO_UNSETENV = YesPlease
814 NO_SETENV = YesPlease
815 NO_STRLCPY = YesPlease
816 NO_C99_FORMAT = YesPlease
817 NO_STRTOUMAX = YesPlease
Junio C Hamanoa0c0be92009-05-22 22:55:31 -0700818 endif
Jason Riedye40b61f2005-12-02 15:08:28 -0800819 ifeq ($(uname_R),5.8)
Jason Riedy731043f2006-01-25 12:38:36 -0800820 NO_UNSETENV = YesPlease
Jason Riedye40b61f2005-12-02 15:08:28 -0800821 NO_SETENV = YesPlease
Dennis Stosberg66c45092006-08-15 11:01:22 +0200822 NO_C99_FORMAT = YesPlease
Jason Riedybc6b4f52007-02-19 16:22:56 -0800823 NO_STRTOUMAX = YesPlease
Jason Riedye40b61f2005-12-02 15:08:28 -0800824 endif
Dennis Stosberg40d88d42006-04-11 11:42:26 -0700825 ifeq ($(uname_R),5.9)
826 NO_UNSETENV = YesPlease
827 NO_SETENV = YesPlease
Dennis Stosberg66c45092006-08-15 11:01:22 +0200828 NO_C99_FORMAT = YesPlease
Jason Riedybc6b4f52007-02-19 16:22:56 -0800829 NO_STRTOUMAX = YesPlease
Dennis Stosberg40d88d42006-04-11 11:42:26 -0700830 endif
Brandon Caseyefc07de2009-05-27 21:17:05 -0500831 INSTALL = /usr/ucb/install
Junio C Hamano229a7ed2005-09-23 10:41:40 -0700832 TAR = gtar
Brandon Casey1d7b1af2009-06-19 10:10:39 -0500833 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
Patrick Mauritzf0ebff02005-09-06 01:24:03 +0200834endif
Junio C Hamanof7c15342005-10-09 12:52:35 -0700835ifeq ($(uname_O),Cygwin)
Jonathan Niederecebd1e2010-04-03 02:47:00 -0500836 ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
Eric Blakea50dec22010-04-01 16:43:54 -0600837 NO_D_TYPE_IN_DIRENT = YesPlease
838 NO_D_INO_IN_DIRENT = YesPlease
839 NO_STRCASESTR = YesPlease
840 NO_MEMMEM = YesPlease
841 NO_MKSTEMPS = YesPlease
842 NO_SYMLINK_HEAD = YesPlease
843 NO_IPV6 = YesPlease
844 OLD_ICONV = UnfortunatelyYes
845 endif
hpa17754512005-09-28 16:37:37 -0700846 NEEDS_LIBICONV = YesPlease
Shawn O. Pearce1510fea2006-12-14 06:15:57 -0500847 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
Shawn O. Pearcec8697532006-12-30 23:53:55 -0500848 NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
Ramsay Jones75607872009-11-19 18:46:24 +0000849 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
Junio C Hamano2e67a5f2005-11-17 11:29:47 -0800850 # There are conflicting reports about this.
851 # On some boxes NO_MMAP is needed, and not so elsewhere.
Junio C Hamano87ac1392006-12-27 15:12:31 -0800852 # Try commenting this out if you suspect MMAP is more efficient
853 NO_MMAP = YesPlease
Peter Anvina23cd8e2005-09-28 19:08:37 -0700854 X = .exe
Ramsay Jones035b76b2009-10-27 19:11:55 +0000855 COMPAT_OBJS += compat/cygwin.o
856 UNRELIABLE_FSTAT = UnfortunatelyYes
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -0400857endif
Alecs Kingb3bf9742006-01-27 02:04:30 +0800858ifeq ($(uname_S),FreeBSD)
859 NEEDS_LIBICONV = YesPlease
Junio C Hamano21a0d9b2009-12-26 14:32:36 -0800860 OLD_ICONV = YesPlease
Robert Boonea2f22db2007-09-10 11:43:35 -0500861 NO_MEMMEM = YesPlease
Petr Baudis8d7f5862006-06-25 03:47:03 +0200862 BASIC_CFLAGS += -I/usr/local/include
863 BASIC_LDFLAGS += -L/usr/local/lib
Alex Riesen81a24b52008-03-05 00:15:39 +0100864 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
Jeff King91408042009-03-22 04:08:48 -0400865 USE_ST_TIMESPEC = YesPlease
David M. Syzdek069bb572008-10-26 03:52:47 -0800866 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
David M. Syzdek158629b2008-11-02 14:43:20 -0900867 PTHREAD_LIBS = -pthread
David M. Syzdek069bb572008-10-26 03:52:47 -0800868 NO_UINTMAX_T = YesPlease
869 NO_STRTOUMAX = YesPlease
870 endif
R. Tyler Ballance44211e82010-03-21 12:01:50 -0700871 PYTHON_PATH = /usr/local/bin/python
Alecs Kingb3bf9742006-01-27 02:04:30 +0800872endif
Junio C Hamanof7c15342005-10-09 12:52:35 -0700873ifeq ($(uname_S),OpenBSD)
Junio C Hamano5fb41e82005-10-10 11:51:11 -0700874 NO_STRCASESTR = YesPlease
René Scharfeb21b9f12007-09-07 00:32:54 +0200875 NO_MEMMEM = YesPlease
Tony Kemp90f2e652009-05-14 16:47:41 +1000876 USE_ST_TIMESPEC = YesPlease
Han Boetes18c5a522005-10-01 08:23:26 +0200877 NEEDS_LIBICONV = YesPlease
Petr Baudis8d7f5862006-06-25 03:47:03 +0200878 BASIC_CFLAGS += -I/usr/local/include
879 BASIC_LDFLAGS += -L/usr/local/lib
Junio C Hamano94d23312005-11-13 01:46:13 -0800880endif
881ifeq ($(uname_S),NetBSD)
Dennis Stosberge88856b2006-05-11 19:35:31 +0200882 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
883 NEEDS_LIBICONV = YesPlease
884 endif
Petr Baudis8d7f5862006-06-25 03:47:03 +0200885 BASIC_CFLAGS += -I/usr/pkg/include
Junio C Hamanof5b904d2008-08-16 21:56:24 -0700886 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
Patrick Welche9a695fb2009-04-26 14:49:00 +0100887 USE_ST_TIMESPEC = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700888 NO_MKSTEMPS = YesPlease
Han Boetes18c5a522005-10-01 08:23:26 +0200889endif
Jason Riedya6da9392005-12-06 14:20:16 -0800890ifeq ($(uname_S),AIX)
891 NO_STRCASESTR=YesPlease
René Scharfeb21b9f12007-09-07 00:32:54 +0200892 NO_MEMMEM = YesPlease
Mike Ralphson377d9c42008-05-07 09:35:55 +0100893 NO_MKDTEMP = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700894 NO_MKSTEMPS = YesPlease
Peter Eriksen817151e2006-06-24 16:01:25 +0200895 NO_STRLCPY = YesPlease
Kjetil Barvikc06ff492009-03-04 18:47:40 +0100896 NO_NSEC = YesPlease
Mike Ralphson377d9c42008-05-07 09:35:55 +0100897 FREAD_READS_DIRECTORIES = UnfortunatelyYes
898 INTERNAL_QSORT = UnfortunatelyYes
Jason Riedya6da9392005-12-06 14:20:16 -0800899 NEEDS_LIBICONV=YesPlease
Mike Ralphson377d9c42008-05-07 09:35:55 +0100900 BASIC_CFLAGS += -D_LARGE_FILES
Dan McGee7eb151d2010-01-29 19:22:19 -0600901 ifeq ($(shell expr "$(uname_V)" : '[1234]'),1)
Junio C Hamano46059cc2008-11-15 04:08:14 -0800902 NO_PTHREADS = YesPlease
Gary V. Vaughan48793cf2010-05-14 09:31:34 +0000903 else
904 PTHREAD_LIBS = -lpthread
Junio C Hamano46059cc2008-11-15 04:08:14 -0800905 endif
Jason Riedya6da9392005-12-06 14:20:16 -0800906endif
Thomas Schwingec29ba0c2007-08-02 10:56:42 +0200907ifeq ($(uname_S),GNU)
908 # GNU/Hurd
909 NO_STRLCPY=YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700910 NO_MKSTEMPS = YesPlease
Thomas Schwingec29ba0c2007-08-02 10:56:42 +0200911endif
Brandon Casey1fdffc12009-07-10 12:10:46 -0500912ifeq ($(uname_S),IRIX)
913 NO_SETENV = YesPlease
914 NO_UNSETENV = YesPlease
915 NO_STRCASESTR = YesPlease
916 NO_MEMMEM = YesPlease
917 NO_MKSTEMPS = YesPlease
918 NO_MKDTEMP = YesPlease
Brandon Casey651aef32009-10-08 19:09:37 -0500919 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
920 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
921 # git dies with a segmentation fault when trying to access the first
922 # entry of a reflog. The conservative choice is made to always set
923 # NO_MMAP. If you suspect that your compiler is not affected by this
924 # issue, comment out the NO_MMAP statement.
Brandon Casey1fdffc12009-07-10 12:10:46 -0500925 NO_MMAP = YesPlease
Brandon Casey1fdffc12009-07-10 12:10:46 -0500926 SNPRINTF_RETURNS_BOGUS = YesPlease
927 SHELL_PATH = /usr/gnu/bin/bash
928 NEEDS_LIBGEN = YesPlease
929endif
Johannes Schindelin289c4b32006-02-17 15:23:41 +0100930ifeq ($(uname_S),IRIX64)
Johannes Schindelin289c4b32006-02-17 15:23:41 +0100931 NO_SETENV=YesPlease
Brandon Casey7c74ff52009-07-10 13:31:19 -0500932 NO_UNSETENV = YesPlease
Johannes Schindelin289c4b32006-02-17 15:23:41 +0100933 NO_STRCASESTR=YesPlease
René Scharfeb21b9f12007-09-07 00:32:54 +0200934 NO_MEMMEM = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700935 NO_MKSTEMPS = YesPlease
Brandon Casey7c74ff52009-07-10 13:31:19 -0500936 NO_MKDTEMP = YesPlease
Brandon Casey651aef32009-10-08 19:09:37 -0500937 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
938 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
939 # git dies with a segmentation fault when trying to access the first
940 # entry of a reflog. The conservative choice is made to always set
941 # NO_MMAP. If you suspect that your compiler is not affected by this
942 # issue, comment out the NO_MMAP statement.
Brandon Casey7c74ff52009-07-10 13:31:19 -0500943 NO_MMAP = YesPlease
Brandon Casey7c74ff52009-07-10 13:31:19 -0500944 SNPRINTF_RETURNS_BOGUS = YesPlease
Johannes Schindelin289c4b32006-02-17 15:23:41 +0100945 SHELL_PATH=/usr/gnu/bin/bash
Brandon Casey7c74ff52009-07-10 13:31:19 -0500946 NEEDS_LIBGEN = YesPlease
Johannes Schindelin289c4b32006-02-17 15:23:41 +0100947endif
Robert Schiele81cc66a2008-01-24 19:35:20 +0100948ifeq ($(uname_S),HP-UX)
949 NO_IPV6=YesPlease
950 NO_SETENV=YesPlease
951 NO_STRCASESTR=YesPlease
952 NO_MEMMEM = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -0700953 NO_MKSTEMPS = YesPlease
Robert Schiele81cc66a2008-01-24 19:35:20 +0100954 NO_STRLCPY = YesPlease
955 NO_MKDTEMP = YesPlease
956 NO_UNSETENV = YesPlease
957 NO_HSTRERROR = YesPlease
958 NO_SYS_SELECT_H = YesPlease
Miklos Vajna7d770162008-08-24 00:07:55 +0200959 SNPRINTF_RETURNS_BOGUS = YesPlease
Robert Schiele81cc66a2008-01-24 19:35:20 +0100960endif
Ramsay Jonesd691d842009-11-07 20:08:01 +0000961ifeq ($(uname_S),Windows)
Marius Storm-Olsenf5c31782009-09-16 10:20:31 +0200962 GIT_VERSION := $(GIT_VERSION).MSVC
Marius Storm-Olsen164a5e32009-09-16 10:20:28 +0200963 pathsep = ;
964 NO_PREAD = YesPlease
Marius Storm-Olsenc36e1632009-10-21 19:04:51 +0200965 NEEDS_CRYPTO_WITH_SSL = YesPlease
Marius Storm-Olsen164a5e32009-09-16 10:20:28 +0200966 NO_LIBGEN_H = YesPlease
967 NO_SYMLINK_HEAD = YesPlease
968 NO_IPV6 = YesPlease
969 NO_SETENV = YesPlease
970 NO_UNSETENV = YesPlease
971 NO_STRCASESTR = YesPlease
972 NO_STRLCPY = YesPlease
973 NO_MEMMEM = YesPlease
974 # NEEDS_LIBICONV = YesPlease
975 NO_ICONV = YesPlease
976 NO_C99_FORMAT = YesPlease
977 NO_STRTOUMAX = YesPlease
978 NO_STRTOULL = YesPlease
979 NO_MKDTEMP = YesPlease
980 NO_MKSTEMPS = YesPlease
981 SNPRINTF_RETURNS_BOGUS = YesPlease
982 NO_SVN_TESTS = YesPlease
983 NO_PERL_MAKEMAKER = YesPlease
984 RUNTIME_PREFIX = YesPlease
985 NO_POSIX_ONLY_PROGRAMS = YesPlease
986 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
987 NO_NSEC = YesPlease
988 USE_WIN32_MMAP = YesPlease
989 # USE_NED_ALLOCATOR = YesPlease
990 UNRELIABLE_FSTAT = UnfortunatelyYes
991 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
992 NO_REGEX = YesPlease
993 NO_CURL = YesPlease
Erik Faye-Lund56932242010-01-15 21:12:15 +0100994 NO_PYTHON = YesPlease
Johannes Sixt9bccfcd2009-10-22 20:26:29 +0200995 BLK_SHA1 = YesPlease
Marius Storm-Olsen164a5e32009-09-16 10:20:28 +0200996
997 CC = compat/vcbuild/scripts/clink.pl
998 AR = compat/vcbuild/scripts/lib.pl
999 CFLAGS =
Ramsay Jonesf2d50d92009-10-08 16:21:44 +01001000 BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
Andrzej K. Haczewski44626dc2010-01-15 21:12:20 +01001001 COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
1002 COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
Marius Storm-Olsen164a5e32009-09-16 10:20:28 +02001003 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
1004 EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
Michael Lukashov767f8b32010-01-24 10:10:30 +00001005 PTHREAD_LIBS =
Marius Storm-Olsen164a5e32009-09-16 10:20:28 +02001006 lib =
1007ifndef DEBUG
1008 BASIC_CFLAGS += -GL -Os -MT
1009 BASIC_LDFLAGS += -LTCG
1010 AR += -LTCG
1011else
1012 BASIC_CFLAGS += -Zi -MTd
1013endif
1014 X = .exe
Ramsay Jonesd691d842009-11-07 20:08:01 +00001015endif
Johannes Sixtf4626df2007-12-01 21:24:59 +01001016ifneq (,$(findstring MINGW,$(uname_S)))
Johannes Schindelin352c8112009-05-23 10:04:48 +02001017 pathsep = ;
Johannes Sixtf4626df2007-12-01 21:24:59 +01001018 NO_PREAD = YesPlease
Erik Faye-Lund4192e1c2009-10-21 19:04:50 +02001019 NEEDS_CRYPTO_WITH_SSL = YesPlease
David Aguilare1c06882009-05-31 01:35:51 -07001020 NO_LIBGEN_H = YesPlease
Johannes Sixtf4626df2007-12-01 21:24:59 +01001021 NO_SYMLINK_HEAD = YesPlease
Johannes Sixtf4626df2007-12-01 21:24:59 +01001022 NO_SETENV = YesPlease
1023 NO_UNSETENV = YesPlease
1024 NO_STRCASESTR = YesPlease
1025 NO_STRLCPY = YesPlease
1026 NO_MEMMEM = YesPlease
1027 NEEDS_LIBICONV = YesPlease
1028 OLD_ICONV = YesPlease
1029 NO_C99_FORMAT = YesPlease
1030 NO_STRTOUMAX = YesPlease
1031 NO_MKDTEMP = YesPlease
David Aguilar0620b392009-05-31 01:35:50 -07001032 NO_MKSTEMPS = YesPlease
Johannes Sixtf4626df2007-12-01 21:24:59 +01001033 SNPRINTF_RETURNS_BOGUS = YesPlease
1034 NO_SVN_TESTS = YesPlease
1035 NO_PERL_MAKEMAKER = YesPlease
Steffen Prohaska25655222009-01-18 13:00:15 +01001036 RUNTIME_PREFIX = YesPlease
Johannes Sixtf4626df2007-12-01 21:24:59 +01001037 NO_POSIX_ONLY_PROGRAMS = YesPlease
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001038 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001039 NO_NSEC = YesPlease
Janos Laubeb130a722009-03-13 16:50:45 +01001040 USE_WIN32_MMAP = YesPlease
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001041 USE_NED_ALLOCATOR = YesPlease
Johannes Sixt34779c52009-04-20 10:17:00 +02001042 UNRELIABLE_FSTAT = UnfortunatelyYes
Johannes Schindelin348df162009-04-28 00:32:25 +02001043 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
Jeff King02232ad2009-06-16 15:07:40 -04001044 NO_REGEX = YesPlease
Erik Faye-Lund56932242010-01-15 21:12:15 +01001045 NO_PYTHON = YesPlease
Johannes Sixt9bccfcd2009-10-22 20:26:29 +02001046 BLK_SHA1 = YesPlease
Michael Lukashov767f8b32010-01-24 10:10:30 +00001047 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
Johannes Sixt23326d12007-12-08 20:57:25 +01001048 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
Andrzej K. Haczewski44626dc2010-01-15 21:12:20 +01001049 COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
1050 compat/win32/pthread.o
Johannes Sixtf4626df2007-12-01 21:24:59 +01001051 EXTLIBS += -lws2_32
Michael Lukashov767f8b32010-01-24 10:10:30 +00001052 PTHREAD_LIBS =
Johannes Sixtf4626df2007-12-01 21:24:59 +01001053 X = .exe
Steffen Prohaska48c46f12009-05-31 18:15:25 +02001054ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
1055 htmldir=doc/git/html/
1056 prefix =
1057 INSTALL = /bin/install
1058 EXTLIBS += /mingw/lib/libz.a
1059 NO_R_TO_GCC_LINKER = YesPlease
1060 INTERNAL_QSORT = YesPlease
Steffen Prohaska48c46f12009-05-31 18:15:25 +02001061else
1062 NO_CURL = YesPlease
Steffen Prohaska48c46f12009-05-31 18:15:25 +02001063endif
Johannes Sixtf4626df2007-12-01 21:24:59 +01001064endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001065
Jakub Narebski55667712006-07-03 01:56:48 +02001066-include config.mak.autogen
Johannes Schindelinf2d6a252005-10-11 15:22:47 -07001067-include config.mak
Linus Torvaldscef661f2005-04-21 12:33:22 -07001068
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001069ifdef CHECK_HEADER_DEPENDENCIES
1070USE_COMPUTED_HEADER_DEPENDENCIES =
1071endif
1072
1073ifdef COMPUTE_HEADER_DEPENDENCIES
1074USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
1075endif
1076
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001077ifdef SANE_TOOL_PATH
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001078SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1079BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001080PATH := $(SANE_TOOL_PATH):${PATH}
1081else
Junio C Hamano61dbb3c2009-06-08 09:41:49 -07001082BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
Junio C Hamano0e0aea52009-06-05 18:36:15 -05001083endif
1084
Brian Gernhardt59f86742006-12-12 12:01:47 -05001085ifeq ($(uname_S),Darwin)
1086 ifndef NO_FINK
1087 ifeq ($(shell test -d /sw/lib && echo y),y)
1088 BASIC_CFLAGS += -I/sw/include
1089 BASIC_LDFLAGS += -L/sw/lib
1090 endif
1091 endif
1092 ifndef NO_DARWIN_PORTS
1093 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1094 BASIC_CFLAGS += -I/opt/local/include
1095 BASIC_LDFLAGS += -L/opt/local/lib
1096 endif
1097 endif
Ted Pavlicf7d9d042009-01-26 14:03:59 -05001098 PTHREAD_LIBS =
Brian Gernhardt59f86742006-12-12 12:01:47 -05001099endif
1100
Junio C Hamanof5b904d2008-08-16 21:56:24 -07001101ifndef CC_LD_DYNPATH
1102 ifdef NO_R_TO_GCC_LINKER
1103 # Some gcc does not accept and pass -R to the linker to specify
1104 # the runtime dynamic library path.
1105 CC_LD_DYNPATH = -Wl,-rpath,
1106 else
1107 CC_LD_DYNPATH = -R
1108 endif
Junio C Hamanobbfc63d2006-12-27 14:17:35 -08001109endif
1110
David Aguilare1c06882009-05-31 01:35:51 -07001111ifdef NO_LIBGEN_H
1112 COMPAT_CFLAGS += -DNO_LIBGEN_H
1113 COMPAT_OBJS += compat/basename.o
1114endif
1115
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001116ifdef NO_CURL
1117 BASIC_CFLAGS += -DNO_CURL
Johannes Sixt4256f362010-01-19 16:39:12 +01001118 REMOTE_CURL_PRIMARY =
1119 REMOTE_CURL_ALIASES =
1120 REMOTE_CURL_NAMES =
Daniel Barkalow30ae7642007-09-10 23:02:45 -04001121else
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001122 ifdef CURLDIR
Robert Schiele10861be2007-08-01 06:30:35 +02001123 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
Petr Baudis8d7f5862006-06-25 03:47:03 +02001124 BASIC_CFLAGS += -I$(CURLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001125 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001126 else
1127 CURL_LIBCURL = -lcurl
1128 endif
Johannes Sixt4256f362010-01-19 16:39:12 +01001129 REMOTE_CURL_PRIMARY = git-remote-http$X
1130 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1131 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001132 PROGRAM_OBJS += http-fetch.o
1133 PROGRAMS += $(REMOTE_CURL_NAMES)
Nick Hengeveld08900982005-11-18 17:08:36 -08001134 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
1135 ifeq "$(curl_check)" "070908"
1136 ifndef NO_EXPAT
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001137 PROGRAM_OBJS += http-push.o
Nick Hengeveld08900982005-11-18 17:08:36 -08001138 endif
Nick Hengeveld58e60dd2005-11-02 11:19:24 -08001139 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001140 ifndef NO_EXPAT
Serge van den Boom85b45182009-01-28 21:43:57 +01001141 ifdef EXPATDIR
1142 BASIC_CFLAGS += -I$(EXPATDIR)/include
1143 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1144 else
1145 EXPAT_LIBEXPAT = -lexpat
1146 endif
Johannes Schindelin459a21b2006-04-05 16:22:40 +02001147 endif
Junio C Hamano229a7ed2005-09-23 10:41:40 -07001148endif
1149
Robert Schielebef19da2007-07-29 20:35:45 +02001150ifdef ZLIB_PATH
1151 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001152 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
Robert Schielebef19da2007-07-29 20:35:45 +02001153endif
1154EXTLIBS += -lz
1155
Johannes Sixt58eda022007-12-01 11:10:54 +01001156ifndef NO_POSIX_ONLY_PROGRAMS
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001157 PROGRAM_OBJS += daemon.o
Johannes Sixt58eda022007-12-01 11:10:54 +01001158endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001159ifndef NO_OPENSSL
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001160 OPENSSL_LIBSSL = -lssl
Junio C Hamano455a7f32005-09-30 13:31:16 -07001161 ifdef OPENSSLDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001162 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001163 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001164 else
1165 OPENSSL_LINK =
1166 endif
Brian Gernhardt0460dba2009-09-08 09:54:38 -04001167 ifdef NEEDS_CRYPTO_WITH_SSL
1168 OPENSSL_LINK += -lcrypto
1169 endif
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001170else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001171 BASIC_CFLAGS += -DNO_OPENSSL
Nicolas Pitre30ae47b2009-08-17 20:09:56 -04001172 BLK_SHA1 = 1
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001173 OPENSSL_LIBSSL =
Petr Baudisdd53c7a2005-07-29 17:50:51 +02001174endif
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001175ifdef NEEDS_SSL_WITH_CRYPTO
Junio C Hamano455a7f32005-09-30 13:31:16 -07001176 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001177else
Junio C Hamano455a7f32005-09-30 13:31:16 -07001178 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001179endif
1180ifdef NEEDS_LIBICONV
Junio C Hamano455a7f32005-09-30 13:31:16 -07001181 ifdef ICONVDIR
Petr Baudis8d7f5862006-06-25 03:47:03 +02001182 BASIC_CFLAGS += -I$(ICONVDIR)/include
Robert Schiele10861be2007-08-01 06:30:35 +02001183 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
Junio C Hamano455a7f32005-09-30 13:31:16 -07001184 else
1185 ICONV_LINK =
1186 endif
Petr Baudisd595a472006-06-24 18:35:12 -07001187 EXTLIBS += $(ICONV_LINK) -liconv
Junio C Hamano597c9cc2005-09-07 12:22:56 -07001188endif
Brandon Caseyecc395c2009-07-10 12:10:45 -05001189ifdef NEEDS_LIBGEN
1190 EXTLIBS += -lgen
1191endif
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001192ifdef NEEDS_SOCKET
Petr Baudisd595a472006-06-24 18:35:12 -07001193 EXTLIBS += -lsocket
Patrick Mauritzf0ebff02005-09-06 01:24:03 +02001194endif
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001195ifdef NEEDS_NSL
Petr Baudisd595a472006-06-24 18:35:12 -07001196 EXTLIBS += -lnsl
Junio C Hamano5a90d4a2005-09-11 22:25:49 -07001197endif
Brandon Casey70cf9912009-06-05 18:36:10 -05001198ifdef NEEDS_RESOLV
1199 EXTLIBS += -lresolv
1200endif
Junio C Hamano63be37b2006-01-19 17:13:57 -08001201ifdef NO_D_TYPE_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001202 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
Junio C Hamano63be37b2006-01-19 17:13:57 -08001203endif
Junio C Hamano35a730f2006-01-19 17:13:51 -08001204ifdef NO_D_INO_IN_DIRENT
Petr Baudis8d7f5862006-06-25 03:47:03 +02001205 BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
Junio C Hamano35a730f2006-01-19 17:13:51 -08001206endif
Junio C Hamanofdb2a2a2008-08-18 21:57:16 +02001207ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1208 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1209endif
Brian Gernhardtd7371a22009-03-08 17:22:51 -04001210ifdef USE_NSEC
1211 BASIC_CFLAGS += -DUSE_NSEC
1212endif
Brian Gernhardtc5673832009-03-08 16:04:28 -04001213ifdef USE_ST_TIMESPEC
1214 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1215endif
Kjetil Barvikc06ff492009-03-04 18:47:40 +01001216ifdef NO_NSEC
1217 BASIC_CFLAGS += -DNO_NSEC
1218endif
Ramsay Allan Jones579d1fb2006-07-30 16:38:28 +01001219ifdef NO_C99_FORMAT
Junio C Hamano8188e732007-02-05 16:53:12 -08001220 BASIC_CFLAGS += -DNO_C99_FORMAT
Ramsay Allan Jones579d1fb2006-07-30 16:38:28 +01001221endif
Michal Rokosc4582f92008-03-05 16:46:13 +01001222ifdef SNPRINTF_RETURNS_BOGUS
1223 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1224 COMPAT_OBJS += compat/snprintf.o
1225endif
Brandon Caseycba22522008-02-08 20:32:47 -06001226ifdef FREAD_READS_DIRECTORIES
1227 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1228 COMPAT_OBJS += compat/fopen.o
1229endif
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001230ifdef NO_SYMLINK_HEAD
Petr Baudis8d7f5862006-06-25 03:47:03 +02001231 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
Junio C Hamano9f0bb902006-05-02 00:40:24 -07001232endif
Linus Torvaldsef34af22005-09-18 18:30:50 -07001233ifdef NO_STRCASESTR
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001234 COMPAT_CFLAGS += -DNO_STRCASESTR
Jason Riedye40b61f2005-12-02 15:08:28 -08001235 COMPAT_OBJS += compat/strcasestr.o
1236endif
Peter Eriksen817151e2006-06-24 16:01:25 +02001237ifdef NO_STRLCPY
1238 COMPAT_CFLAGS += -DNO_STRLCPY
1239 COMPAT_OBJS += compat/strlcpy.o
1240endif
Jason Riedybc6b4f52007-02-19 16:22:56 -08001241ifdef NO_STRTOUMAX
1242 COMPAT_CFLAGS += -DNO_STRTOUMAX
1243 COMPAT_OBJS += compat/strtoumax.o
1244endif
1245ifdef NO_STRTOULL
1246 COMPAT_CFLAGS += -DNO_STRTOULL
1247endif
Jason Riedye40b61f2005-12-02 15:08:28 -08001248ifdef NO_SETENV
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001249 COMPAT_CFLAGS += -DNO_SETENV
Jason Riedye40b61f2005-12-02 15:08:28 -08001250 COMPAT_OBJS += compat/setenv.o
Linus Torvaldsef34af22005-09-18 18:30:50 -07001251endif
Shawn O. Pearceca5bb5d2007-10-20 16:03:49 -04001252ifdef NO_MKDTEMP
1253 COMPAT_CFLAGS += -DNO_MKDTEMP
1254 COMPAT_OBJS += compat/mkdtemp.o
1255endif
David Aguilar0620b392009-05-31 01:35:50 -07001256ifdef NO_MKSTEMPS
1257 COMPAT_CFLAGS += -DNO_MKSTEMPS
David Aguilar0620b392009-05-31 01:35:50 -07001258endif
Johannes Schindelin104ff342006-08-29 12:51:14 +02001259ifdef NO_UNSETENV
Jason Riedy731043f2006-01-25 12:38:36 -08001260 COMPAT_CFLAGS += -DNO_UNSETENV
1261 COMPAT_OBJS += compat/unsetenv.o
1262endif
Robert Schiele26009732008-01-24 19:34:46 +01001263ifdef NO_SYS_SELECT_H
1264 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1265endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001266ifdef NO_MMAP
Junio C Hamano4050c0d2005-12-05 11:54:29 -08001267 COMPAT_CFLAGS += -DNO_MMAP
Jason Riedye40b61f2005-12-02 15:08:28 -08001268 COMPAT_OBJS += compat/mmap.o
Janos Laubeb130a722009-03-13 16:50:45 +01001269else
1270 ifdef USE_WIN32_MMAP
1271 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1272 COMPAT_OBJS += compat/win32mmap.o
1273 endif
Johannes Schindelin730d48a2005-10-08 15:54:36 -07001274endif
Johannes Schindelin348df162009-04-28 00:32:25 +02001275ifdef OBJECT_CREATION_USES_RENAMES
1276 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
Johannes Schindelinbe66a6c2009-04-25 11:57:14 +02001277endif
Stefan-W. Hahn69006792007-01-09 22:04:12 +01001278ifdef NO_PREAD
1279 COMPAT_CFLAGS += -DNO_PREAD
1280 COMPAT_OBJS += compat/pread.o
1281endif
Shawn O. Pearce1510fea2006-12-14 06:15:57 -05001282ifdef NO_FAST_WORKING_DIRECTORY
1283 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1284endif
Shawn O. Pearcec8697532006-12-30 23:53:55 -05001285ifdef NO_TRUSTABLE_FILEMODE
1286 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1287endif
hpa49744d62005-09-28 16:52:21 -07001288ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001289 BASIC_CFLAGS += -DNO_IPV6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001290endif
David M. Syzdek0bc3e782008-10-26 03:52:37 -08001291ifdef NO_UINTMAX_T
1292 BASIC_CFLAGS += -Duintmax_t=uint32_t
1293endif
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001294ifdef NO_SOCKADDR_STORAGE
1295ifdef NO_IPV6
Petr Baudis8d7f5862006-06-25 03:47:03 +02001296 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001297else
Petr Baudis8d7f5862006-06-25 03:47:03 +02001298 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
Junio C Hamanobdc37f52006-01-19 17:13:32 -08001299endif
hpa49744d62005-09-28 16:52:21 -07001300endif
Yakov Lerner6ba68ab2006-05-22 00:37:00 +03001301ifdef NO_INET_NTOP
1302 LIB_OBJS += compat/inet_ntop.o
1303endif
Jon Loeligerdd467622006-09-26 09:47:43 -05001304ifdef NO_INET_PTON
1305 LIB_OBJS += compat/inet_pton.o
1306endif
Linus Torvaldscef661f2005-04-21 12:33:22 -07001307
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001308ifdef NO_ICONV
Petr Baudis8d7f5862006-06-25 03:47:03 +02001309 BASIC_CFLAGS += -DNO_ICONV
Fernando J. Peredab6e56ec2006-02-16 09:38:01 +01001310endif
1311
Ramsay Jonesfd547a92007-03-03 18:29:03 +00001312ifdef OLD_ICONV
1313 BASIC_CFLAGS += -DOLD_ICONV
1314endif
1315
David Symonds609a2282007-11-07 14:24:28 +11001316ifdef NO_DEFLATE_BOUND
1317 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1318endif
1319
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001320ifdef BLK_SHA1
1321 SHA1_HEADER = "block-sha1/sha1.h"
1322 LIB_OBJS += block-sha1/sha1.o
Jonathan Nieder21528ab2010-01-26 09:44:47 -06001323 LIB_H += block-sha1/sha1.h
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001324else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001325ifdef PPC_SHA1
1326 SHA1_HEADER = "ppc/sha1.h"
1327 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
Jonathan Nieder21528ab2010-01-26 09:44:47 -06001328 LIB_H += ppc/sha1.h
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001329else
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001330 SHA1_HEADER = <openssl/sha.h>
Petr Baudisd595a472006-06-24 18:35:12 -07001331 EXTLIBS += $(LIB_4_CRYPTO)
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001332endif
1333endif
Alex Riesenf8487182006-12-04 10:50:04 +01001334ifdef NO_PERL_MAKEMAKER
1335 export NO_PERL_MAKEMAKER
1336endif
Alex Riesenfa0c87c2007-06-13 20:54:32 +02001337ifdef NO_HSTRERROR
1338 COMPAT_CFLAGS += -DNO_HSTRERROR
1339 COMPAT_OBJS += compat/hstrerror.o
1340endif
René Scharfeb21b9f12007-09-07 00:32:54 +02001341ifdef NO_MEMMEM
1342 COMPAT_CFLAGS += -DNO_MEMMEM
1343 COMPAT_OBJS += compat/memmem.o
1344endif
Brian Downing43fe9012008-02-05 15:10:44 -06001345ifdef INTERNAL_QSORT
1346 COMPAT_CFLAGS += -DINTERNAL_QSORT
1347 COMPAT_OBJS += compat/qsort.o
1348endif
Steffen Prohaska35fb0e862009-01-18 13:00:14 +01001349ifdef RUNTIME_PREFIX
1350 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1351endif
Alex Riesenb7774342007-03-07 00:44:49 +01001352
Junio C Hamano46059cc2008-11-15 04:08:14 -08001353ifdef NO_PTHREADS
Junio C Hamano46059cc2008-11-15 04:08:14 -08001354 BASIC_CFLAGS += -DNO_PTHREADS
1355else
Gary V. Vaughan48793cf2010-05-14 09:31:34 +00001356 BASIC_CFLAGS += $(PTHREAD_CFLAGS)
Junio C Hamano46059cc2008-11-15 04:08:14 -08001357 EXTLIBS += $(PTHREAD_LIBS)
Andreas Ericsson833e3df2008-02-22 20:11:56 -06001358 LIB_OBJS += thread-utils.o
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001359endif
Dan McGee7eb151d2010-01-29 19:22:19 -06001360
Alex Riesen81a24b52008-03-05 00:15:39 +01001361ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1362 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1363endif
Johannes Sixt34779c52009-04-20 10:17:00 +02001364ifdef UNRELIABLE_FSTAT
1365 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1366endif
Jeff King02232ad2009-06-16 15:07:40 -04001367ifdef NO_REGEX
1368 COMPAT_CFLAGS += -Icompat/regex
1369 COMPAT_OBJS += compat/regex/regex.o
1370endif
Nicolas Pitre8ecce682007-09-06 02:13:11 -04001371
Marius Storm-Olsenf0ed8222009-05-31 18:15:23 +02001372ifdef USE_NED_ALLOCATOR
1373 COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
1374 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1375endif
1376
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001377ifeq ($(TCLTK_PATH),)
1378NO_TCLTK=NoThanks
1379endif
1380
Jeff King499c2932009-04-03 15:32:20 -04001381ifeq ($(PERL_PATH),)
1382NO_PERL=NoThanks
1383endif
1384
Johan Herlandd4e1b472009-11-18 02:42:31 +01001385ifeq ($(PYTHON_PATH),)
1386NO_PYTHON=NoThanks
1387endif
1388
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001389QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
Alex Riesenb7774342007-03-07 00:44:49 +01001390QUIET_SUBDIR1 =
1391
Alex Riesena6f37092007-03-07 00:05:34 +01001392ifneq ($(findstring $(MAKEFLAGS),w),w)
1393PRINT_DIR = --no-print-directory
1394else # "make -w"
1395NO_SUBDIR = :
1396endif
1397
Alex Riesenb7774342007-03-07 00:44:49 +01001398ifneq ($(findstring $(MAKEFLAGS),s),s)
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001399ifndef V
Alex Riesen31d03992007-03-06 23:37:18 +01001400 QUIET_CC = @echo ' ' CC $@;
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001401 QUIET_AR = @echo ' ' AR $@;
1402 QUIET_LINK = @echo ' ' LINK $@;
1403 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1404 QUIET_GEN = @echo ' ' GEN $@;
Junio C Hamano611c7f62009-08-06 22:08:09 -07001405 QUIET_LNCP = @echo ' ' LN/CP $@;
Fernando J. Pereda3b486cd2007-04-04 22:42:33 +02001406 QUIET_SUBDIR0 = +@subdir=
Alex Riesena6f37092007-03-07 00:05:34 +01001407 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1408 $(MAKE) $(PRINT_DIR) -C $$subdir
Shawn O. Pearce2314c942007-03-06 02:09:14 -05001409 export V
Alex Riesen31d03992007-03-06 23:37:18 +01001410 export QUIET_GEN
Alex Riesenb7774342007-03-07 00:44:49 +01001411 export QUIET_BUILT_IN
1412endif
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001413endif
Nicolas Pitre7c6ef2f2005-09-20 12:27:13 -04001414
Junio C Hamano4c7100a2007-06-14 22:20:16 -07001415ifdef ASCIIDOC8
1416 export ASCIIDOC8
1417endif
1418
Pavel Roskinaddf88e2006-07-09 03:44:30 -04001419# Shell quote (do not use $(call) to accommodate ancient setups);
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001420
1421SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
Johannes Schindelin32043c92007-02-14 12:48:14 +01001422ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001423
1424DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1425bindir_SQ = $(subst ','\'',$(bindir))
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001426bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
Sergei Organov8e566f22007-12-06 21:33:01 +03001427mandir_SQ = $(subst ','\'',$(mandir))
Junio C Hamanoa149a1a2007-12-10 01:35:29 -08001428infodir_SQ = $(subst ','\'',$(infodir))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001429gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
1430template_dir_SQ = $(subst ','\'',$(template_dir))
Christian Couder5d6491c2007-12-02 06:07:55 +01001431htmldir_SQ = $(subst ','\'',$(htmldir))
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001432prefix_SQ = $(subst ','\'',$(prefix))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001433
1434SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1435PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
Johan Herlandd4e1b472009-11-18 02:42:31 +01001436PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
Eygene Ryabinkin81b63c72007-03-28 04:12:07 -07001437TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001438
Petr Baudisd595a472006-06-24 18:35:12 -07001439LIBS = $(GITLIBS) $(EXTLIBS)
1440
Johannes Schindelin32043c92007-02-14 12:48:14 +01001441BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
Johannes Sixt506b17b2007-11-13 21:05:05 +01001442 $(COMPAT_CFLAGS)
Jason Riedye40b61f2005-12-02 15:08:28 -08001443LIB_OBJS += $(COMPAT_OBJS)
Petr Baudis8d7f5862006-06-25 03:47:03 +02001444
Jonathan Nieder8f4b5762009-10-30 20:44:41 -05001445# Quote for C
1446
1447ifdef DEFAULT_EDITOR
1448DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
1449DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
1450
1451BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
1452endif
1453
Junio C Hamanoa3d023d2009-10-30 20:45:34 -05001454ifdef DEFAULT_PAGER
1455DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
1456DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
1457
1458BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
1459endif
1460
Petr Baudis8d7f5862006-06-25 03:47:03 +02001461ALL_CFLAGS += $(BASIC_CFLAGS)
1462ALL_LDFLAGS += $(BASIC_LDFLAGS)
1463
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00001464export DIFF TAR INSTALL DESTDIR SHELL_PATH
Petr Baudisd595a472006-06-24 18:35:12 -07001465
1466
Petr Baudis28818ff2005-07-29 17:50:24 +02001467### Build rules
Linus Torvalds89967022005-04-30 13:19:56 -07001468
Brandon Caseyc94c8e52008-08-07 14:03:42 -05001469SHELL = $(SHELL_PATH)
1470
Jonathan Nieder46bac902010-01-31 11:46:53 -08001471all:: shell_compatibility_test $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001472ifneq (,$X)
Sebastian Schuberthade2ca02009-10-27 12:23:33 +01001473 $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001474endif
Petr Baudis28818ff2005-07-29 17:50:24 +02001475
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001476all::
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001477ifndef NO_TCLTK
Junio C Hamanoe84a0632008-07-28 00:02:48 -07001478 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
Junio C Hamano62ba5142007-11-17 10:51:16 -08001479 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001480endif
Jeff King499c2932009-04-03 15:32:20 -04001481ifndef NO_PERL
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001482 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
Jeff King499c2932009-04-03 15:32:20 -04001483endif
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01001484ifndef NO_PYTHON
1485 $(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
1486endif
Ben Walton502be952010-03-20 10:48:08 -04001487 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
Nicolas Pitrea310d432005-05-19 10:27:14 -04001488
Brandon Casey6dc46272008-08-07 14:06:26 -05001489please_set_SHELL_PATH_to_a_more_modern_shell:
1490 @$$(:)
1491
1492shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
1493
Junio C Hamano4dc00022006-01-12 21:42:25 -08001494strip: $(PROGRAMS) git$X
1495 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
1496
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06001497git.o: common-cmds.h
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001498git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06001499 '-DGIT_HTML_PATH="$(htmldir_SQ)"'
Junio C Hamano334d28a2007-06-13 01:28:21 -07001500
1501git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
Matt McCutchen54dadbd2007-07-09 21:30:39 -04001502 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
Linus Torvalds70827b12006-04-21 10:27:34 -07001503 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
Junio C Hamano6a2e50f2005-09-07 21:26:52 -07001504
Linus Torvalds81b50f32010-02-22 08:42:18 -08001505builtin/help.o: common-cmds.h
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001506builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06001507 '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
1508 '-DGIT_MAN_PATH="$(mandir_SQ)"' \
1509 '-DGIT_INFO_PATH="$(infodir_SQ)"'
Junio C Hamano08df6172006-04-21 21:56:13 -07001510
Junio C Hamano91730802006-04-10 17:37:58 -07001511$(BUILT_INS): git$X
Andreas Färber3e073dc2008-08-25 17:33:03 +02001512 $(QUIET_BUILT_IN)$(RM) $@ && \
1513 ln git$X $@ 2>/dev/null || \
1514 ln -s git$X $@ 2>/dev/null || \
1515 cp git$X $@
Junio C Hamano91730802006-04-10 17:37:58 -07001516
Junio C Hamano79d30662007-12-01 23:39:19 -08001517common-cmds.h: ./generate-cmdlist.sh command-list.txt
Junio C Hamano48dd1da2007-06-13 02:00:01 -07001518
Junio C Hamano766b0842007-04-05 15:03:48 -07001519common-cmds.h: $(wildcard Documentation/git-*.txt)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001520 $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
Fredrik Kuivinena87cd022006-03-09 17:24:19 +01001521
Jonathan Nieder46bac902010-01-31 11:46:53 -08001522define cmd_munge_script
1523$(RM) $@ $@+ && \
1524sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1525 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1526 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1527 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1528 -e $(BROKEN_PATH_FIX) \
1529 $@.sh >$@+
1530endef
1531
Andreas Ericssond6ebd252005-11-22 00:44:15 +01001532$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
Jonathan Nieder46bac902010-01-31 11:46:53 -08001533 $(QUIET_GEN)$(cmd_munge_script) && \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001534 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02001535 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07001536
Jonathan Nieder46bac902010-01-31 11:46:53 -08001537$(SCRIPT_LIB) : % : %.sh
1538 $(QUIET_GEN)$(cmd_munge_script) && \
1539 mv $@+ $@
1540
Jeff King499c2932009-04-03 15:32:20 -04001541ifndef NO_PERL
Alex Riesenf8487182006-12-04 10:50:04 +01001542$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
1543
Alex Riesend1a20572007-10-25 22:17:24 +02001544perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
Alex Riesen31d03992007-03-06 23:37:18 +01001545 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
Alex Riesenf8487182006-12-04 10:50:04 +01001546
Junio C Hamanof6276fe2006-06-24 19:41:03 -07001547$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
Emil Medve4cb08df2007-07-14 12:51:44 -05001548 $(QUIET_GEN)$(RM) $@ $@+ && \
Jim Meyeringe8839322007-09-25 08:42:16 +02001549 INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
Junio C Hamano998c4da2006-07-07 13:04:35 -07001550 sed -e '1{' \
1551 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1552 -e ' h' \
Johannes Schindelin352c8112009-05-23 10:04:48 +02001553 -e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
Junio C Hamano998c4da2006-07-07 13:04:35 -07001554 -e ' H' \
1555 -e ' x' \
1556 -e '}' \
Junio C Hamanof6276fe2006-06-24 19:41:03 -07001557 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
Junio C Hamano3ff8cbe2005-10-04 12:41:35 -07001558 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001559 $@.perl >$@+ && \
1560 chmod +x $@+ && \
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02001561 mv $@+ $@
Junio C Hamanobc6146d2005-09-08 18:50:33 -07001562
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01001563
1564.PHONY: gitweb
1565gitweb:
1566 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
1567
Jakub Narebski63267de2009-09-01 13:39:20 +02001568ifdef JSMIN
Mark Rada0e6ce212010-04-02 20:35:05 -04001569GITWEB_PROGRAMS += gitweb/gitweb.min.js
Mark Rada09b89d12010-04-02 20:40:33 -04001570GITWEB_JS = gitweb/gitweb.min.js
Jakub Narebski63267de2009-09-01 13:39:20 +02001571else
Mark Rada09b89d12010-04-02 20:40:33 -04001572GITWEB_JS = gitweb/gitweb.js
Jakub Narebski63267de2009-09-01 13:39:20 +02001573endif
Mark Rada0e6ce212010-04-02 20:35:05 -04001574ifdef CSSMIN
1575GITWEB_PROGRAMS += gitweb/gitweb.min.css
Mark Rada09b89d12010-04-02 20:40:33 -04001576GITWEB_CSS = gitweb/gitweb.min.css
1577else
1578GITWEB_CSS = gitweb/gitweb.css
Mark Rada0e6ce212010-04-02 20:35:05 -04001579endif
1580OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS)
1581gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01001582 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1583
1584ifdef JSMIN
1585gitweb/gitweb.min.js: gitweb/gitweb.js
1586 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1587endif # JSMIN
Mark Rada0e6ce212010-04-02 20:35:05 -04001588ifdef CSSMIN
1589gitweb/gitweb.min.css: gitweb/gitweb.css
1590 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1591endif # CSSMIN
John 'Warthog9' Hawley62331ef2010-01-30 23:30:40 +01001592
Martin Waitz5d043a32006-08-01 21:34:08 +02001593
Jakub Narebski4af819d2009-09-01 13:39:17 +02001594git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
Emil Medve4cb08df2007-07-14 12:51:44 -05001595 $(QUIET_GEN)$(RM) $@ $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07001596 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1597 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1598 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
Michal Rokos6e959ab2006-07-08 17:27:10 +02001599 -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
Johannes Schindelin07002282006-07-02 11:31:30 +02001600 -e '/@@GITWEB_CGI@@/d' \
Mark Rada09b89d12010-04-02 20:40:33 -04001601 -e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \
Johannes Schindelin07002282006-07-02 11:31:30 +02001602 -e '/@@GITWEB_CSS@@/d' \
Mark Rada09b89d12010-04-02 20:40:33 -04001603 -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \
Jakub Narebski4af819d2009-09-01 13:39:17 +02001604 -e '/@@GITWEB_JS@@/d' \
Charles Baileyc5699692007-12-19 12:25:27 +00001605 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
Mark Rada09b89d12010-04-02 20:40:33 -04001606 -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \
1607 -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001608 $@.sh > $@+ && \
1609 chmod +x $@+ && \
Eric Wonga51d37c2006-07-01 15:14:14 -07001610 mv $@+ $@
Jeff King499c2932009-04-03 15:32:20 -04001611else # NO_PERL
1612$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
1613 $(QUIET_GEN)$(RM) $@ $@+ && \
1614 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1615 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
1616 unimplemented.sh >$@+ && \
1617 chmod +x $@+ && \
1618 mv $@+ $@
1619endif # NO_PERL
Eric Wonga51d37c2006-07-01 15:14:14 -07001620
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01001621ifndef NO_PYTHON
1622$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
1623$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
1624 $(QUIET_GEN)$(RM) $@ $@+ && \
1625 INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
1626 --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
1627 instlibdir` && \
1628 sed -e '1{' \
1629 -e ' s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
1630 -e '}' \
1631 -e 's|^import sys.*|&; \\\
1632 import os; \\\
David Aguilar0ae08402010-03-27 17:45:12 -07001633 sys.path.insert(0, os.getenv("GITPYTHONLIB",\
1634 "@@INSTLIBDIR@@"));|' \
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01001635 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
1636 $@.py >$@+ && \
1637 chmod +x $@+ && \
1638 mv $@+ $@
1639else # NO_PYTHON
1640$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
1641 $(QUIET_GEN)$(RM) $@ $@+ && \
1642 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1643 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
1644 unimplemented.sh >$@+ && \
1645 chmod +x $@+ && \
1646 mv $@+ $@
1647endif # NO_PYTHON
1648
Jakub Narebski39001452006-08-08 18:35:23 +02001649configure: configure.ac
Emil Medve4cb08df2007-07-14 12:51:44 -05001650 $(QUIET_GEN)$(RM) $@ $<+ && \
Jakub Narebski39001452006-08-08 18:35:23 +02001651 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001652 $< > $<+ && \
1653 autoconf -o $@ $<+ && \
Emil Medve4cb08df2007-07-14 12:51:44 -05001654 $(RM) $<+
Jakub Narebski39001452006-08-08 18:35:23 +02001655
Junio C Hamano9b88fce2005-12-27 14:40:17 -08001656# These can record GIT_VERSION
Matt McCutchen54dadbd2007-07-09 21:30:39 -04001657git.o git.spec \
Junio C Hamano9b88fce2005-12-27 14:40:17 -08001658 $(patsubst %.sh,%,$(SCRIPT_SH)) \
1659 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
Junio C Hamano9b88fce2005-12-27 14:40:17 -08001660 : GIT-VERSION-FILE
Johannes Schindeline99fcf92005-12-22 20:38:23 +01001661
Jonathan Nieder5b8805e2010-02-28 03:11:55 -06001662TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
Jonathan Nieder1b22c992010-01-26 09:54:23 -06001663GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
1664 git.o http.o http-walker.o remote-curl.o
Jonathan Niederbeeb4562010-01-26 09:49:33 -06001665XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1666 xdiff/xmerge.o xdiff/xpatience.o
Jonathan Niederc3739912010-01-26 09:52:11 -06001667OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS)
1668
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06001669dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
Jonathan Nieder010acc12010-01-31 15:37:25 -06001670dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
Jonathan Niederbeeb4562010-01-26 09:49:33 -06001671
Jonathan Niederdfea5752010-01-26 09:52:49 -06001672ifdef COMPUTE_HEADER_DEPENDENCIES
Jonathan Niederdfea5752010-01-26 09:52:49 -06001673$(dep_dirs):
1674 mkdir -p $@
1675
1676missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
Jonathan Niederec5e0bb2010-01-31 15:23:53 -06001677dep_file = $(dir $@).depend/$(notdir $@).d
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001678dep_args = -MF $(dep_file) -MMD -MP
1679ifdef CHECK_HEADER_DEPENDENCIES
1680$(error cannot compute header dependencies outside a normal build. \
1681Please unset CHECK_HEADER_DEPENDENCIES and try again)
1682endif
1683endif
1684
1685ifndef COMPUTE_HEADER_DEPENDENCIES
1686ifndef CHECK_HEADER_DEPENDENCIES
Jonathan Niederdfea5752010-01-26 09:52:49 -06001687dep_dirs =
1688missing_dep_dirs =
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001689dep_args =
Jonathan Niederdfea5752010-01-26 09:52:49 -06001690endif
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001691endif
1692
1693ifdef CHECK_HEADER_DEPENDENCIES
1694ifndef PRINT_HEADER_DEPENDENCIES
1695missing_deps = $(filter-out $(notdir $^), \
1696 $(notdir $(shell $(MAKE) -s $@ \
1697 CHECK_HEADER_DEPENDENCIES=YesPlease \
1698 USE_COMPUTED_HEADER_DEPENDENCIES=YesPlease \
1699 PRINT_HEADER_DEPENDENCIES=YesPlease)))
1700endif
1701endif
1702
1703ASM_SRC := $(wildcard $(OBJECTS:o=S))
1704ASM_OBJ := $(ASM_SRC:S=o)
1705C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
Jonathan Niederdfea5752010-01-26 09:52:49 -06001706
Jonathan Nieder30248882010-01-26 09:51:24 -06001707.SUFFIXES:
1708
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001709ifdef PRINT_HEADER_DEPENDENCIES
1710$(C_OBJ): %.o: %.c FORCE
1711 echo $^
1712$(ASM_OBJ): %.o: %.S FORCE
1713 echo $^
Jonathan Niederdfea5752010-01-26 09:52:49 -06001714
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001715ifndef CHECK_HEADER_DEPENDENCIES
1716$(error cannot print header dependencies during a normal build. \
1717Please set CHECK_HEADER_DEPENDENCIES and try again)
1718endif
Jonathan Niederdfea5752010-01-26 09:52:49 -06001719endif
1720
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001721ifndef PRINT_HEADER_DEPENDENCIES
1722ifdef CHECK_HEADER_DEPENDENCIES
1723$(C_OBJ): %.o: %.c $(dep_files) FORCE
1724 @set -e; echo CHECK $@; \
1725 missing_deps="$(missing_deps)"; \
1726 if test "$$missing_deps"; \
1727 then \
1728 echo missing dependencies: $$missing_deps; \
1729 false; \
1730 fi
1731$(ASM_OBJ): %.o: %.S $(dep_files) FORCE
1732 @set -e; echo CHECK $@; \
1733 missing_deps="$(missing_deps)"; \
1734 if test "$$missing_deps"; \
1735 then \
1736 echo missing dependencies: $$missing_deps; \
1737 false; \
1738 fi
1739endif
1740endif
Jonathan Niederdfea5752010-01-26 09:52:49 -06001741
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001742ifndef CHECK_HEADER_DEPENDENCIES
1743$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001744 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001745$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001746 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001747endif
1748
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06001749%.s: %.c GIT-CFLAGS FORCE
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001750 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Jonathan Niederf2fabbf2010-01-26 09:57:15 -06001751
1752ifdef USE_COMPUTED_HEADER_DEPENDENCIES
1753# Take advantage of gcc's on-the-fly dependency generation
1754# See <http://gcc.gnu.org/gcc-3.0/features.html>.
1755dep_files_present := $(wildcard $(dep_files))
1756ifneq ($(dep_files_present),)
1757include $(dep_files_present)
1758endif
1759else
Jonathan Niederdfea5752010-01-26 09:52:49 -06001760# Dependencies on header files, for platforms that do not support
1761# the gcc -MMD option.
1762#
1763# Dependencies on automatically generated headers such as common-cmds.h
1764# should _not_ be included here, since they are necessary even when
1765# building an object for the first time.
1766#
1767# XXX. Please check occasionally that these include all dependencies
1768# gcc detects!
Pavel Roskinb05701c2005-08-06 01:36:15 -04001769
Jonathan Niederbeeb4562010-01-26 09:49:33 -06001770$(GIT_OBJS): $(LIB_H)
Junio C Hamano2e0e8b62010-03-10 15:25:18 -08001771builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o branch.o transport.o: branch.h
1772builtin/bundle.o bundle.o transport.o: bundle.h
1773builtin/bisect--helper.o builtin/rev-list.o bisect.o: bisect.h
1774builtin/clone.o builtin/fetch-pack.o transport.o: fetch-pack.h
1775builtin/grep.o: thread-utils.h
1776builtin/send-pack.o transport.o: send-pack.h
1777builtin/log.o builtin/shortlog.o: shortlog.h
1778builtin/prune.o builtin/reflog.o reachable.o: reachable.h
1779builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
1780builtin/tar-tree.o archive-tar.o: tar.h
1781builtin/pack-objects.o: thread-utils.h
Jonathan Niederbeeb4562010-01-26 09:49:33 -06001782http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
1783http.o http-walker.o http-push.o remote-curl.o: http.h
1784
Jonathan Niederbeeb4562010-01-26 09:49:33 -06001785xdiff-interface.o $(XDIFF_OBJS): \
1786 xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1787 xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
Jonathan Niederdfea5752010-01-26 09:52:49 -06001788endif
Junio C Hamano7a590132005-08-06 13:10:43 -07001789
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001790exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06001791 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1792 '-DBINDIR="$(bindir_relative_SQ)"' \
1793 '-DPREFIX="$(prefix_SQ)"'
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001794
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001795builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
Jonathan Nieder373a5ed2010-01-06 02:05:04 -06001796 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
Michal Ostrowski77cb17e2006-01-10 21:12:17 -05001797
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001798config.s config.o: EXTRA_CPPFLAGS = -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
Johannes Sixt506b17b2007-11-13 21:05:05 +01001799
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001800http.s http.o: EXTRA_CPPFLAGS = -DGIT_USER_AGENT='"git/$(GIT_VERSION)"'
Nick Hengeveld20fc9bc2006-04-04 10:11:29 -07001801
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07001802ifdef NO_EXPAT
Jonathan Niedera673cfe2010-03-19 22:20:12 -05001803http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
Nick Hengeveld8d9fbe52006-04-04 05:33:18 -07001804endif
1805
Junio C Hamano8eef8e02006-03-31 16:23:46 -08001806git-%$X: %.o $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001807 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Daniel Barkalow6eb7ed52005-04-23 18:47:23 -07001808
Robert Shearman684ec6c2008-07-09 22:29:00 +01001809git-imap-send$X: imap-send.o $(GITLIBS)
1810 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1811 $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
Mike McCormackf2561fd2006-03-10 14:32:50 +09001812
Mike Ralphsonae209bd2009-08-06 14:14:45 +01001813git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
Linus Torvalds10882612009-08-05 01:01:59 -04001814 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Jeff King17fd9f52009-08-07 00:21:33 -04001815 $(LIBS) $(CURL_LIBCURL)
Junio C Hamano8fced612006-07-03 00:53:13 -07001816git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
Shawn O. Pearce74f2b2a2007-03-06 01:35:01 -05001817 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
Johannes Schindelin39c015c2006-02-18 12:40:22 +01001818 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1819
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02001820$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
1821 $(QUIET_LNCP)$(RM) $@ && \
1822 ln $< $@ 2>/dev/null || \
1823 ln -s $< $@ 2>/dev/null || \
1824 cp $< $@
1825
1826$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
Daniel Barkalowa2d725b2009-08-05 01:01:56 -04001827 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1828 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1829
Petr Baudis28818ff2005-07-29 17:50:24 +02001830$(LIB_FILE): $(LIB_OBJS)
Emil Medve4cb08df2007-07-14 12:51:44 -05001831 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
Petr Baudis28818ff2005-07-29 17:50:24 +02001832
Linus Torvalds34435462006-03-24 20:13:22 -08001833$(XDIFF_LIB): $(XDIFF_OBJS)
Emil Medve4cb08df2007-07-14 12:51:44 -05001834 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
Linus Torvalds34435462006-03-24 20:13:22 -08001835
1836
Petr Baudis28818ff2005-07-29 17:50:24 +02001837doc:
1838 $(MAKE) -C Documentation all
1839
Michael J Gruber414851a2008-09-10 10:19:34 +02001840man:
1841 $(MAKE) -C Documentation man
1842
1843html:
1844 $(MAKE) -C Documentation html
1845
David Kastrup47398092007-08-06 12:22:57 +02001846info:
1847 $(MAKE) -C Documentation info
1848
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01001849pdf:
1850 $(MAKE) -C Documentation pdf
1851
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01001852TAGS:
Emil Medve4cb08df2007-07-14 12:51:44 -05001853 $(RM) TAGS
David Kastrup89b2f192007-07-29 15:23:28 -07001854 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
Fredrik Kuivinenf81e7c62006-03-18 11:07:12 +01001855
1856tags:
Emil Medve4cb08df2007-07-14 12:51:44 -05001857 $(RM) tags
David Kastrup89b2f192007-07-29 15:23:28 -07001858 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
Petr Baudis28818ff2005-07-29 17:50:24 +02001859
Kristof Provosta2a91502007-10-06 16:24:42 +02001860cscope:
1861 $(RM) cscope*
1862 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
1863
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001864### Detect prefix changes
Junio C Hamano7cdbff12006-11-20 00:49:31 -08001865TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001866 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1867
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06001868GIT-CFLAGS: FORCE
Yakov Lernerca3bcab2006-06-15 01:36:00 +03001869 @FLAGS='$(TRACK_CFLAGS)'; \
1870 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1871 echo 1>&2 " * new build flags or prefix"; \
1872 echo "$$FLAGS" >GIT-CFLAGS; \
1873 fi
1874
Junio C Hamanobfce5082008-07-25 12:35:10 -07001875# We need to apply sq twice, once to protect from the shell
1876# that runs GIT-BUILD-OPTIONS, and then again to protect it
1877# and the first level quoting from the shell that runs "echo".
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06001878GIT-BUILD-OPTIONS: FORCE
Junio C Hamanobfce5082008-07-25 12:35:10 -07001879 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
Philippe Bruhat (BooK)be38ca32009-11-17 09:42:39 +01001880 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
Gary V. Vaughand1b1a912010-05-14 09:31:36 +00001881 @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@
Junio C Hamanobfce5082008-07-25 12:35:10 -07001882 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
Jeff King119c8ee2009-02-25 03:32:09 -05001883 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
Jeff King1b19ccd2009-04-03 15:33:59 -04001884 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
Jeff Kingac10a852009-12-07 00:32:50 -05001885 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
Jeff King7cf7f542008-02-24 14:40:45 -05001886
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07001887### Detect Tck/Tk interpreter path changes
1888ifndef NO_TCLTK
1889TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1890
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06001891GIT-GUI-VARS: FORCE
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07001892 @VARS='$(TRACK_VARS)'; \
1893 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1894 echo 1>&2 " * new Tcl/Tk interpreter location"; \
1895 echo "$$VARS" >$@; \
1896 fi
Eygene Ryabinkin6bdb18a2007-03-28 04:22:02 -07001897endif
1898
Matthew Ogilvieea925192009-12-02 22:14:05 -07001899test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
1900
1901all:: $(TEST_PROGRAMS) $(test_bindir_programs)
1902
1903bin-wrappers/%: wrap-for-bin.sh
1904 @mkdir -p bin-wrappers
1905 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1906 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
1907 -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
1908 chmod +x $@
Junio C Hamano96651ef2007-04-28 15:32:49 -07001909
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01001910# GNU make supports exporting all variables by "export" without parameters.
1911# However, the environment gets quite big, and some programs have problems
1912# with that.
1913
Johannes Schindelin140245b2006-07-07 13:26:31 +02001914export NO_SVN_TESTS
Johannes Schindelinabb7c7b2006-02-18 13:01:18 +01001915
Jonathan Nieder225f78c2010-01-26 10:08:44 -06001916### Testing rules
1917
Junio C Hamano96651ef2007-04-28 15:32:49 -07001918test: all
Petr Baudis28818ff2005-07-29 17:50:24 +02001919 $(MAKE) -C t/ all
1920
René Scharfeb4285c72009-01-17 16:50:13 +01001921test-ctype$X: ctype.o
1922
Julian Phillips5c5ba732007-05-31 00:18:24 +01001923test-date$X: date.o ctype.o
Petr Baudis28818ff2005-07-29 17:50:24 +02001924
Julian Phillips5c5ba732007-05-31 00:18:24 +01001925test-delta$X: diff-delta.o patch-delta.o
Petr Baudis28818ff2005-07-29 17:50:24 +02001926
Alex Riesen481424e2007-11-14 00:16:36 +01001927test-parse-options$X: parse-options.o
1928
Jonathan Niederdaa99a92010-01-26 09:45:54 -06001929.PRECIOUS: $(TEST_OBJS)
Junio C Hamanofa8fe282007-08-30 19:14:31 -07001930
Julian Phillips5c5ba732007-05-31 00:18:24 +01001931test-%$X: test-%.o $(GITLIBS)
1932 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Nicolas Pitre2dca1af2007-04-11 13:59:51 -04001933
Junio C Hamanob65bc212006-06-24 00:59:49 -07001934check-sha1:: test-sha1$X
1935 ./test-sha1.sh
1936
René Scharfe7c4c9f42007-01-04 19:33:48 +01001937check: common-cmds.h
Junio C Hamano912f9982008-11-11 13:12:17 -08001938 if sparse; \
1939 then \
1940 for i in *.c; \
1941 do \
1942 sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1943 done; \
1944 else \
1945 echo 2>&1 "Did you mean 'make test'?"; \
1946 exit 1; \
1947 fi
Petr Baudis28818ff2005-07-29 17:50:24 +02001948
Linus Torvalds36e5e702007-06-30 11:49:17 -07001949remove-dashes:
Miklos Vajnab4f02d32008-07-11 02:12:06 +02001950 ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
Petr Baudis28818ff2005-07-29 17:50:24 +02001951
1952### Installation rules
1953
Junio C Hamano0c0ead72009-02-05 00:04:17 -08001954ifneq ($(filter /%,$(firstword $(template_dir))),)
Johannes Sixt0b50b862008-01-01 22:15:21 +01001955template_instdir = $(template_dir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001956else
1957template_instdir = $(prefix)/$(template_dir)
Johannes Sixt0b50b862008-01-01 22:15:21 +01001958endif
1959export template_instdir
1960
Junio C Hamano0c0ead72009-02-05 00:04:17 -08001961ifneq ($(filter /%,$(firstword $(gitexecdir))),)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02001962gitexec_instdir = $(gitexecdir)
Steffen Prohaska026fa0d2009-01-18 13:00:09 +01001963else
1964gitexec_instdir = $(prefix)/$(gitexecdir)
Johannes Sixt49fa65a2008-07-23 21:12:18 +02001965endif
1966gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
1967export gitexec_instdir
1968
Matthew Ogilvieea925192009-12-02 22:14:05 -07001969install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
1970
Andreas Ericssond6ebd252005-11-22 00:44:15 +01001971install: all
Robert Schiele41650762007-12-01 18:05:40 +01001972 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
Johannes Sixt49fa65a2008-07-23 21:12:18 +02001973 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1974 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Jonathan Nieder46bac902010-01-31 11:46:53 -08001975 $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
Matthew Ogilvieea925192009-12-02 22:14:05 -07001976 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
Ramsay Allan Jones7ffe7092006-07-29 17:25:03 +01001977 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
Junio C Hamano5be3b172009-04-22 22:42:28 -07001978ifndef NO_PERL
Gerrit Pape28072a52007-12-10 09:31:02 +00001979 $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
Junio C Hamano5be3b172009-04-22 22:42:28 -07001980endif
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01001981ifndef NO_PYTHON
1982 $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1983endif
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001984ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08001985 $(MAKE) -C gitk-git install
Johannes Sixt49fa65a2008-07-23 21:12:18 +02001986 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07001987endif
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001988ifneq (,$X)
Eric Blaked4b19022009-04-28 06:28:31 -06001989 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
Junio C Hamano6fc301b2007-01-10 12:24:54 -08001990endif
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02001991
Johannes Sixt46beb552008-07-21 21:19:51 +02001992 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
Johannes Sixt49fa65a2008-07-23 21:12:18 +02001993 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
Junio C Hamano6edd1492009-07-10 20:17:33 -07001994 { test "$$bindir/" = "$$execdir/" || \
1995 { $(RM) "$$execdir/git$X" && \
Johannes Schindelin3426e342009-05-11 13:02:18 +02001996 test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
Jeff King4ecbc172009-07-09 02:37:35 -04001997 ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
Junio C Hamano6edd1492009-07-10 20:17:33 -07001998 cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
Jeff King4ecbc172009-07-09 02:37:35 -04001999 { for p in $(BUILT_INS); do \
Brandon Caseyb56c79c2009-01-19 19:44:03 -06002000 $(RM) "$$execdir/$$p" && \
Jeff King4ecbc172009-07-09 02:37:35 -04002001 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2002 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2003 cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
Mark Dragofe4a9c32009-04-26 22:36:48 -04002004 done; } && \
Ilari Liusvaara28ca0c92009-12-09 17:26:34 +02002005 { for p in $(REMOTE_CURL_ALIASES); do \
2006 $(RM) "$$execdir/$$p" && \
2007 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2008 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2009 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
2010 done; } && \
Johannes Sixt7b4b59a2008-07-21 21:19:58 +02002011 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
Petr Baudis28818ff2005-07-29 17:50:24 +02002012
2013install-doc:
2014 $(MAKE) -C Documentation install
2015
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002016install-man:
2017 $(MAKE) -C Documentation install-man
2018
Teemu Likonenae081f32008-06-10 11:34:25 +03002019install-html:
2020 $(MAKE) -C Documentation install-html
2021
David Kastrup47398092007-08-06 12:22:57 +02002022install-info:
2023 $(MAKE) -C Documentation install-info
2024
Miklos Vajnaa325a1a2008-12-10 23:44:50 +01002025install-pdf:
2026 $(MAKE) -C Documentation install-pdf
2027
Eric Wong6538d1e2006-12-23 08:26:09 -08002028quick-install-doc:
2029 $(MAKE) -C Documentation quick-install
Petr Baudis28818ff2005-07-29 17:50:24 +02002030
Markus Heidelbergb1a46b72008-11-02 18:53:03 +01002031quick-install-man:
2032 $(MAKE) -C Documentation quick-install-man
2033
Michael J Gruber6fe570d2008-09-09 22:44:17 +02002034quick-install-html:
2035 $(MAKE) -C Documentation quick-install-html
2036
Petr Baudis28818ff2005-07-29 17:50:24 +02002037
2038
2039### Maintainer's dist rules
2040
Junio C Hamano9b88fce2005-12-27 14:40:17 -08002041git.spec: git.spec.in
Jim Meyeringfc36f6a2006-05-25 18:52:01 +02002042 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
2043 mv $@+ $@
Chris Wrighta9db2972005-07-07 13:09:50 -07002044
Junio C Hamano27dedf02005-11-16 21:32:44 -08002045GIT_TARNAME=git-$(GIT_VERSION)
Shawn O. Pearce6c0f8692008-02-24 00:38:04 -05002046dist: git.spec git-archive$(X) configure
Junio C Hamano9ccb64c2006-10-05 02:26:12 -07002047 ./git-archive --format=tar \
2048 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07002049 @mkdir -p $(GIT_TARNAME)
Matthias Lederhoferf58494b2007-06-18 23:30:36 +02002050 @cp git.spec configure $(GIT_TARNAME)
H. Peter Anvin181129d2006-01-09 18:07:01 -08002051 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002052 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
H. Peter Anvin181129d2006-01-09 18:07:01 -08002053 $(TAR) rf $(GIT_TARNAME).tar \
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002054 $(GIT_TARNAME)/git.spec \
Matthias Lederhoferf58494b2007-06-18 23:30:36 +02002055 $(GIT_TARNAME)/configure \
Shawn O. Pearced647c2e2007-02-12 18:20:34 -05002056 $(GIT_TARNAME)/version \
Shawn O. Pearce115f0fe2007-03-12 13:40:31 -04002057 $(GIT_TARNAME)/git-gui/version
Emil Medve4cb08df2007-07-14 12:51:44 -05002058 @$(RM) -r $(GIT_TARNAME)
Eric W. Biederman9dce3c02005-07-14 19:20:50 -06002059 gzip -f -9 $(GIT_TARNAME).tar
Chris Wrighta9db2972005-07-07 13:09:50 -07002060
2061rpm: dist
Todd Zullingera96e9c22009-11-11 16:59:52 -05002062 $(RPMBUILD) \
2063 --define "_source_filedigest_algorithm md5" \
2064 --define "_binary_filedigest_algorithm md5" \
2065 -ta $(GIT_TARNAME).tar.gz
Chris Wrighta9db2972005-07-07 13:09:50 -07002066
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002067htmldocs = git-htmldocs-$(GIT_VERSION)
2068manpages = git-manpages-$(GIT_VERSION)
2069dist-doc:
Emil Medve4cb08df2007-07-14 12:51:44 -05002070 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002071 mkdir .doc-tmp-dir
2072 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
2073 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
2074 gzip -n -9 -f $(htmldocs).tar
2075 :
Emil Medve4cb08df2007-07-14 12:51:44 -05002076 $(RM) -r .doc-tmp-dir
Junio C Hamano4392da42007-04-19 20:47:04 -07002077 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
Martin Waitzc5360322006-05-25 14:37:46 +02002078 $(MAKE) -C Documentation DESTDIR=./ \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02002079 man1dir=../.doc-tmp-dir/man1 \
Junio C Hamano4392da42007-04-19 20:47:04 -07002080 man5dir=../.doc-tmp-dir/man5 \
Jakub Narebski7b8cf0c2006-06-29 23:26:54 +02002081 man7dir=../.doc-tmp-dir/man7 \
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002082 install
2083 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
2084 gzip -n -9 -f $(manpages).tar
Emil Medve4cb08df2007-07-14 12:51:44 -05002085 $(RM) -r .doc-tmp-dir
Tilman Sauerbeck52db0492006-05-18 12:57:04 +02002086
Petr Baudis28818ff2005-07-29 17:50:24 +02002087### Cleaning rules
Eric W. Biederman87a81c82005-07-14 19:21:57 -06002088
Mathias Megyei922aa802007-10-04 23:49:19 +02002089distclean: clean
2090 $(RM) configure
2091
Linus Torvaldse83c5162005-04-07 15:13:13 -07002092clean:
Jonathan Nieder7fc9d152009-11-28 05:41:28 -06002093 $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
Linus Torvalds81b50f32010-02-22 08:42:18 -08002094 builtin/*.o $(LIB_FILE) $(XDIFF_LIB)
Jonathan Nieder46bac902010-01-31 11:46:53 -08002095 $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Emil Medve4cb08df2007-07-14 12:51:44 -05002096 $(RM) $(TEST_PROGRAMS)
Matthew Ogilvieea925192009-12-02 22:14:05 -07002097 $(RM) -r bin-wrappers
Jonathan Niederdfea5752010-01-26 09:52:49 -06002098 $(RM) -r $(dep_dirs)
Kristof Provosta2a91502007-10-06 16:24:42 +02002099 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
Emil Medve4cb08df2007-07-14 12:51:44 -05002100 $(RM) -r autom4te.cache
Mathias Megyei922aa802007-10-04 23:49:19 +02002101 $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
Emil Medve4cb08df2007-07-14 12:51:44 -05002102 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
2103 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
2104 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
Thomas Glanzmannca67f002005-05-22 20:27:28 +02002105 $(MAKE) -C Documentation/ clean
Jeff King499c2932009-04-03 15:32:20 -04002106ifndef NO_PERL
Mark Rada8830bf42010-04-02 20:33:55 -04002107 $(RM) gitweb/gitweb.cgi gitweb/gitweb.min.*
Alex Riesenf8487182006-12-04 10:50:04 +01002108 $(MAKE) -C perl clean
Jeff King499c2932009-04-03 15:32:20 -04002109endif
Sverre Rabbelier2fe40b62009-11-18 02:42:32 +01002110ifndef NO_PYTHON
2111 $(MAKE) -C git_remote_helpers clean
2112endif
Petr Baudisb1edc532006-06-24 04:34:29 +02002113 $(MAKE) -C templates/ clean
Junio C Hamano4b7581f2005-08-02 17:24:11 -07002114 $(MAKE) -C t/ clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002115ifndef NO_TCLTK
Junio C Hamano62ba5142007-11-17 10:51:16 -08002116 $(MAKE) -C gitk-git clean
Eygene Ryabinkin3cfaf112007-03-28 04:00:23 -07002117 $(MAKE) -C git-gui clean
2118endif
Jeff King7cf7f542008-02-24 14:40:45 -05002119 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
Junio C Hamano9b88fce2005-12-27 14:40:17 -08002120
Junio C Hamano4dc00022006-01-12 21:42:25 -08002121.PHONY: all install clean strip
Brandon Casey6dc46272008-08-07 14:06:26 -05002122.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Jonathan Nieder13fca9f2010-01-06 02:06:58 -06002123.PHONY: FORCE TAGS tags cscope
Junio C Hamanod89056c2005-12-19 17:59:58 -08002124
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002125### Check documentation
2126#
2127check-docs::
Jonathan Nieder46bac902010-01-31 11:46:53 -08002128 @(for v in $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002129 do \
2130 case "$$v" in \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002131 git-merge-octopus | git-merge-ours | git-merge-recursive | \
Miklos Vajna51add762008-07-05 16:43:51 +02002132 git-merge-resolve | git-merge-subtree | \
Junio C Hamano5c66d0d2008-01-17 22:52:40 -08002133 git-fsck-objects | git-init-db | \
Junio C Hamanoc88cd032010-03-10 15:31:34 -08002134 git-remote-* | git-stage | \
Junio C Hamano5b4617c2007-12-14 22:02:57 -08002135 git-?*--?* ) continue ;; \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002136 esac ; \
2137 test -f "Documentation/$$v.txt" || \
2138 echo "no doc: $$v"; \
Junio C Hamano79d30662007-12-01 23:39:19 -08002139 sed -e '/^#/d' command-list.txt | \
Junio C Hamano4b02c522007-02-13 22:45:22 -08002140 grep -q "^$$v[ ]" || \
Junio C Hamano8c989ec2006-04-13 00:17:19 -07002141 case "$$v" in \
2142 git) ;; \
2143 *) echo "no link: $$v";; \
2144 esac ; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002145 done; \
2146 ( \
Junio C Hamano79d30662007-12-01 23:39:19 -08002147 sed -e '/^#/d' \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002148 -e 's/[ ].*//' \
Junio C Hamano79d30662007-12-01 23:39:19 -08002149 -e 's/^/listed /' command-list.txt; \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002150 ls -1 Documentation/git*txt | \
2151 sed -e 's|Documentation/|documented |' \
2152 -e 's/\.txt//'; \
2153 ) | while read how cmd; \
2154 do \
2155 case "$$how,$$cmd" in \
2156 *,git-citool | \
2157 *,git-gui | \
Christian Couder0f6f1952007-12-04 06:44:29 +01002158 *,git-help | \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002159 documented,gitattributes | \
2160 documented,gitignore | \
2161 documented,gitmodules | \
Pierre Habouzit2f7ee082007-12-13 11:20:01 +01002162 documented,gitcli | \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002163 documented,git-tools | \
Junio C Hamanod0594be2008-06-15 13:43:32 -07002164 documented,gitcore-tutorial | \
2165 documented,gitcvs-migration | \
2166 documented,gitdiffcore | \
2167 documented,gitglossary | \
2168 documented,githooks | \
2169 documented,gitrepository-layout | \
2170 documented,gittutorial | \
2171 documented,gittutorial-2 | \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002172 documented,git-bisect-lk2009 | \
Junio C Hamanoc88cd032010-03-10 15:31:34 -08002173 documented,git-remote-helpers | \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002174 documented,gitworkflows | \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002175 sentinel,not,matching,is,ok ) continue ;; \
2176 esac; \
Jonathan Nieder46bac902010-01-31 11:46:53 -08002177 case " $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git gitk " in \
Junio C Hamano3f7ce642007-11-08 18:38:27 -08002178 *" $$cmd "*) ;; \
2179 *) echo "removed but $$how: $$cmd" ;; \
2180 esac; \
2181 done ) | sort
Junio C Hamanoc74390e2006-11-05 11:26:21 -08002182
2183### Make sure built-ins do not have dups and listed in git.c
2184#
2185check-builtins::
2186 ./check-builtins.sh
Junio C Hamano11c57e62008-01-14 15:10:38 -08002187
Thomas Rast901c3692009-02-19 12:13:35 +01002188### Test suite coverage testing
2189#
2190.PHONY: coverage coverage-clean coverage-build coverage-report
2191
2192coverage:
2193 $(MAKE) coverage-build
2194 $(MAKE) coverage-report
2195
2196coverage-clean:
2197 rm -f *.gcda *.gcno
2198
2199COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
2200COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
2201
2202coverage-build: coverage-clean
2203 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
2204 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
2205 -j1 test
2206
2207coverage-report:
2208 gcov -b *.c
2209 grep '^function.*called 0 ' *.c.gcov \
2210 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
2211 | tee coverage-untested-functions