]> git.ipfire.org Git - thirdparty/git.git/blame - Makefile
Makefile: tuck away generated makefile fragments in .depend
[thirdparty/git.git] / Makefile
CommitLineData
2731d048 1# The default target of this Makefile is...
6fc301bb 2all::
2731d048 3
2314c947 4# Define V=1 to have a more verbose compile.
74f2b2a8 5#
0e0aea5a
JH
6# 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#
c4582f93
MR
11# 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#
cba22528
BC
15# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
16# when attempting to read from an fopen'ed directory.
17#
765ac8ec 18# Define NO_OPENSSL environment variable if you do not have OpenSSL.
30ae47b4 19# This also implies BLK_SHA1.
2cb45e95 20#
8da1e212 21# Define NO_CURL if you do not have libcurl installed. git-http-pull and
58e60dd2
NH
22# git-http-push are not built, and you cannot use http:// and https://
23# transports.
b2c0bd65 24#
6d9bbc50
PM
25# Define CURLDIR=/foo/bar if your curl header and library files are in
26# /foo/bar/include and /foo/bar/lib directories.
27#
58e60dd2
NH
28# 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#
85b4518f
SB
31# Define EXPATDIR=/foo/bar if your expat header and library files are in
32# /foo/bar/include and /foo/bar/lib directories.
33#
35a730f0
JH
34# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
35#
63be37b0
JH
36# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
37# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
38#
579d1fbf
RJ
39# 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).
465e649d 42# some C compilers supported these specifiers prior to C99 as an extension.
579d1fbf 43#
ef34af24
LT
44# Define NO_STRCASESTR if you don't have strcasestr.
45#
b21b9f1d
RS
46# Define NO_MEMMEM if you don't have memmem.
47#
817151e6
PE
48# Define NO_STRLCPY if you don't have strlcpy.
49#
bc6b4f52
JR
50# 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#
e40b61fb
JR
54# Define NO_SETENV if you don't have setenv in the C library.
55#
bfa8fccf
JN
56# Define NO_UNSETENV if you don't have unsetenv in the C library.
57#
ca5bb5d5
SP
58# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
59#
0620b39b
DA
60# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
61#
e1c06886
DA
62# Define NO_LIBGEN_H if you don't have libgen.h.
63#
ecc395c1
BC
64# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
65#
2600973f
RS
66# Define NO_SYS_SELECT_H if you don't have sys/select.h.
67#
9f0bb90d
JH
68# 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.
2fabd217 70#
02853588 71# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
60d02ccc
EW
72# 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#
8eb38cad
SP
75# 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#
d7c208a9
LT
87# 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#
5bdac8b3
PB
91# Define PPC_SHA1 environment variable when running make to make use of
92# a bundled SHA1 routine optimized for PowerPC.
597c9cc5 93#
0460dba4
BG
94# 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).
f0ebff0d 97#
597c9cc5 98# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
f0ebff0d
PM
99#
100# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
101# Patrick Mauritz).
102#
70cf9910
BC
103# 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#
730d48a2
JS
107# Define NO_MMAP if you want to avoid mmap.
108#
46059cc6
JH
109# Define NO_PTHREADS if you do not have or do not want to use Pthreads.
110#
6900679c
SH
111# Define NO_PREAD if you have a problem with pread() system call (e.g.
112# cygwin.dll before v1.5.22).
113#
1510fea7
SP
114# Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
115# generally faster on your platform than accessing the working directory.
116#
c869753e
SP
117# Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
118# the executable mode bit, but doesn't really do so.
119#
49744d63
PA
120# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
121#
bdc37f5a
JH
122# Define NO_SOCKADDR_STORAGE if your platform does not have struct
123# sockaddr_storage.
124#
b6e56eca
FP
125# Define NO_ICONV if your libc does not properly support iconv.
126#
fd547a97
RJ
127# 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#
609a2289
DS
130# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
131#
20648877
MK
132# 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.
bbfc63dd 135#
5bdac8b3
PB
136# 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).
f6af75d2 141#
c567383b
BG
142# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
143# "st_ctim"
144#
c06ff490
KB
145# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
146# available. This automatically turns USE_NSEC off.
147#
5bdac8b3 148# Define USE_STDEV below if you want git to care about the underlying device
10455d2a 149# change being considered an inode change from the update-index perspective.
f848718a 150#
fdb2a2a6
JH
151# 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#
4c7100a9
JH
154# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
155#
162213d2
JN
156# 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).
7f55cf45 161#
204d363f
TR
162# 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#
f848718a
AR
166# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
167# MakeMaker (e.g. using ActiveState under Cygwin).
168#
499c2939
JK
169# Define NO_PERL if you do not want Perl scripts or libraries at all.
170#
d4e1b47a
JH
171# Define NO_PYTHON if you do not want Python scripts or libraries at all.
172#
3cfaf11b
ER
173# Define NO_TCLTK if you do not want Tcl/Tk GUI.
174#
5f5dbd71
SP
175# 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.
81b63c70
ER
180# 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#
8ecce684
NP
183# Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
184# parallel delta searching when packing objects.
185#
43fe901b
BD
186# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
187# is a simplified version of the merge sort used in glibc. This is
188# recommended if Git triggers O(n^2) behavior in your platform's qsort().
189#
34779c53
JS
190# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
191# information on a not yet closed file that lstat would return for the same
192# file after it was closed.
be66a6c4 193#
348df166
JS
194# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
195# when hardlinking a file to another name and unlinking the original file right
be66a6c4 196# away (some NTFS drivers seem to zero the contents in that scenario).
2c8f8b19 197#
3426e34f
JS
198# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
199# programs as a tar, where bin/ and libexec/ might be on different file systems.
f0ed8226
MSO
200#
201# Define USE_NED_ALLOCATOR if you want to replace the platforms default
202# memory allocators with the nedmalloc allocator written by Niall Douglas.
02232adf
JK
203#
204# Define NO_REGEX if you have no or inferior regex support in your C library.
8f4b576a 205#
63267de2
JN
206# Define JSMIN to point to JavaScript minifier that functions as
207# a filter to have gitweb.js minified.
8678bc09 208#
a3d023d0
JH
209# 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#
8f4b576a
JN
213# 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'
dfea5750
JN
220#
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.
f2fabbf7
JN
224#
225# Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded
226# dependency rules.
5bdac8b3 227
13fca9f3 228GIT-VERSION-FILE: FORCE
36546385 229 @$(SHELL_PATH) ./GIT-VERSION-GEN
9b88fcef 230-include GIT-VERSION-FILE
a9db2974 231
e15f5451
PJ
232uname_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')
46059cc6 237uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
e15f5451 238
d691d84e
RJ
239ifdef MSVC
240 # avoid the MingW and Cygwin configuration sections
241 uname_S := Windows
242 uname_O := Windows
243endif
244
94d23317 245# CFLAGS and LDFLAGS are for the users to override from the command line.
12aa7456 246
b05701c5 247CFLAGS = -g -O2 -Wall
94d23317 248LDFLAGS =
12aa7456 249ALL_CFLAGS = $(CFLAGS)
94d23317 250ALL_LDFLAGS = $(LDFLAGS)
4dc00021 251STRIP ?= strip
29c2cce4 252
49fa65a7
JS
253# Among the variables below, these:
254# gitexecdir
255# template_dir
026fa0d5
SP
256# mandir
257# infodir
49fa65a7
JS
258# htmldir
259# ETC_GITCONFIG (but not sysconfdir)
026fa0d5
SP
260# can be specified as a relative path some/where/else;
261# this is interpreted as relative to $(prefix) and "git" at
49fa65a7
JS
262# 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
b05701c5 265prefix = $(HOME)
026fa0d5
SP
266bindir_relative = bin
267bindir = $(prefix)/$(bindir_relative)
268mandir = share/man
269infodir = share/info
270gitexecdir = libexec/git-core
9354768a 271sharedir = $(prefix)/share
026fa0d5
SP
272template_dir = share/git-core/templates
273htmldir = share/doc/git-doc
b51b8bbf
JT
274ifeq ($(prefix),/usr)
275sysconfdir = /etc
026fa0d5 276ETC_GITCONFIG = $(sysconfdir)/gitconfig
b51b8bbf
JT
277else
278sysconfdir = $(prefix)/etc
026fa0d5 279ETC_GITCONFIG = etc/gitconfig
b51b8bbf 280endif
10861bea 281lib = lib
a682ef9f 282# DESTDIR=
352c8111 283pathsep = :
5c2a7fbc 284
63267de2
JN
285# JavaScript minifier invocation that can function as filter
286JSMIN =
287
5d043a3d 288# default configuration for gitweb
c8d138a8 289GITWEB_CONFIG = gitweb_config.perl
17a8b250 290GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
2de21fac 291GITWEB_HOME_LINK_STR = projects
5d043a3d
MW
292GITWEB_SITENAME =
293GITWEB_PROJECTROOT = /pub/git
ca5e9495 294GITWEB_PROJECT_MAXDEPTH = 2007
32f4aacc
ML
295GITWEB_EXPORT_OK =
296GITWEB_STRICT_EXPORT =
19a8721e 297GITWEB_BASE_URL =
5d043a3d
MW
298GITWEB_LIST =
299GITWEB_HOMETEXT = indextext.html
300GITWEB_CSS = gitweb.css
281f2f6b 301GITWEB_LOGO = git-logo.png
0b5deba1 302GITWEB_FAVICON = git-favicon.png
63267de2
JN
303ifdef JSMIN
304GITWEB_JS = gitweb.min.js
305else
4af819d4 306GITWEB_JS = gitweb.js
63267de2 307endif
b2d3476e
AC
308GITWEB_SITE_HEADER =
309GITWEB_SITE_FOOTER =
5d043a3d 310
8ea7ad69 311export prefix bindir sharedir sysconfdir
e14421b9 312
b05701c5
PR
313CC = gcc
314AR = ar
4cb08df5 315RM = rm -f
229a7ed7 316TAR = tar
89b2f19c 317FIND = find
b05701c5
PR
318INSTALL = install
319RPMBUILD = rpmbuild
5f5dbd71 320TCL_PATH = tclsh
81b63c70 321TCLTK_PATH = wish
158629b2 322PTHREAD_LIBS = -lpthread
e83c5163 323
5f5dbd71
SP
324export TCL_PATH TCLTK_PATH
325
44c9e859
LT
326# sparse is architecture-neutral, which means that we need to tell it
327# explicitly what architecture to check for. Fix this up for yours..
b05701c5 328SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
44c9e859 329
28818ffa
PB
330
331
332### --- END CONFIGURATION SECTION ---
333
8d7f586f 334# Those must not be GNU-specific; they are shared with perl/ which may
18b0fc1c
PB
335# be built by a different compiler. (Note that this is an artifact now
336# but it still might be nice to keep that distinction.)
337BASIC_CFLAGS =
338BASIC_LDFLAGS =
8d7f586f 339
5c928c06
JS
340# Guard against environment variables
341BUILTIN_OBJS =
342BUILT_INS =
343COMPAT_CFLAGS =
344COMPAT_OBJS =
345LIB_H =
346LIB_OBJS =
1b22c99c 347PROGRAM_OBJS =
5c928c06
JS
348PROGRAMS =
349SCRIPT_PERL =
d4e1b47a 350SCRIPT_PYTHON =
5c928c06 351SCRIPT_SH =
225f78c8 352TEST_PROGRAMS_NEED_X =
5c928c06 353
74ca5e6d
JH
354SCRIPT_SH += git-am.sh
355SCRIPT_SH += git-bisect.sh
afcbc8e7 356SCRIPT_SH += git-difftool--helper.sh
74ca5e6d
JH
357SCRIPT_SH += git-filter-branch.sh
358SCRIPT_SH += git-lost-found.sh
359SCRIPT_SH += git-merge-octopus.sh
360SCRIPT_SH += git-merge-one-file.sh
361SCRIPT_SH += git-merge-resolve.sh
74ca5e6d 362SCRIPT_SH += git-mergetool.sh
21d0ba7e 363SCRIPT_SH += git-mergetool--lib.sh
65d9fb48 364SCRIPT_SH += git-notes.sh
74ca5e6d
JH
365SCRIPT_SH += git-parse-remote.sh
366SCRIPT_SH += git-pull.sh
367SCRIPT_SH += git-quiltimport.sh
368SCRIPT_SH += git-rebase--interactive.sh
369SCRIPT_SH += git-rebase.sh
370SCRIPT_SH += git-repack.sh
371SCRIPT_SH += git-request-pull.sh
372SCRIPT_SH += git-sh-setup.sh
373SCRIPT_SH += git-stash.sh
374SCRIPT_SH += git-submodule.sh
375SCRIPT_SH += git-web--browse.sh
376
377SCRIPT_PERL += git-add--interactive.perl
afcbc8e7 378SCRIPT_PERL += git-difftool.perl
74ca5e6d
JH
379SCRIPT_PERL += git-archimport.perl
380SCRIPT_PERL += git-cvsexportcommit.perl
381SCRIPT_PERL += git-cvsimport.perl
382SCRIPT_PERL += git-cvsserver.perl
383SCRIPT_PERL += git-relink.perl
384SCRIPT_PERL += git-send-email.perl
385SCRIPT_PERL += git-svn.perl
60036a41 386
d6ebd259
AE
387SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
388 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
d4e1b47a 389 $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
e475fe16 390 git-instaweb
d6ebd259 391
42f77406
JH
392# Empty...
393EXTRA_PROGRAMS =
d6ebd259 394
74ca5e6d
JH
395# ... and all the rest that could be moved out of bindir to gitexecdir
396PROGRAMS += $(EXTRA_PROGRAMS)
1b22c99c
JN
397
398PROGRAM_OBJS += fast-import.o
399PROGRAM_OBJS += imap-send.o
400PROGRAM_OBJS += shell.o
401PROGRAM_OBJS += show-index.o
402PROGRAM_OBJS += upload-pack.o
403PROGRAM_OBJS += http-backend.o
404
405PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
74ca5e6d 406
225f78c8
JN
407TEST_PROGRAMS_NEED_X += test-chmtime
408TEST_PROGRAMS_NEED_X += test-ctype
409TEST_PROGRAMS_NEED_X += test-date
410TEST_PROGRAMS_NEED_X += test-delta
411TEST_PROGRAMS_NEED_X += test-dump-cache-tree
412TEST_PROGRAMS_NEED_X += test-genrandom
413TEST_PROGRAMS_NEED_X += test-match-trees
414TEST_PROGRAMS_NEED_X += test-parse-options
415TEST_PROGRAMS_NEED_X += test-path-utils
416TEST_PROGRAMS_NEED_X += test-run-command
417TEST_PROGRAMS_NEED_X += test-sha1
418TEST_PROGRAMS_NEED_X += test-sigchain
419TEST_PROGRAMS_NEED_X += test-index-version
420
421TEST_PROGRAMS := $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
daa99a91 422
1736855c
JH
423# List built-in command $C whose implementation cmd_$C() is not in
424# builtin-$C.o but is linked in as part of some other command.
74ca5e6d
JH
425BUILT_INS += $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
426
74ca5e6d 427BUILT_INS += git-cherry$X
fcb6c076 428BUILT_INS += git-cherry-pick$X
74ca5e6d
JH
429BUILT_INS += git-format-patch$X
430BUILT_INS += git-fsck-objects$X
431BUILT_INS += git-get-tar-commit-id$X
432BUILT_INS += git-init$X
433BUILT_INS += git-merge-subtree$X
434BUILT_INS += git-peek-remote$X
435BUILT_INS += git-repo-config$X
436BUILT_INS += git-show$X
24b1f65f 437BUILT_INS += git-stage$X
74ca5e6d
JH
438BUILT_INS += git-status$X
439BUILT_INS += git-whatchanged$X
91730800 440
ad17f013
JH
441# what 'all' will build and 'install' will install in gitexecdir,
442# excluding programs for built-in commands
6506e156 443ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
e83c5163 444
3cfaf11b 445# what 'all' will build but not install in gitexecdir
499c2939 446OTHER_PROGRAMS = git$X
3cfaf11b 447
ea925196
MO
448# what test wrappers are needed and 'install' will install, in bindir
449BINDIR_PROGRAMS_NEED_X += git
450BINDIR_PROGRAMS_NEED_X += git-upload-pack
451BINDIR_PROGRAMS_NEED_X += git-receive-pack
452BINDIR_PROGRAMS_NEED_X += git-upload-archive
453BINDIR_PROGRAMS_NEED_X += git-shell
454
455BINDIR_PROGRAMS_NO_X += git-cvsserver
456
3d32051f
RA
457# Set paths to tools early so that they can be used for version tests.
458ifndef SHELL_PATH
459 SHELL_PATH = /bin/sh
460endif
461ifndef PERL_PATH
462 PERL_PATH = /usr/bin/perl
463endif
d4e1b47a
JH
464ifndef PYTHON_PATH
465 PYTHON_PATH = /usr/bin/python
466endif
720d150c 467
3a793478 468export PERL_PATH
d4e1b47a 469export PYTHON_PATH
3a793478 470
0a02ce72 471LIB_FILE=libgit.a
3443546f 472XDIFF_LIB=xdiff/lib.a
8f3f9b09 473
75194438 474LIB_H += advice.h
74ca5e6d
JH
475LIB_H += archive.h
476LIB_H += attr.h
477LIB_H += blob.h
478LIB_H += builtin.h
479LIB_H += cache.h
480LIB_H += cache-tree.h
21528abc 481LIB_H += color.h
74ca5e6d 482LIB_H += commit.h
75457126 483LIB_H += compat/bswap.h
adbc0b6b 484LIB_H += compat/cygwin.h
fcb6c076 485LIB_H += compat/mingw.h
44626dc7 486LIB_H += compat/win32/pthread.h
74ca5e6d
JH
487LIB_H += csum-file.h
488LIB_H += decorate.h
489LIB_H += delta.h
490LIB_H += diffcore.h
491LIB_H += diff.h
492LIB_H += dir.h
21528abc 493LIB_H += exec_cmd.h
74ca5e6d
JH
494LIB_H += fsck.h
495LIB_H += git-compat-util.h
c12172d2 496LIB_H += graph.h
74ca5e6d
JH
497LIB_H += grep.h
498LIB_H += hash.h
940208a7 499LIB_H += help.h
8af84dad 500LIB_H += levenshtein.h
74ca5e6d
JH
501LIB_H += list-objects.h
502LIB_H += ll-merge.h
503LIB_H += log-tree.h
504LIB_H += mailmap.h
db3a9545 505LIB_H += merge-recursive.h
a97a7468 506LIB_H += notes.h
74ca5e6d
JH
507LIB_H += object.h
508LIB_H += pack.h
94e724a7 509LIB_H += pack-refs.h
74ca5e6d
JH
510LIB_H += pack-revindex.h
511LIB_H += parse-options.h
512LIB_H += patch-ids.h
74ca5e6d
JH
513LIB_H += pkt-line.h
514LIB_H += progress.h
515LIB_H += quote.h
516LIB_H += reflog-walk.h
517LIB_H += refs.h
518LIB_H += remote.h
5b2fd956 519LIB_H += rerere.h
cfc5789a 520LIB_H += resolve-undo.h
74ca5e6d
JH
521LIB_H += revision.h
522LIB_H += run-command.h
628522ec 523LIB_H += sha1-lookup.h
74ca5e6d 524LIB_H += sideband.h
4a16d072 525LIB_H += sigchain.h
74ca5e6d 526LIB_H += strbuf.h
fcb6c076 527LIB_H += string-list.h
752c0c24 528LIB_H += submodule.h
74ca5e6d
JH
529LIB_H += tag.h
530LIB_H += transport.h
531LIB_H += tree.h
532LIB_H += tree-walk.h
533LIB_H += unpack-trees.h
be58e70d 534LIB_H += userdiff.h
74ca5e6d 535LIB_H += utf8.h
21528abc
JN
536LIB_H += xdiff-interface.h
537LIB_H += xdiff/xdiff.h
74ca5e6d 538
5b8e6f85 539LIB_OBJS += abspath.o
75194438 540LIB_OBJS += advice.o
74ca5e6d
JH
541LIB_OBJS += alias.o
542LIB_OBJS += alloc.o
543LIB_OBJS += archive.o
544LIB_OBJS += archive-tar.o
545LIB_OBJS += archive-zip.o
546LIB_OBJS += attr.o
547LIB_OBJS += base85.o
a2ad79ce 548LIB_OBJS += bisect.o
74ca5e6d
JH
549LIB_OBJS += blob.o
550LIB_OBJS += branch.o
551LIB_OBJS += bundle.o
552LIB_OBJS += cache-tree.o
553LIB_OBJS += color.o
554LIB_OBJS += combine-diff.o
555LIB_OBJS += commit.o
556LIB_OBJS += config.o
557LIB_OBJS += connect.o
558LIB_OBJS += convert.o
559LIB_OBJS += copy.o
560LIB_OBJS += csum-file.o
561LIB_OBJS += ctype.o
562LIB_OBJS += date.o
563LIB_OBJS += decorate.o
564LIB_OBJS += diffcore-break.o
565LIB_OBJS += diffcore-delta.o
566LIB_OBJS += diffcore-order.o
567LIB_OBJS += diffcore-pickaxe.o
568LIB_OBJS += diffcore-rename.o
569LIB_OBJS += diff-delta.o
570LIB_OBJS += diff-lib.o
fcb6c076 571LIB_OBJS += diff-no-index.o
74ca5e6d
JH
572LIB_OBJS += diff.o
573LIB_OBJS += dir.o
d82f33e2 574LIB_OBJS += editor.o
74ca5e6d
JH
575LIB_OBJS += entry.o
576LIB_OBJS += environment.o
577LIB_OBJS += exec_cmd.o
578LIB_OBJS += fsck.o
c12172d2 579LIB_OBJS += graph.o
74ca5e6d
JH
580LIB_OBJS += grep.o
581LIB_OBJS += hash.o
582LIB_OBJS += help.o
a5031214 583LIB_OBJS += hex.o
74ca5e6d 584LIB_OBJS += ident.o
8af84dad 585LIB_OBJS += levenshtein.o
74ca5e6d
JH
586LIB_OBJS += list-objects.o
587LIB_OBJS += ll-merge.o
588LIB_OBJS += lockfile.o
589LIB_OBJS += log-tree.o
590LIB_OBJS += mailmap.o
591LIB_OBJS += match-trees.o
592LIB_OBJS += merge-file.o
9047ebbc 593LIB_OBJS += merge-recursive.o
96872bc2 594LIB_OBJS += name-hash.o
a97a7468 595LIB_OBJS += notes.o
74ca5e6d
JH
596LIB_OBJS += object.o
597LIB_OBJS += pack-check.o
94e724a7 598LIB_OBJS += pack-refs.o
74ca5e6d
JH
599LIB_OBJS += pack-revindex.o
600LIB_OBJS += pack-write.o
601LIB_OBJS += pager.o
602LIB_OBJS += parse-options.o
603LIB_OBJS += patch-delta.o
604LIB_OBJS += patch-ids.o
74ca5e6d
JH
605LIB_OBJS += path.o
606LIB_OBJS += pkt-line.o
fcb6c076 607LIB_OBJS += preload-index.o
74ca5e6d
JH
608LIB_OBJS += pretty.o
609LIB_OBJS += progress.o
610LIB_OBJS += quote.o
611LIB_OBJS += reachable.o
612LIB_OBJS += read-cache.o
613LIB_OBJS += reflog-walk.o
614LIB_OBJS += refs.o
615LIB_OBJS += remote.o
68095570 616LIB_OBJS += replace_object.o
5b2fd956 617LIB_OBJS += rerere.o
cfc5789a 618LIB_OBJS += resolve-undo.o
74ca5e6d
JH
619LIB_OBJS += revision.o
620LIB_OBJS += run-command.o
621LIB_OBJS += server-info.o
622LIB_OBJS += setup.o
628522ec 623LIB_OBJS += sha1-lookup.o
fcb6c076 624LIB_OBJS += sha1_file.o
74ca5e6d
JH
625LIB_OBJS += sha1_name.o
626LIB_OBJS += shallow.o
627LIB_OBJS += sideband.o
4a16d072 628LIB_OBJS += sigchain.o
74ca5e6d 629LIB_OBJS += strbuf.o
fcb6c076 630LIB_OBJS += string-list.o
752c0c24 631LIB_OBJS += submodule.o
74ca5e6d
JH
632LIB_OBJS += symlinks.o
633LIB_OBJS += tag.o
634LIB_OBJS += trace.o
635LIB_OBJS += transport.o
6eb996b5 636LIB_OBJS += transport-helper.o
74ca5e6d
JH
637LIB_OBJS += tree-diff.o
638LIB_OBJS += tree.o
639LIB_OBJS += tree-walk.o
640LIB_OBJS += unpack-trees.o
641LIB_OBJS += usage.o
fcb6c076 642LIB_OBJS += userdiff.o
74ca5e6d
JH
643LIB_OBJS += utf8.o
644LIB_OBJS += walker.o
112db553 645LIB_OBJS += wrapper.o
74ca5e6d
JH
646LIB_OBJS += write_or_die.o
647LIB_OBJS += ws.o
648LIB_OBJS += wt-status.o
649LIB_OBJS += xdiff-interface.o
650
651BUILTIN_OBJS += builtin-add.o
652BUILTIN_OBJS += builtin-annotate.o
653BUILTIN_OBJS += builtin-apply.o
654BUILTIN_OBJS += builtin-archive.o
1bf072e3 655BUILTIN_OBJS += builtin-bisect--helper.o
74ca5e6d
JH
656BUILTIN_OBJS += builtin-blame.o
657BUILTIN_OBJS += builtin-branch.o
658BUILTIN_OBJS += builtin-bundle.o
659BUILTIN_OBJS += builtin-cat-file.o
660BUILTIN_OBJS += builtin-check-attr.o
661BUILTIN_OBJS += builtin-check-ref-format.o
662BUILTIN_OBJS += builtin-checkout-index.o
663BUILTIN_OBJS += builtin-checkout.o
664BUILTIN_OBJS += builtin-clean.o
8434c2f1 665BUILTIN_OBJS += builtin-clone.o
74ca5e6d
JH
666BUILTIN_OBJS += builtin-commit-tree.o
667BUILTIN_OBJS += builtin-commit.o
668BUILTIN_OBJS += builtin-config.o
669BUILTIN_OBJS += builtin-count-objects.o
670BUILTIN_OBJS += builtin-describe.o
671BUILTIN_OBJS += builtin-diff-files.o
672BUILTIN_OBJS += builtin-diff-index.o
673BUILTIN_OBJS += builtin-diff-tree.o
674BUILTIN_OBJS += builtin-diff.o
675BUILTIN_OBJS += builtin-fast-export.o
74ca5e6d
JH
676BUILTIN_OBJS += builtin-fetch-pack.o
677BUILTIN_OBJS += builtin-fetch.o
678BUILTIN_OBJS += builtin-fmt-merge-msg.o
679BUILTIN_OBJS += builtin-for-each-ref.o
680BUILTIN_OBJS += builtin-fsck.o
681BUILTIN_OBJS += builtin-gc.o
682BUILTIN_OBJS += builtin-grep.o
b28a1ce0 683BUILTIN_OBJS += builtin-hash-object.o
3d78d1f1 684BUILTIN_OBJS += builtin-help.o
3bb72562 685BUILTIN_OBJS += builtin-index-pack.o
74ca5e6d
JH
686BUILTIN_OBJS += builtin-init-db.o
687BUILTIN_OBJS += builtin-log.o
688BUILTIN_OBJS += builtin-ls-files.o
689BUILTIN_OBJS += builtin-ls-remote.o
690BUILTIN_OBJS += builtin-ls-tree.o
691BUILTIN_OBJS += builtin-mailinfo.o
692BUILTIN_OBJS += builtin-mailsplit.o
1c7b76be 693BUILTIN_OBJS += builtin-merge.o
74ca5e6d
JH
694BUILTIN_OBJS += builtin-merge-base.o
695BUILTIN_OBJS += builtin-merge-file.o
0ecace72 696BUILTIN_OBJS += builtin-merge-index.o
74ca5e6d
JH
697BUILTIN_OBJS += builtin-merge-ours.o
698BUILTIN_OBJS += builtin-merge-recursive.o
907a7cb5 699BUILTIN_OBJS += builtin-merge-tree.o
112dd514 700BUILTIN_OBJS += builtin-mktag.o
633e3556 701BUILTIN_OBJS += builtin-mktree.o
74ca5e6d
JH
702BUILTIN_OBJS += builtin-mv.o
703BUILTIN_OBJS += builtin-name-rev.o
704BUILTIN_OBJS += builtin-pack-objects.o
377d0276 705BUILTIN_OBJS += builtin-pack-redundant.o
74ca5e6d 706BUILTIN_OBJS += builtin-pack-refs.o
dedc0ec5 707BUILTIN_OBJS += builtin-patch-id.o
74ca5e6d
JH
708BUILTIN_OBJS += builtin-prune-packed.o
709BUILTIN_OBJS += builtin-prune.o
710BUILTIN_OBJS += builtin-push.o
711BUILTIN_OBJS += builtin-read-tree.o
be5908ae 712BUILTIN_OBJS += builtin-receive-pack.o
74ca5e6d
JH
713BUILTIN_OBJS += builtin-reflog.o
714BUILTIN_OBJS += builtin-remote.o
54b0c1e0 715BUILTIN_OBJS += builtin-replace.o
74ca5e6d
JH
716BUILTIN_OBJS += builtin-rerere.o
717BUILTIN_OBJS += builtin-reset.o
718BUILTIN_OBJS += builtin-rev-list.o
719BUILTIN_OBJS += builtin-rev-parse.o
720BUILTIN_OBJS += builtin-revert.o
721BUILTIN_OBJS += builtin-rm.o
722BUILTIN_OBJS += builtin-send-pack.o
723BUILTIN_OBJS += builtin-shortlog.o
724BUILTIN_OBJS += builtin-show-branch.o
725BUILTIN_OBJS += builtin-show-ref.o
726BUILTIN_OBJS += builtin-stripspace.o
727BUILTIN_OBJS += builtin-symbolic-ref.o
728BUILTIN_OBJS += builtin-tag.o
729BUILTIN_OBJS += builtin-tar-tree.o
b5325818 730BUILTIN_OBJS += builtin-unpack-file.o
74ca5e6d
JH
731BUILTIN_OBJS += builtin-unpack-objects.o
732BUILTIN_OBJS += builtin-update-index.o
733BUILTIN_OBJS += builtin-update-ref.o
53a1116c 734BUILTIN_OBJS += builtin-update-server-info.o
74ca5e6d 735BUILTIN_OBJS += builtin-upload-archive.o
55b6745d 736BUILTIN_OBJS += builtin-var.o
74ca5e6d
JH
737BUILTIN_OBJS += builtin-verify-pack.o
738BUILTIN_OBJS += builtin-verify-tag.o
739BUILTIN_OBJS += builtin-write-tree.o
70827b15 740
daa99a91
JN
741TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
742
54c261f9 743GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
bef19da9 744EXTLIBS =
cef661fc 745
229a7ed7
JH
746#
747# Platform specific tweaks
748#
f7c15343
JH
749
750# We choose to avoid "if .. else if .. else .. endif endif"
751# because maintaining the nesting to match is a pain. If
752# we had "elif" things would have been much nicer...
f7c15343 753
817151e6
PE
754ifeq ($(uname_S),Linux)
755 NO_STRLCPY = YesPlease
0620b39b 756 NO_MKSTEMPS = YesPlease
38bd6497 757 THREADED_DELTA_SEARCH = YesPlease
817151e6 758endif
ca7a7416
GP
759ifeq ($(uname_S),GNU/kFreeBSD)
760 NO_STRLCPY = YesPlease
0620b39b 761 NO_MKSTEMPS = YesPlease
38bd6497 762 THREADED_DELTA_SEARCH = YesPlease
ca7a7416 763endif
457bb452
BLG
764ifeq ($(uname_S),UnixWare)
765 CC = cc
766 NEEDS_SOCKET = YesPlease
767 NEEDS_NSL = YesPlease
768 NEEDS_SSL_WITH_CRYPTO = YesPlease
769 NEEDS_LIBICONV = YesPlease
770 SHELL_PATH = /usr/local/bin/bash
771 NO_IPV6 = YesPlease
772 NO_HSTRERROR = YesPlease
0620b39b 773 NO_MKSTEMPS = YesPlease
457bb452
BLG
774 BASIC_CFLAGS += -Kthread
775 BASIC_CFLAGS += -I/usr/local/include
776 BASIC_LDFLAGS += -L/usr/local/lib
777 INSTALL = ginstall
778 TAR = gtar
779 NO_STRCASESTR = YesPlease
780 NO_MEMMEM = YesPlease
781endif
782ifeq ($(uname_S),SCO_SV)
783 ifeq ($(uname_R),3.2)
784 CFLAGS = -O2
785 endif
786 ifeq ($(uname_R),5)
787 CC = cc
788 BASIC_CFLAGS += -Kthread
789 endif
790 NEEDS_SOCKET = YesPlease
791 NEEDS_NSL = YesPlease
792 NEEDS_SSL_WITH_CRYPTO = YesPlease
793 NEEDS_LIBICONV = YesPlease
794 SHELL_PATH = /usr/bin/bash
795 NO_IPV6 = YesPlease
796 NO_HSTRERROR = YesPlease
0620b39b 797 NO_MKSTEMPS = YesPlease
457bb452
BLG
798 BASIC_CFLAGS += -I/usr/local/include
799 BASIC_LDFLAGS += -L/usr/local/lib
800 NO_STRCASESTR = YesPlease
801 NO_MEMMEM = YesPlease
802 INSTALL = ginstall
803 TAR = gtar
804endif
f7c15343 805ifeq ($(uname_S),Darwin)
0460dba4 806 NEEDS_CRYPTO_WITH_SSL = YesPlease
597c9cc5
JH
807 NEEDS_SSL_WITH_CRYPTO = YesPlease
808 NEEDS_LIBICONV = YesPlease
7233d221 809 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
fe4aafba
WC
810 OLD_ICONV = UnfortunatelyYes
811 endif
7233d221
JS
812 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
813 NO_STRLCPY = YesPlease
814 endif
3d59405c 815 NO_MEMMEM = YesPlease
954597bd 816 THREADED_DELTA_SEARCH = YesPlease
c567383b 817 USE_ST_TIMESPEC = YesPlease
597c9cc5 818endif
f7c15343 819ifeq ($(uname_S),SunOS)
f0ebff0d 820 NEEDS_SOCKET = YesPlease
5a90d4ac 821 NEEDS_NSL = YesPlease
229a7ed7 822 SHELL_PATH = /bin/bash
0e0aea5a 823 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
229a7ed7 824 NO_STRCASESTR = YesPlease
b21b9f1d 825 NO_MEMMEM = YesPlease
4e0da763 826 NO_MKDTEMP = YesPlease
0620b39b 827 NO_MKSTEMPS = YesPlease
ee78cac2 828 NO_REGEX = YesPlease
294ac78d 829 THREADED_DELTA_SEARCH = YesPlease
a7a24ee7
BC
830 ifeq ($(uname_R),5.7)
831 NEEDS_RESOLV = YesPlease
832 NO_IPV6 = YesPlease
833 NO_SOCKADDR_STORAGE = YesPlease
834 NO_UNSETENV = YesPlease
835 NO_SETENV = YesPlease
836 NO_STRLCPY = YesPlease
837 NO_C99_FORMAT = YesPlease
838 NO_STRTOUMAX = YesPlease
a0c0be97 839 endif
e40b61fb 840 ifeq ($(uname_R),5.8)
731043fd 841 NO_UNSETENV = YesPlease
e40b61fb 842 NO_SETENV = YesPlease
66c4509b 843 NO_C99_FORMAT = YesPlease
bc6b4f52 844 NO_STRTOUMAX = YesPlease
e40b61fb 845 endif
40d88d4f
DS
846 ifeq ($(uname_R),5.9)
847 NO_UNSETENV = YesPlease
848 NO_SETENV = YesPlease
66c4509b 849 NO_C99_FORMAT = YesPlease
bc6b4f52 850 NO_STRTOUMAX = YesPlease
40d88d4f 851 endif
efc07deb 852 INSTALL = /usr/ucb/install
229a7ed7 853 TAR = gtar
1d7b1af4 854 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
f0ebff0d 855endif
f7c15343 856ifeq ($(uname_O),Cygwin)
63be37b0 857 NO_D_TYPE_IN_DIRENT = YesPlease
35a730f0 858 NO_D_INO_IN_DIRENT = YesPlease
17754517 859 NO_STRCASESTR = YesPlease
b21b9f1d 860 NO_MEMMEM = YesPlease
0620b39b 861 NO_MKSTEMPS = YesPlease
9f0bb90d 862 NO_SYMLINK_HEAD = YesPlease
17754517 863 NEEDS_LIBICONV = YesPlease
1510fea7 864 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
c869753e 865 NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
7a4a2e1f 866 OLD_ICONV = UnfortunatelyYes
75607874 867 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
2e67a5f4
JH
868 # There are conflicting reports about this.
869 # On some boxes NO_MMAP is needed, and not so elsewhere.
87ac1390
JH
870 # Try commenting this out if you suspect MMAP is more efficient
871 NO_MMAP = YesPlease
49744d63 872 NO_IPV6 = YesPlease
a23cd8ec 873 X = .exe
035b76b0
RJ
874 COMPAT_OBJS += compat/cygwin.o
875 UNRELIABLE_FSTAT = UnfortunatelyYes
7c6ef2f2 876endif
b3bf974c
AK
877ifeq ($(uname_S),FreeBSD)
878 NEEDS_LIBICONV = YesPlease
21a0d9b4 879 OLD_ICONV = YesPlease
a2f22dbf 880 NO_MEMMEM = YesPlease
8d7f586f
PB
881 BASIC_CFLAGS += -I/usr/local/include
882 BASIC_LDFLAGS += -L/usr/local/lib
81a24b52 883 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
91408042 884 USE_ST_TIMESPEC = YesPlease
38bd6497 885 THREADED_DELTA_SEARCH = YesPlease
069bb576 886 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
158629b2 887 PTHREAD_LIBS = -pthread
069bb576
DS
888 NO_UINTMAX_T = YesPlease
889 NO_STRTOUMAX = YesPlease
890 endif
b3bf974c 891endif
f7c15343 892ifeq ($(uname_S),OpenBSD)
5fb41e8a 893 NO_STRCASESTR = YesPlease
b21b9f1d 894 NO_MEMMEM = YesPlease
90f2e652 895 USE_ST_TIMESPEC = YesPlease
18c5a525 896 NEEDS_LIBICONV = YesPlease
8d7f586f
PB
897 BASIC_CFLAGS += -I/usr/local/include
898 BASIC_LDFLAGS += -L/usr/local/lib
38bd6497 899 THREADED_DELTA_SEARCH = YesPlease
94d23317
JH
900endif
901ifeq ($(uname_S),NetBSD)
e88856b4
DS
902 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
903 NEEDS_LIBICONV = YesPlease
904 endif
8d7f586f 905 BASIC_CFLAGS += -I/usr/pkg/include
f5b904db 906 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
38bd6497 907 THREADED_DELTA_SEARCH = YesPlease
9a695fbf 908 USE_ST_TIMESPEC = YesPlease
0620b39b 909 NO_MKSTEMPS = YesPlease
18c5a525 910endif
a6da9395
JR
911ifeq ($(uname_S),AIX)
912 NO_STRCASESTR=YesPlease
b21b9f1d 913 NO_MEMMEM = YesPlease
377d9c40 914 NO_MKDTEMP = YesPlease
0620b39b 915 NO_MKSTEMPS = YesPlease
817151e6 916 NO_STRLCPY = YesPlease
c06ff490 917 NO_NSEC = YesPlease
377d9c40
MR
918 FREAD_READS_DIRECTORIES = UnfortunatelyYes
919 INTERNAL_QSORT = UnfortunatelyYes
a6da9395 920 NEEDS_LIBICONV=YesPlease
377d9c40 921 BASIC_CFLAGS += -D_LARGE_FILES
46059cc6
JH
922 ifneq ($(shell expr "$(uname_V)" : '[1234]'),1)
923 THREADED_DELTA_SEARCH = YesPlease
924 else
925 NO_PTHREADS = YesPlease
926 endif
a6da9395 927endif
c29ba0c3
TS
928ifeq ($(uname_S),GNU)
929 # GNU/Hurd
930 NO_STRLCPY=YesPlease
0620b39b 931 NO_MKSTEMPS = YesPlease
c29ba0c3 932endif
1fdffc1b
BC
933ifeq ($(uname_S),IRIX)
934 NO_SETENV = YesPlease
935 NO_UNSETENV = YesPlease
936 NO_STRCASESTR = YesPlease
937 NO_MEMMEM = YesPlease
938 NO_MKSTEMPS = YesPlease
939 NO_MKDTEMP = YesPlease
651aef34
BC
940 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
941 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
942 # git dies with a segmentation fault when trying to access the first
943 # entry of a reflog. The conservative choice is made to always set
944 # NO_MMAP. If you suspect that your compiler is not affected by this
945 # issue, comment out the NO_MMAP statement.
1fdffc1b 946 NO_MMAP = YesPlease
1fdffc1b
BC
947 SNPRINTF_RETURNS_BOGUS = YesPlease
948 SHELL_PATH = /usr/gnu/bin/bash
949 NEEDS_LIBGEN = YesPlease
817350d3 950 THREADED_DELTA_SEARCH = YesPlease
1fdffc1b 951endif
289c4b36 952ifeq ($(uname_S),IRIX64)
289c4b36 953 NO_SETENV=YesPlease
7c74ff50 954 NO_UNSETENV = YesPlease
289c4b36 955 NO_STRCASESTR=YesPlease
b21b9f1d 956 NO_MEMMEM = YesPlease
0620b39b 957 NO_MKSTEMPS = YesPlease
7c74ff50 958 NO_MKDTEMP = YesPlease
651aef34
BC
959 # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads
960 # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set),
961 # git dies with a segmentation fault when trying to access the first
962 # entry of a reflog. The conservative choice is made to always set
963 # NO_MMAP. If you suspect that your compiler is not affected by this
964 # issue, comment out the NO_MMAP statement.
7c74ff50 965 NO_MMAP = YesPlease
7c74ff50 966 SNPRINTF_RETURNS_BOGUS = YesPlease
289c4b36 967 SHELL_PATH=/usr/gnu/bin/bash
7c74ff50 968 NEEDS_LIBGEN = YesPlease
817350d3 969 THREADED_DELTA_SEARCH = YesPlease
289c4b36 970endif
81cc66a5
RS
971ifeq ($(uname_S),HP-UX)
972 NO_IPV6=YesPlease
973 NO_SETENV=YesPlease
974 NO_STRCASESTR=YesPlease
975 NO_MEMMEM = YesPlease
0620b39b 976 NO_MKSTEMPS = YesPlease
81cc66a5
RS
977 NO_STRLCPY = YesPlease
978 NO_MKDTEMP = YesPlease
979 NO_UNSETENV = YesPlease
980 NO_HSTRERROR = YesPlease
981 NO_SYS_SELECT_H = YesPlease
7d770163 982 SNPRINTF_RETURNS_BOGUS = YesPlease
81cc66a5 983endif
d691d84e 984ifeq ($(uname_S),Windows)
f5c31781 985 GIT_VERSION := $(GIT_VERSION).MSVC
164a5e3f
MSO
986 pathsep = ;
987 NO_PREAD = YesPlease
c36e1638 988 NEEDS_CRYPTO_WITH_SSL = YesPlease
164a5e3f
MSO
989 NO_LIBGEN_H = YesPlease
990 NO_SYMLINK_HEAD = YesPlease
991 NO_IPV6 = YesPlease
992 NO_SETENV = YesPlease
993 NO_UNSETENV = YesPlease
994 NO_STRCASESTR = YesPlease
995 NO_STRLCPY = YesPlease
996 NO_MEMMEM = YesPlease
997 # NEEDS_LIBICONV = YesPlease
998 NO_ICONV = YesPlease
999 NO_C99_FORMAT = YesPlease
1000 NO_STRTOUMAX = YesPlease
1001 NO_STRTOULL = YesPlease
1002 NO_MKDTEMP = YesPlease
1003 NO_MKSTEMPS = YesPlease
1004 SNPRINTF_RETURNS_BOGUS = YesPlease
1005 NO_SVN_TESTS = YesPlease
1006 NO_PERL_MAKEMAKER = YesPlease
1007 RUNTIME_PREFIX = YesPlease
1008 NO_POSIX_ONLY_PROGRAMS = YesPlease
1009 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
1010 NO_NSEC = YesPlease
1011 USE_WIN32_MMAP = YesPlease
1012 # USE_NED_ALLOCATOR = YesPlease
1013 UNRELIABLE_FSTAT = UnfortunatelyYes
1014 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
1015 NO_REGEX = YesPlease
1016 NO_CURL = YesPlease
56932249 1017 NO_PYTHON = YesPlease
9bccfcdb 1018 BLK_SHA1 = YesPlease
44626dc7 1019 THREADED_DELTA_SEARCH = YesPlease
164a5e3f
MSO
1020
1021 CC = compat/vcbuild/scripts/clink.pl
1022 AR = compat/vcbuild/scripts/lib.pl
1023 CFLAGS =
f2d50d93 1024 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
44626dc7
AH
1025 COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
1026 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\"
164a5e3f
MSO
1027 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
1028 EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
767f8b31 1029 PTHREAD_LIBS =
164a5e3f
MSO
1030 lib =
1031ifndef DEBUG
1032 BASIC_CFLAGS += -GL -Os -MT
1033 BASIC_LDFLAGS += -LTCG
1034 AR += -LTCG
1035else
1036 BASIC_CFLAGS += -Zi -MTd
1037endif
1038 X = .exe
d691d84e 1039endif
f4626df5 1040ifneq (,$(findstring MINGW,$(uname_S)))
352c8111 1041 pathsep = ;
f4626df5 1042 NO_PREAD = YesPlease
4192e1cd 1043 NEEDS_CRYPTO_WITH_SSL = YesPlease
e1c06886 1044 NO_LIBGEN_H = YesPlease
f4626df5 1045 NO_SYMLINK_HEAD = YesPlease
f4626df5
JS
1046 NO_SETENV = YesPlease
1047 NO_UNSETENV = YesPlease
1048 NO_STRCASESTR = YesPlease
1049 NO_STRLCPY = YesPlease
1050 NO_MEMMEM = YesPlease
1051 NEEDS_LIBICONV = YesPlease
1052 OLD_ICONV = YesPlease
1053 NO_C99_FORMAT = YesPlease
1054 NO_STRTOUMAX = YesPlease
1055 NO_MKDTEMP = YesPlease
0620b39b 1056 NO_MKSTEMPS = YesPlease
f4626df5
JS
1057 SNPRINTF_RETURNS_BOGUS = YesPlease
1058 NO_SVN_TESTS = YesPlease
1059 NO_PERL_MAKEMAKER = YesPlease
25655221 1060 RUNTIME_PREFIX = YesPlease
f4626df5 1061 NO_POSIX_ONLY_PROGRAMS = YesPlease
fdb2a2a6 1062 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
c06ff490 1063 NO_NSEC = YesPlease
b130a72b 1064 USE_WIN32_MMAP = YesPlease
f0ed8226 1065 USE_NED_ALLOCATOR = YesPlease
34779c53 1066 UNRELIABLE_FSTAT = UnfortunatelyYes
348df166 1067 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
02232adf 1068 NO_REGEX = YesPlease
56932249 1069 NO_PYTHON = YesPlease
9bccfcdb 1070 BLK_SHA1 = YesPlease
44626dc7 1071 THREADED_DELTA_SEARCH = YesPlease
767f8b31 1072 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
23326d14 1073 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
44626dc7
AH
1074 COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
1075 compat/win32/pthread.o
f4626df5 1076 EXTLIBS += -lws2_32
767f8b31 1077 PTHREAD_LIBS =
f4626df5 1078 X = .exe
48c46f1a
SP
1079ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
1080 htmldir=doc/git/html/
1081 prefix =
1082 INSTALL = /bin/install
1083 EXTLIBS += /mingw/lib/libz.a
1084 NO_R_TO_GCC_LINKER = YesPlease
1085 INTERNAL_QSORT = YesPlease
48c46f1a
SP
1086else
1087 NO_CURL = YesPlease
48c46f1a 1088endif
f4626df5 1089endif
597c9cc5 1090
55667714 1091-include config.mak.autogen
f2d6a256 1092-include config.mak
597c9cc5 1093
f2fabbf7
JN
1094ifdef CHECK_HEADER_DEPENDENCIES
1095USE_COMPUTED_HEADER_DEPENDENCIES =
1096endif
1097
1098ifdef COMPUTE_HEADER_DEPENDENCIES
1099USE_COMPUTED_HEADER_DEPENDENCIES = YesPlease
1100endif
1101
0e0aea5a 1102ifdef SANE_TOOL_PATH
61dbb3c4
JH
1103SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
1104BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
0e0aea5a
JH
1105PATH := $(SANE_TOOL_PATH):${PATH}
1106else
61dbb3c4 1107BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
0e0aea5a
JH
1108endif
1109
59f86740
BG
1110ifeq ($(uname_S),Darwin)
1111 ifndef NO_FINK
1112 ifeq ($(shell test -d /sw/lib && echo y),y)
1113 BASIC_CFLAGS += -I/sw/include
1114 BASIC_LDFLAGS += -L/sw/lib
1115 endif
1116 endif
1117 ifndef NO_DARWIN_PORTS
1118 ifeq ($(shell test -d /opt/local/lib && echo y),y)
1119 BASIC_CFLAGS += -I/opt/local/include
1120 BASIC_LDFLAGS += -L/opt/local/lib
1121 endif
1122 endif
f7d9d04e 1123 PTHREAD_LIBS =
59f86740
BG
1124endif
1125
f5b904db
JH
1126ifndef CC_LD_DYNPATH
1127 ifdef NO_R_TO_GCC_LINKER
1128 # Some gcc does not accept and pass -R to the linker to specify
1129 # the runtime dynamic library path.
1130 CC_LD_DYNPATH = -Wl,-rpath,
1131 else
1132 CC_LD_DYNPATH = -R
1133 endif
bbfc63dd
JH
1134endif
1135
e1c06886
DA
1136ifdef NO_LIBGEN_H
1137 COMPAT_CFLAGS += -DNO_LIBGEN_H
1138 COMPAT_OBJS += compat/basename.o
1139endif
1140
30ae764b
DB
1141ifdef NO_CURL
1142 BASIC_CFLAGS += -DNO_CURL
4256f36c
JS
1143 REMOTE_CURL_PRIMARY =
1144 REMOTE_CURL_ALIASES =
1145 REMOTE_CURL_NAMES =
30ae764b 1146else
229a7ed7 1147 ifdef CURLDIR
10861bea 1148 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
8d7f586f 1149 BASIC_CFLAGS += -I$(CURLDIR)/include
10861bea 1150 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
229a7ed7
JH
1151 else
1152 CURL_LIBCURL = -lcurl
1153 endif
4256f36c
JS
1154 REMOTE_CURL_PRIMARY = git-remote-http$X
1155 REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
1156 REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
1b22c99c
JN
1157 PROGRAM_OBJS += http-fetch.o
1158 PROGRAMS += $(REMOTE_CURL_NAMES)
08900987
NH
1159 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
1160 ifeq "$(curl_check)" "070908"
1161 ifndef NO_EXPAT
1b22c99c 1162 PROGRAM_OBJS += http-push.o
08900987 1163 endif
58e60dd2 1164 endif
459a21bd 1165 ifndef NO_EXPAT
85b4518f
SB
1166 ifdef EXPATDIR
1167 BASIC_CFLAGS += -I$(EXPATDIR)/include
1168 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
1169 else
1170 EXPAT_LIBEXPAT = -lexpat
1171 endif
459a21bd 1172 endif
229a7ed7
JH
1173endif
1174
bef19da9
RS
1175ifdef ZLIB_PATH
1176 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
10861bea 1177 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
bef19da9
RS
1178endif
1179EXTLIBS += -lz
1180
58eda022 1181ifndef NO_POSIX_ONLY_PROGRAMS
1b22c99c 1182 PROGRAM_OBJS += daemon.o
58eda022 1183endif
dd53c7ab 1184ifndef NO_OPENSSL
215a7ad1 1185 OPENSSL_LIBSSL = -lssl
455a7f32 1186 ifdef OPENSSLDIR
8d7f586f 1187 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
10861bea 1188 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
455a7f32
JH
1189 else
1190 OPENSSL_LINK =
1191 endif
0460dba4
BG
1192 ifdef NEEDS_CRYPTO_WITH_SSL
1193 OPENSSL_LINK += -lcrypto
1194 endif
dd53c7ab 1195else
8d7f586f 1196 BASIC_CFLAGS += -DNO_OPENSSL
30ae47b4 1197 BLK_SHA1 = 1
215a7ad1 1198 OPENSSL_LIBSSL =
dd53c7ab 1199endif
597c9cc5 1200ifdef NEEDS_SSL_WITH_CRYPTO
455a7f32 1201 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
597c9cc5 1202else
455a7f32 1203 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
597c9cc5
JH
1204endif
1205ifdef NEEDS_LIBICONV
455a7f32 1206 ifdef ICONVDIR
8d7f586f 1207 BASIC_CFLAGS += -I$(ICONVDIR)/include
10861bea 1208 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
455a7f32
JH
1209 else
1210 ICONV_LINK =
1211 endif
d595a473 1212 EXTLIBS += $(ICONV_LINK) -liconv
597c9cc5 1213endif
ecc395c1
BC
1214ifdef NEEDS_LIBGEN
1215 EXTLIBS += -lgen
1216endif
f0ebff0d 1217ifdef NEEDS_SOCKET
d595a473 1218 EXTLIBS += -lsocket
f0ebff0d 1219endif
5a90d4ac 1220ifdef NEEDS_NSL
d595a473 1221 EXTLIBS += -lnsl
5a90d4ac 1222endif
70cf9910
BC
1223ifdef NEEDS_RESOLV
1224 EXTLIBS += -lresolv
1225endif
63be37b0 1226ifdef NO_D_TYPE_IN_DIRENT
8d7f586f 1227 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
63be37b0 1228endif
35a730f0 1229ifdef NO_D_INO_IN_DIRENT
8d7f586f 1230 BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
35a730f0 1231endif
fdb2a2a6
JH
1232ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1233 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1234endif
d7371a2d
BG
1235ifdef USE_NSEC
1236 BASIC_CFLAGS += -DUSE_NSEC
1237endif
c567383b
BG
1238ifdef USE_ST_TIMESPEC
1239 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1240endif
c06ff490
KB
1241ifdef NO_NSEC
1242 BASIC_CFLAGS += -DNO_NSEC
1243endif
579d1fbf 1244ifdef NO_C99_FORMAT
8188e73b 1245 BASIC_CFLAGS += -DNO_C99_FORMAT
579d1fbf 1246endif
c4582f93
MR
1247ifdef SNPRINTF_RETURNS_BOGUS
1248 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1249 COMPAT_OBJS += compat/snprintf.o
1250endif
cba22528
BC
1251ifdef FREAD_READS_DIRECTORIES
1252 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1253 COMPAT_OBJS += compat/fopen.o
1254endif
9f0bb90d 1255ifdef NO_SYMLINK_HEAD
8d7f586f 1256 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
9f0bb90d 1257endif
ef34af24 1258ifdef NO_STRCASESTR
4050c0df 1259 COMPAT_CFLAGS += -DNO_STRCASESTR
e40b61fb
JR
1260 COMPAT_OBJS += compat/strcasestr.o
1261endif
817151e6
PE
1262ifdef NO_STRLCPY
1263 COMPAT_CFLAGS += -DNO_STRLCPY
1264 COMPAT_OBJS += compat/strlcpy.o
1265endif
bc6b4f52
JR
1266ifdef NO_STRTOUMAX
1267 COMPAT_CFLAGS += -DNO_STRTOUMAX
1268 COMPAT_OBJS += compat/strtoumax.o
1269endif
1270ifdef NO_STRTOULL
1271 COMPAT_CFLAGS += -DNO_STRTOULL
1272endif
e40b61fb 1273ifdef NO_SETENV
4050c0df 1274 COMPAT_CFLAGS += -DNO_SETENV
e40b61fb 1275 COMPAT_OBJS += compat/setenv.o
ef34af24 1276endif
ca5bb5d5
SP
1277ifdef NO_MKDTEMP
1278 COMPAT_CFLAGS += -DNO_MKDTEMP
1279 COMPAT_OBJS += compat/mkdtemp.o
1280endif
0620b39b
DA
1281ifdef NO_MKSTEMPS
1282 COMPAT_CFLAGS += -DNO_MKSTEMPS
1283 COMPAT_OBJS += compat/mkstemps.o
1284endif
104ff34a 1285ifdef NO_UNSETENV
731043fd
JR
1286 COMPAT_CFLAGS += -DNO_UNSETENV
1287 COMPAT_OBJS += compat/unsetenv.o
1288endif
2600973f
RS
1289ifdef NO_SYS_SELECT_H
1290 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1291endif
730d48a2 1292ifdef NO_MMAP
4050c0df 1293 COMPAT_CFLAGS += -DNO_MMAP
e40b61fb 1294 COMPAT_OBJS += compat/mmap.o
b130a72b
JL
1295else
1296 ifdef USE_WIN32_MMAP
1297 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1298 COMPAT_OBJS += compat/win32mmap.o
1299 endif
730d48a2 1300endif
348df166
JS
1301ifdef OBJECT_CREATION_USES_RENAMES
1302 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
be66a6c4 1303endif
6900679c
SH
1304ifdef NO_PREAD
1305 COMPAT_CFLAGS += -DNO_PREAD
1306 COMPAT_OBJS += compat/pread.o
1307endif
1510fea7
SP
1308ifdef NO_FAST_WORKING_DIRECTORY
1309 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1310endif
c869753e
SP
1311ifdef NO_TRUSTABLE_FILEMODE
1312 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1313endif
49744d63 1314ifdef NO_IPV6
8d7f586f 1315 BASIC_CFLAGS += -DNO_IPV6
bdc37f5a 1316endif
0bc3e781
DS
1317ifdef NO_UINTMAX_T
1318 BASIC_CFLAGS += -Duintmax_t=uint32_t
1319endif
bdc37f5a
JH
1320ifdef NO_SOCKADDR_STORAGE
1321ifdef NO_IPV6
8d7f586f 1322 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
bdc37f5a 1323else
8d7f586f 1324 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
bdc37f5a 1325endif
49744d63 1326endif
6ba68ab2
YL
1327ifdef NO_INET_NTOP
1328 LIB_OBJS += compat/inet_ntop.o
1329endif
dd467629
JL
1330ifdef NO_INET_PTON
1331 LIB_OBJS += compat/inet_pton.o
1332endif
cef661fc 1333
b6e56eca 1334ifdef NO_ICONV
8d7f586f 1335 BASIC_CFLAGS += -DNO_ICONV
b6e56eca
FP
1336endif
1337
fd547a97
RJ
1338ifdef OLD_ICONV
1339 BASIC_CFLAGS += -DOLD_ICONV
1340endif
1341
609a2289
DS
1342ifdef NO_DEFLATE_BOUND
1343 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1344endif
1345
d7c208a9
LT
1346ifdef BLK_SHA1
1347 SHA1_HEADER = "block-sha1/sha1.h"
1348 LIB_OBJS += block-sha1/sha1.o
21528abc 1349 LIB_H += block-sha1/sha1.h
d7c208a9 1350else
7c6ef2f2
NP
1351ifdef PPC_SHA1
1352 SHA1_HEADER = "ppc/sha1.h"
1353 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
21528abc 1354 LIB_H += ppc/sha1.h
7c6ef2f2
NP
1355else
1356 SHA1_HEADER = <openssl/sha.h>
d595a473 1357 EXTLIBS += $(LIB_4_CRYPTO)
7c6ef2f2
NP
1358endif
1359endif
f848718a
AR
1360ifdef NO_PERL_MAKEMAKER
1361 export NO_PERL_MAKEMAKER
1362endif
fa0c87c3
AR
1363ifdef NO_HSTRERROR
1364 COMPAT_CFLAGS += -DNO_HSTRERROR
1365 COMPAT_OBJS += compat/hstrerror.o
1366endif
b21b9f1d
RS
1367ifdef NO_MEMMEM
1368 COMPAT_CFLAGS += -DNO_MEMMEM
1369 COMPAT_OBJS += compat/memmem.o
1370endif
43fe901b
BD
1371ifdef INTERNAL_QSORT
1372 COMPAT_CFLAGS += -DINTERNAL_QSORT
1373 COMPAT_OBJS += compat/qsort.o
1374endif
35fb0e86
SP
1375ifdef RUNTIME_PREFIX
1376 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1377endif
b7774343 1378
46059cc6
JH
1379ifdef NO_PTHREADS
1380 THREADED_DELTA_SEARCH =
1381 BASIC_CFLAGS += -DNO_PTHREADS
1382else
1383 EXTLIBS += $(PTHREAD_LIBS)
1384endif
1385
8ecce684
NP
1386ifdef THREADED_DELTA_SEARCH
1387 BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
833e3df1 1388 LIB_OBJS += thread-utils.o
8ecce684 1389endif
81a24b52
AR
1390ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1391 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1392endif
34779c53
JS
1393ifdef UNRELIABLE_FSTAT
1394 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1395endif
02232adf
JK
1396ifdef NO_REGEX
1397 COMPAT_CFLAGS += -Icompat/regex
1398 COMPAT_OBJS += compat/regex/regex.o
1399endif
8ecce684 1400
f0ed8226
MSO
1401ifdef USE_NED_ALLOCATOR
1402 COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
1403 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1404endif
1405
81b63c70
ER
1406ifeq ($(TCLTK_PATH),)
1407NO_TCLTK=NoThanks
1408endif
1409
499c2939
JK
1410ifeq ($(PERL_PATH),)
1411NO_PERL=NoThanks
1412endif
1413
d4e1b47a
JH
1414ifeq ($(PYTHON_PATH),)
1415NO_PYTHON=NoThanks
1416endif
1417
3b486cd2 1418QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
b7774343
AR
1419QUIET_SUBDIR1 =
1420
a6f37099
AR
1421ifneq ($(findstring $(MAKEFLAGS),w),w)
1422PRINT_DIR = --no-print-directory
1423else # "make -w"
1424NO_SUBDIR = :
1425endif
1426
b7774343 1427ifneq ($(findstring $(MAKEFLAGS),s),s)
2314c947 1428ifndef V
31d0399c 1429 QUIET_CC = @echo ' ' CC $@;
74f2b2a8
SP
1430 QUIET_AR = @echo ' ' AR $@;
1431 QUIET_LINK = @echo ' ' LINK $@;
1432 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1433 QUIET_GEN = @echo ' ' GEN $@;
611c7f6a 1434 QUIET_LNCP = @echo ' ' LN/CP $@;
3b486cd2 1435 QUIET_SUBDIR0 = +@subdir=
a6f37099
AR
1436 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1437 $(MAKE) $(PRINT_DIR) -C $$subdir
2314c947 1438 export V
31d0399c 1439 export QUIET_GEN
b7774343
AR
1440 export QUIET_BUILT_IN
1441endif
74f2b2a8 1442endif
7c6ef2f2 1443
4c7100a9
JH
1444ifdef ASCIIDOC8
1445 export ASCIIDOC8
1446endif
1447
addf88e4 1448# Shell quote (do not use $(call) to accommodate ancient setups);
39c015c5
JS
1449
1450SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
32043c9f 1451ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
39c015c5
JS
1452
1453DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1454bindir_SQ = $(subst ','\'',$(bindir))
026fa0d5 1455bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
8e566f24 1456mandir_SQ = $(subst ','\'',$(mandir))
a149a1a4 1457infodir_SQ = $(subst ','\'',$(infodir))
39c015c5
JS
1458gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
1459template_dir_SQ = $(subst ','\'',$(template_dir))
5d6491c7 1460htmldir_SQ = $(subst ','\'',$(htmldir))
ca3bcabf 1461prefix_SQ = $(subst ','\'',$(prefix))
39c015c5
JS
1462
1463SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1464PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
d4e1b47a 1465PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
81b63c70 1466TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
39c015c5 1467
d595a473
PB
1468LIBS = $(GITLIBS) $(EXTLIBS)
1469
32043c9f 1470BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
506b17b1 1471 $(COMPAT_CFLAGS)
e40b61fb 1472LIB_OBJS += $(COMPAT_OBJS)
8d7f586f 1473
8f4b576a
JN
1474# Quote for C
1475
1476ifdef DEFAULT_EDITOR
1477DEFAULT_EDITOR_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_EDITOR)))"
1478DEFAULT_EDITOR_CQ_SQ = $(subst ','\'',$(DEFAULT_EDITOR_CQ))
1479
1480BASIC_CFLAGS += -DDEFAULT_EDITOR='$(DEFAULT_EDITOR_CQ_SQ)'
1481endif
1482
a3d023d0
JH
1483ifdef DEFAULT_PAGER
1484DEFAULT_PAGER_CQ = "$(subst ",\",$(subst \,\\,$(DEFAULT_PAGER)))"
1485DEFAULT_PAGER_CQ_SQ = $(subst ','\'',$(DEFAULT_PAGER_CQ))
1486
1487BASIC_CFLAGS += -DDEFAULT_PAGER='$(DEFAULT_PAGER_CQ_SQ)'
1488endif
1489
8d7f586f
PB
1490ALL_CFLAGS += $(BASIC_CFLAGS)
1491ALL_LDFLAGS += $(BASIC_LDFLAGS)
1492
a42cbacc 1493export TAR INSTALL DESTDIR SHELL_PATH
d595a473
PB
1494
1495
28818ffa
PB
1496### Build rules
1497
c94c8e5f
BC
1498SHELL = $(SHELL_PATH)
1499
6dc4627e 1500all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
6fc301bb 1501ifneq (,$X)
ade2ca0c 1502 $(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';)
6fc301bb 1503endif
89967023 1504
6fc301bb 1505all::
3cfaf11b 1506ifndef NO_TCLTK
e84a063d 1507 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
62ba5143 1508 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
3cfaf11b 1509endif
499c2939 1510ifndef NO_PERL
74f2b2a8 1511 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
2fe40b63
SR
1512endif
1513ifndef NO_PYTHON
1514 $(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
499c2939 1515endif
74f2b2a8 1516 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
b05701c5 1517
6dc4627e
BC
1518please_set_SHELL_PATH_to_a_more_modern_shell:
1519 @$$(:)
1520
1521shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
1522
4dc00021
JH
1523strip: $(PROGRAMS) git$X
1524 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
1525
373a5ede 1526git.o: common-cmds.h
de54e67c 1527git.s git.o: ALL_CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' \
373a5ede 1528 '-DGIT_HTML_PATH="$(htmldir_SQ)"'
334d28ae
JH
1529
1530git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
54dadbdb 1531 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
70827b15 1532 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
6a2e50f9 1533
373a5ede 1534builtin-help.o: common-cmds.h
de54e67c 1535builtin-help.s builtin-help.o: ALL_CFLAGS += \
373a5ede
JN
1536 '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
1537 '-DGIT_MAN_PATH="$(mandir_SQ)"' \
1538 '-DGIT_INFO_PATH="$(infodir_SQ)"'
08df6171 1539
91730800 1540$(BUILT_INS): git$X
3e073dc5
AF
1541 $(QUIET_BUILT_IN)$(RM) $@ && \
1542 ln git$X $@ 2>/dev/null || \
1543 ln -s git$X $@ 2>/dev/null || \
1544 cp git$X $@
91730800 1545
79d30668 1546common-cmds.h: ./generate-cmdlist.sh command-list.txt
48dd1da8 1547
766b084f 1548common-cmds.h: $(wildcard Documentation/git-*.txt)
74f2b2a8 1549 $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
a87cd02c 1550
d6ebd259 1551$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
4cb08df5 1552 $(QUIET_GEN)$(RM) $@ $@+ && \
39c015c5 1553 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
4bf9f27d 1554 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
3ff8cbed 1555 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
6c5c62f3 1556 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
61dbb3c4 1557 -e $(BROKEN_PATH_FIX) \
74f2b2a8
SP
1558 $@.sh >$@+ && \
1559 chmod +x $@+ && \
fc36f6a6 1560 mv $@+ $@
bc6146d2 1561
499c2939 1562ifndef NO_PERL
f848718a
AR
1563$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
1564
d1a20575 1565perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
31d0399c 1566 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
f848718a 1567
f6276fe1 1568$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
4cb08df5 1569 $(QUIET_GEN)$(RM) $@ $@+ && \
e883932f 1570 INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
998c4daa
JH
1571 sed -e '1{' \
1572 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1573 -e ' h' \
352c8111 1574 -e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
998c4daa
JH
1575 -e ' H' \
1576 -e ' x' \
1577 -e '}' \
f6276fe1 1578 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
3ff8cbed 1579 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
74f2b2a8
SP
1580 $@.perl >$@+ && \
1581 chmod +x $@+ && \
fc36f6a6 1582 mv $@+ $@
bc6146d2 1583
63267de2
JN
1584ifdef JSMIN
1585OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb.min.js
1586gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
1587else
62f780dc 1588OTHER_PROGRAMS += gitweb/gitweb.cgi
5d043a3d 1589gitweb/gitweb.cgi: gitweb/gitweb.perl
63267de2 1590endif
4cb08df5 1591 $(QUIET_GEN)$(RM) $@ $@+ && \
5d043a3d 1592 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
06c084d2
JH
1593 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
1594 -e 's|++GIT_BINDIR++|$(bindir)|g' \
1595 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
26ffcb76 1596 -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
2de21fac 1597 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
06c084d2
JH
1598 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
1599 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
ca5e9495 1600 -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
32f4aacc
ML
1601 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
1602 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
19a8721e 1603 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
06c084d2
JH
1604 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
1605 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
1606 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
1607 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
0b5deba1 1608 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
4af819d4 1609 -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
b2d3476e
AC
1610 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
1611 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
74f2b2a8
SP
1612 $< >$@+ && \
1613 chmod +x $@+ && \
5d043a3d
MW
1614 mv $@+ $@
1615
4af819d4 1616git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
4cb08df5 1617 $(QUIET_GEN)$(RM) $@ $@+ && \
a51d37c1
EW
1618 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1619 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1620 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
6e959ab0 1621 -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
07002287 1622 -e '/@@GITWEB_CGI@@/d' \
6e959ab0 1623 -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
07002287 1624 -e '/@@GITWEB_CSS@@/d' \
4af819d4
JN
1625 -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
1626 -e '/@@GITWEB_JS@@/d' \
c5699693 1627 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
74f2b2a8
SP
1628 $@.sh > $@+ && \
1629 chmod +x $@+ && \
a51d37c1 1630 mv $@+ $@
499c2939
JK
1631else # NO_PERL
1632$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
1633 $(QUIET_GEN)$(RM) $@ $@+ && \
1634 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1635 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
1636 unimplemented.sh >$@+ && \
1637 chmod +x $@+ && \
1638 mv $@+ $@
1639endif # NO_PERL
a51d37c1 1640
e74f43f9 1641
63267de2
JN
1642ifdef JSMIN
1643gitweb/gitweb.min.js: gitweb/gitweb.js
1644 $(QUIET_GEN)$(JSMIN) <$< >$@
1645endif # JSMIN
1646
2fe40b63
SR
1647ifndef NO_PYTHON
1648$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
1649$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
1650 $(QUIET_GEN)$(RM) $@ $@+ && \
1651 INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
1652 --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
1653 instlibdir` && \
1654 sed -e '1{' \
1655 -e ' s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
1656 -e '}' \
1657 -e 's|^import sys.*|&; \\\
1658 import os; \\\
1659 sys.path[0] = os.environ.has_key("GITPYTHONLIB") and \\\
1660 os.environ["GITPYTHONLIB"] or \\\
1661 "@@INSTLIBDIR@@"|' \
1662 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
1663 $@.py >$@+ && \
1664 chmod +x $@+ && \
1665 mv $@+ $@
1666else # NO_PYTHON
1667$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : unimplemented.sh
1668 $(QUIET_GEN)$(RM) $@ $@+ && \
1669 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1670 -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
1671 unimplemented.sh >$@+ && \
1672 chmod +x $@+ && \
1673 mv $@+ $@
1674endif # NO_PYTHON
1675
3900145e 1676configure: configure.ac
4cb08df5 1677 $(QUIET_GEN)$(RM) $@ $<+ && \
3900145e 1678 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
74f2b2a8
SP
1679 $< > $<+ && \
1680 autoconf -o $@ $<+ && \
4cb08df5 1681 $(RM) $<+
3900145e 1682
9b88fcef 1683# These can record GIT_VERSION
54dadbdb 1684git.o git.spec \
9b88fcef
JH
1685 $(patsubst %.sh,%,$(SCRIPT_SH)) \
1686 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
9b88fcef 1687 : GIT-VERSION-FILE
e99fcf96 1688
1b22c99c
JN
1689GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
1690 git.o http.o http-walker.o remote-curl.o
beeb4564
JN
1691XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1692 xdiff/xmerge.o xdiff/xpatience.o
c3739913
JN
1693OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS)
1694
ec5e0bb8 1695dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
beeb4564 1696
dfea5750 1697ifdef COMPUTE_HEADER_DEPENDENCIES
ec5e0bb8 1698dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
dfea5750
JN
1699$(dep_dirs):
1700 mkdir -p $@
1701
1702missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))
ec5e0bb8 1703dep_file = $(dir $@).depend/$(notdir $@).d
f2fabbf7
JN
1704dep_args = -MF $(dep_file) -MMD -MP
1705ifdef CHECK_HEADER_DEPENDENCIES
1706$(error cannot compute header dependencies outside a normal build. \
1707Please unset CHECK_HEADER_DEPENDENCIES and try again)
1708endif
1709endif
1710
1711ifndef COMPUTE_HEADER_DEPENDENCIES
1712ifndef CHECK_HEADER_DEPENDENCIES
dfea5750
JN
1713dep_dirs =
1714missing_dep_dirs =
f2fabbf7
JN
1715dep_args =
1716endif
dfea5750
JN
1717endif
1718
f2fabbf7
JN
1719ifdef CHECK_HEADER_DEPENDENCIES
1720ifndef PRINT_HEADER_DEPENDENCIES
1721missing_deps = $(filter-out $(notdir $^), \
1722 $(notdir $(shell $(MAKE) -s $@ \
1723 CHECK_HEADER_DEPENDENCIES=YesPlease \
1724 USE_COMPUTED_HEADER_DEPENDENCIES=YesPlease \
1725 PRINT_HEADER_DEPENDENCIES=YesPlease)))
1726endif
1727endif
1728
1729ASM_SRC := $(wildcard $(OBJECTS:o=S))
1730ASM_OBJ := $(ASM_SRC:S=o)
1731C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
1732
30248886
JN
1733.SUFFIXES:
1734
f2fabbf7
JN
1735ifdef PRINT_HEADER_DEPENDENCIES
1736$(C_OBJ): %.o: %.c FORCE
1737 echo $^
1738$(ASM_OBJ): %.o: %.S FORCE
1739 echo $^
1740
1741ifndef CHECK_HEADER_DEPENDENCIES
1742$(error cannot print header dependencies during a normal build. \
1743Please set CHECK_HEADER_DEPENDENCIES and try again)
1744endif
1745endif
1746
1747ifndef PRINT_HEADER_DEPENDENCIES
1748ifdef CHECK_HEADER_DEPENDENCIES
1749$(C_OBJ): %.o: %.c $(dep_files) FORCE
1750 @set -e; echo CHECK $@; \
1751 missing_deps="$(missing_deps)"; \
1752 if test "$$missing_deps"; \
1753 then \
1754 echo missing dependencies: $$missing_deps; \
1755 false; \
1756 fi
1757$(ASM_OBJ): %.o: %.S $(dep_files) FORCE
1758 @set -e; echo CHECK $@; \
1759 missing_deps="$(missing_deps)"; \
1760 if test "$$missing_deps"; \
1761 then \
1762 echo missing dependencies: $$missing_deps; \
1763 false; \
1764 fi
1765endif
1766endif
1767
1768ifndef CHECK_HEADER_DEPENDENCIES
dfea5750
JN
1769$(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)
1770 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $<
dfea5750
JN
1771$(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)
1772 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $<
f2fabbf7 1773endif
dfea5750 1774
f2fabbf7
JN
1775%.s: %.c GIT-CFLAGS FORCE
1776 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
1777
1778ifdef USE_COMPUTED_HEADER_DEPENDENCIES
dfea5750
JN
1779# Take advantage of gcc's on-the-fly dependency generation
1780# See <http://gcc.gnu.org/gcc-3.0/features.html>.
f2fabbf7
JN
1781dep_files_present := $(wildcard $(dep_files))
1782ifneq ($(dep_files_present),)
1783include $(dep_files_present)
dfea5750 1784endif
dfea5750 1785else
dfea5750
JN
1786# Dependencies on header files, for platforms that do not support
1787# the gcc -MMD option.
1788#
1789# Dependencies on automatically generated headers such as common-cmds.h
1790# should _not_ be included here, since they are necessary even when
1791# building an object for the first time.
1792#
1793# XXX. Please check occasionally that these include all dependencies
1794# gcc detects!
a310d434 1795
beeb4564
JN
1796$(GIT_OBJS): $(LIB_H)
1797builtin-branch.o builtin-checkout.o builtin-clone.o builtin-reset.o branch.o transport.o: branch.h
1798builtin-bundle.o bundle.o transport.o: bundle.h
1799builtin-bisect--helper.o builtin-rev-list.o bisect.o: bisect.h
1800builtin-clone.o builtin-fetch-pack.o transport.o: fetch-pack.h
1801builtin-send-pack.o transport.o: send-pack.h
1802builtin-log.o builtin-shortlog.o: shortlog.h
1803builtin-prune.o builtin-reflog.o reachable.o: reachable.h
1804builtin-commit.o builtin-revert.o wt-status.o: wt-status.h
1805builtin-tar-tree.o archive-tar.o: tar.h
1806builtin-pack-objects.o: thread-utils.h
1807http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
1808http.o http-walker.o http-push.o remote-curl.o: http.h
1809
beeb4564
JN
1810xdiff-interface.o $(XDIFF_OBJS): \
1811 xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1812 xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
dfea5750 1813endif
beeb4564 1814
de54e67c 1815exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
373a5ede
JN
1816 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1817 '-DBINDIR="$(bindir_relative_SQ)"' \
1818 '-DPREFIX="$(prefix_SQ)"'
026fa0d5 1819
de54e67c 1820builtin-init-db.s builtin-init-db.o: ALL_CFLAGS += \
373a5ede 1821 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
77cb17e9 1822
de54e67c 1823config.s config.o: ALL_CFLAGS += -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
506b17b1 1824
de54e67c 1825http.s http.o: ALL_CFLAGS += -DGIT_USER_AGENT='"git/$(GIT_VERSION)"'
20fc9bc5 1826
8d9fbe57 1827ifdef NO_EXPAT
de54e67c 1828http-walker.s http-walker.o: ALL_CFLAGS += -DNO_EXPAT
8d9fbe57
NH
1829endif
1830
8eef8e09 1831git-%$X: %.o $(GITLIBS)
74f2b2a8 1832 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
623c8a14 1833
684ec6c6
RS
1834git-imap-send$X: imap-send.o $(GITLIBS)
1835 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1836 $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
f2561fda 1837
ae209bd3 1838git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
1088261f 1839 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
17fd9f57 1840 $(LIBS) $(CURL_LIBCURL)
8fced61c 1841git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
74f2b2a8 1842 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
39c015c5
JS
1843 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1844
28ca0c90
IL
1845$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
1846 $(QUIET_LNCP)$(RM) $@ && \
1847 ln $< $@ 2>/dev/null || \
1848 ln -s $< $@ 2>/dev/null || \
1849 cp $< $@
1850
1851$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
a2d725b7
DB
1852 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1853 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1854
28818ffa 1855$(LIB_FILE): $(LIB_OBJS)
4cb08df5 1856 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
28818ffa 1857
3443546f 1858$(XDIFF_LIB): $(XDIFF_OBJS)
4cb08df5 1859 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
3443546f
LT
1860
1861
28818ffa
PB
1862doc:
1863 $(MAKE) -C Documentation all
1864
414851a4
MG
1865man:
1866 $(MAKE) -C Documentation man
1867
1868html:
1869 $(MAKE) -C Documentation html
1870
4739809c
DK
1871info:
1872 $(MAKE) -C Documentation info
1873
a325a1a7
MV
1874pdf:
1875 $(MAKE) -C Documentation pdf
1876
f81e7c62 1877TAGS:
4cb08df5 1878 $(RM) TAGS
89b2f19c 1879 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
f81e7c62
FK
1880
1881tags:
4cb08df5 1882 $(RM) tags
89b2f19c 1883 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
28818ffa 1884
a2a9150b
KP
1885cscope:
1886 $(RM) cscope*
1887 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
1888
ca3bcabf 1889### Detect prefix changes
7cdbff14 1890TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
ca3bcabf
YL
1891 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1892
13fca9f3 1893GIT-CFLAGS: FORCE
ca3bcabf
YL
1894 @FLAGS='$(TRACK_CFLAGS)'; \
1895 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1896 echo 1>&2 " * new build flags or prefix"; \
1897 echo "$$FLAGS" >GIT-CFLAGS; \
1898 fi
1899
bfce5087
JH
1900# We need to apply sq twice, once to protect from the shell
1901# that runs GIT-BUILD-OPTIONS, and then again to protect it
1902# and the first level quoting from the shell that runs "echo".
13fca9f3 1903GIT-BUILD-OPTIONS: FORCE
bfce5087 1904 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
be38ca3d 1905 @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
bfce5087 1906 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
119c8eee 1907 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
1b19ccd2 1908 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
ac10a857 1909 @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
7cf7f54a 1910
6bdb18a9
ER
1911### Detect Tck/Tk interpreter path changes
1912ifndef NO_TCLTK
1913TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1914
13fca9f3 1915GIT-GUI-VARS: FORCE
6bdb18a9
ER
1916 @VARS='$(TRACK_VARS)'; \
1917 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1918 echo 1>&2 " * new Tcl/Tk interpreter location"; \
1919 echo "$$VARS" >$@; \
1920 fi
6bdb18a9
ER
1921endif
1922
ea925196 1923test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
28818ffa 1924
ea925196
MO
1925all:: $(TEST_PROGRAMS) $(test_bindir_programs)
1926
1927bin-wrappers/%: wrap-for-bin.sh
1928 @mkdir -p bin-wrappers
1929 $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1930 -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
1931 -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
1932 chmod +x $@
96651ef5 1933
abb7c7b3
JS
1934# GNU make supports exporting all variables by "export" without parameters.
1935# However, the environment gets quite big, and some programs have problems
1936# with that.
1937
140245b3 1938export NO_SVN_TESTS
abb7c7b3 1939
225f78c8
JN
1940### Testing rules
1941
96651ef5 1942test: all
28818ffa
PB
1943 $(MAKE) -C t/ all
1944
b4285c71
RS
1945test-ctype$X: ctype.o
1946
5c5ba73b 1947test-date$X: date.o ctype.o
28818ffa 1948
5c5ba73b 1949test-delta$X: diff-delta.o patch-delta.o
28818ffa 1950
481424e1
AR
1951test-parse-options$X: parse-options.o
1952
daa99a91 1953.PRECIOUS: $(TEST_OBJS)
fa8fe28c 1954
5c5ba73b
JP
1955test-%$X: test-%.o $(GITLIBS)
1956 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
2dca1af4 1957
b65bc21e
JH
1958check-sha1:: test-sha1$X
1959 ./test-sha1.sh
1960
7c4c9f4c 1961check: common-cmds.h
912f9980
JH
1962 if sparse; \
1963 then \
1964 for i in *.c; \
1965 do \
1966 sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1967 done; \
1968 else \
1969 echo 2>&1 "Did you mean 'make test'?"; \
1970 exit 1; \
1971 fi
28818ffa 1972
36e5e70e 1973remove-dashes:
b4f02d35 1974 ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
28818ffa
PB
1975
1976### Installation rules
1977
0c0ead7e 1978ifneq ($(filter /%,$(firstword $(template_dir))),)
0b50b860 1979template_instdir = $(template_dir)
026fa0d5
SP
1980else
1981template_instdir = $(prefix)/$(template_dir)
0b50b860
JS
1982endif
1983export template_instdir
1984
0c0ead7e 1985ifneq ($(filter /%,$(firstword $(gitexecdir))),)
49fa65a7 1986gitexec_instdir = $(gitexecdir)
026fa0d5
SP
1987else
1988gitexec_instdir = $(prefix)/$(gitexecdir)
49fa65a7
JS
1989endif
1990gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
1991export gitexec_instdir
1992
ea925196
MO
1993install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
1994
d6ebd259 1995install: all
41650765 1996 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
49fa65a7
JS
1997 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1998 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
ea925196 1999 $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
7ffe7098 2000 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
5be3b17f 2001ifndef NO_PERL
28072a5d 2002 $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
5be3b17f 2003endif
2fe40b63
SR
2004ifndef NO_PYTHON
2005 $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
2006endif
3cfaf11b 2007ifndef NO_TCLTK
62ba5143 2008 $(MAKE) -C gitk-git install
49fa65a7 2009 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
3cfaf11b 2010endif
6fc301bb 2011ifneq (,$X)
d4b19027 2012 $(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';)
6fc301bb 2013endif
28ca0c90 2014
46beb559 2015 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
49fa65a7 2016 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
6edd1496
JH
2017 { test "$$bindir/" = "$$execdir/" || \
2018 { $(RM) "$$execdir/git$X" && \
3426e34f 2019 test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
4ecbc178 2020 ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
6edd1496 2021 cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
4ecbc178 2022 { for p in $(BUILT_INS); do \
b56c79cc 2023 $(RM) "$$execdir/$$p" && \
4ecbc178
JK
2024 ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2025 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2026 cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
fe4a9c36 2027 done; } && \
28ca0c90
IL
2028 { for p in $(REMOTE_CURL_ALIASES); do \
2029 $(RM) "$$execdir/$$p" && \
2030 ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2031 ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2032 cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
2033 done; } && \
7b4b59a9 2034 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
28818ffa
PB
2035
2036install-doc:
2037 $(MAKE) -C Documentation install
2038
b1a46b70
MH
2039install-man:
2040 $(MAKE) -C Documentation install-man
2041
ae081f3e
TL
2042install-html:
2043 $(MAKE) -C Documentation install-html
2044
4739809c
DK
2045install-info:
2046 $(MAKE) -C Documentation install-info
2047
a325a1a7
MV
2048install-pdf:
2049 $(MAKE) -C Documentation install-pdf
2050
6538d1ef
EW
2051quick-install-doc:
2052 $(MAKE) -C Documentation quick-install
28818ffa 2053
b1a46b70
MH
2054quick-install-man:
2055 $(MAKE) -C Documentation quick-install-man
2056
6fe570de
MG
2057quick-install-html:
2058 $(MAKE) -C Documentation quick-install-html
2059
28818ffa
PB
2060
2061
2062### Maintainer's dist rules
2063
9b88fcef 2064git.spec: git.spec.in
fc36f6a6
JM
2065 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
2066 mv $@+ $@
a9db2974 2067
27dedf0c 2068GIT_TARNAME=git-$(GIT_VERSION)
6c0f8694 2069dist: git.spec git-archive$(X) configure
9ccb64c8
JH
2070 ./git-archive --format=tar \
2071 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
a9db2974 2072 @mkdir -p $(GIT_TARNAME)
f58494bf 2073 @cp git.spec configure $(GIT_TARNAME)
181129d2 2074 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
d647c2ea 2075 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
181129d2 2076 $(TAR) rf $(GIT_TARNAME).tar \
d647c2ea 2077 $(GIT_TARNAME)/git.spec \
f58494bf 2078 $(GIT_TARNAME)/configure \
d647c2ea 2079 $(GIT_TARNAME)/version \
115f0fe4 2080 $(GIT_TARNAME)/git-gui/version
4cb08df5 2081 @$(RM) -r $(GIT_TARNAME)
9dce3c06 2082 gzip -f -9 $(GIT_TARNAME).tar
a9db2974
CW
2083
2084rpm: dist
a96e9c28
TZ
2085 $(RPMBUILD) \
2086 --define "_source_filedigest_algorithm md5" \
2087 --define "_binary_filedigest_algorithm md5" \
2088 -ta $(GIT_TARNAME).tar.gz
a9db2974 2089
52db0495
TS
2090htmldocs = git-htmldocs-$(GIT_VERSION)
2091manpages = git-manpages-$(GIT_VERSION)
2092dist-doc:
4cb08df5 2093 $(RM) -r .doc-tmp-dir
52db0495
TS
2094 mkdir .doc-tmp-dir
2095 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
2096 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
2097 gzip -n -9 -f $(htmldocs).tar
2098 :
4cb08df5 2099 $(RM) -r .doc-tmp-dir
4392da4d 2100 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
c5360324 2101 $(MAKE) -C Documentation DESTDIR=./ \
7b8cf0cf 2102 man1dir=../.doc-tmp-dir/man1 \
4392da4d 2103 man5dir=../.doc-tmp-dir/man5 \
7b8cf0cf 2104 man7dir=../.doc-tmp-dir/man7 \
52db0495
TS
2105 install
2106 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
2107 gzip -n -9 -f $(manpages).tar
4cb08df5 2108 $(RM) -r .doc-tmp-dir
52db0495 2109
28818ffa 2110### Cleaning rules
87a81c83 2111
922aa807
MM
2112distclean: clean
2113 $(RM) configure
2114
e83c5163 2115clean:
7fc9d152 2116 $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
4cfc24af 2117 $(LIB_FILE) $(XDIFF_LIB)
4cb08df5
EM
2118 $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
2119 $(RM) $(TEST_PROGRAMS)
ea925196 2120 $(RM) -r bin-wrappers
dfea5750 2121 $(RM) -r $(dep_dirs)
a2a9150b 2122 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
4cb08df5 2123 $(RM) -r autom4te.cache
922aa807 2124 $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
4cb08df5
EM
2125 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
2126 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
2127 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
ca67f002 2128 $(MAKE) -C Documentation/ clean
499c2939
JK
2129ifndef NO_PERL
2130 $(RM) gitweb/gitweb.cgi
f848718a 2131 $(MAKE) -C perl clean
2fe40b63
SR
2132endif
2133ifndef NO_PYTHON
2134 $(MAKE) -C git_remote_helpers clean
499c2939 2135endif
b1edc53d 2136 $(MAKE) -C templates/ clean
4b7581f0 2137 $(MAKE) -C t/ clean
3cfaf11b 2138ifndef NO_TCLTK
62ba5143 2139 $(MAKE) -C gitk-git clean
3cfaf11b
ER
2140 $(MAKE) -C git-gui clean
2141endif
7cf7f54a 2142 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
9b88fcef 2143
4dc00021 2144.PHONY: all install clean strip
6dc4627e 2145.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
13fca9f3 2146.PHONY: FORCE TAGS tags cscope
d89056c2 2147
8c989ec5
JH
2148### Check documentation
2149#
2150check-docs::
3f7ce648 2151 @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
8c989ec5
JH
2152 do \
2153 case "$$v" in \
8c989ec5 2154 git-merge-octopus | git-merge-ours | git-merge-recursive | \
51add76e 2155 git-merge-resolve | git-merge-subtree | \
5c66d0d4 2156 git-fsck-objects | git-init-db | \
5b4617c7 2157 git-?*--?* ) continue ;; \
8c989ec5
JH
2158 esac ; \
2159 test -f "Documentation/$$v.txt" || \
2160 echo "no doc: $$v"; \
79d30668 2161 sed -e '/^#/d' command-list.txt | \
4b02c529 2162 grep -q "^$$v[ ]" || \
8c989ec5
JH
2163 case "$$v" in \
2164 git) ;; \
2165 *) echo "no link: $$v";; \
2166 esac ; \
3f7ce648
JH
2167 done; \
2168 ( \
79d30668 2169 sed -e '/^#/d' \
3f7ce648 2170 -e 's/[ ].*//' \
79d30668 2171 -e 's/^/listed /' command-list.txt; \
3f7ce648
JH
2172 ls -1 Documentation/git*txt | \
2173 sed -e 's|Documentation/|documented |' \
2174 -e 's/\.txt//'; \
2175 ) | while read how cmd; \
2176 do \
2177 case "$$how,$$cmd" in \
2178 *,git-citool | \
2179 *,git-gui | \
0f6f195b 2180 *,git-help | \
3f7ce648
JH
2181 documented,gitattributes | \
2182 documented,gitignore | \
2183 documented,gitmodules | \
2f7ee089 2184 documented,gitcli | \
3f7ce648 2185 documented,git-tools | \
d0594be1
JH
2186 documented,gitcore-tutorial | \
2187 documented,gitcvs-migration | \
2188 documented,gitdiffcore | \
2189 documented,gitglossary | \
2190 documented,githooks | \
2191 documented,gitrepository-layout | \
2192 documented,gittutorial | \
2193 documented,gittutorial-2 | \
3f7ce648
JH
2194 sentinel,not,matching,is,ok ) continue ;; \
2195 esac; \
2196 case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
2197 *" $$cmd "*) ;; \
2198 *) echo "removed but $$how: $$cmd" ;; \
2199 esac; \
2200 done ) | sort
c74390e4
JH
2201
2202### Make sure built-ins do not have dups and listed in git.c
2203#
2204check-builtins::
2205 ./check-builtins.sh
11c57e6a 2206
901c369a
TR
2207### Test suite coverage testing
2208#
2209.PHONY: coverage coverage-clean coverage-build coverage-report
2210
2211coverage:
2212 $(MAKE) coverage-build
2213 $(MAKE) coverage-report
2214
2215coverage-clean:
2216 rm -f *.gcda *.gcno
2217
2218COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
2219COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
2220
2221coverage-build: coverage-clean
2222 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
2223 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
2224 -j1 test
2225
2226coverage-report:
2227 gcov -b *.c
2228 grep '^function.*called 0 ' *.c.gcov \
2229 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
2230 | tee coverage-untested-functions