Merge branch 'ld/push-porcelain-output-format'
[git/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
LT
18# Define NO_OPENSSL environment variable if you do not have OpenSSL.
19# This also implies MOZILLA_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#
2600973f
RS
64# Define NO_SYS_SELECT_H if you don't have sys/select.h.
65#
9f0bb90d
JH
66# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
67# Enable it on Windows. By default, symrefs are still used.
2fabd217 68#
02853588 69# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
60d02ccc
EW
70# tests. These tests take up a significant amount of the total test time
71# but are not needed unless you plan to talk to SVN repos.
72#
8eb38cad
SP
73# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
74# installed in /sw, but don't want GIT to link against any libraries
75# installed there. If defined you may specify your own (or Fink's)
76# include directories and library directories by defining CFLAGS
77# and LDFLAGS appropriately.
78#
79# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
80# have DarwinPorts installed in /opt/local, but don't want GIT to
81# link against any libraries installed there. If defined you may
82# specify your own (or DarwinPort's) include directories and
83# library directories by defining CFLAGS and LDFLAGS appropriately.
84#
5bdac8b3
PB
85# Define PPC_SHA1 environment variable when running make to make use of
86# a bundled SHA1 routine optimized for PowerPC.
597c9cc5 87#
7c6ef2f2
NP
88# Define ARM_SHA1 environment variable when running make to make use of
89# a bundled SHA1 routine optimized for ARM.
90#
f6af75d2
JH
91# Define MOZILLA_SHA1 environment variable when running make to make use of
92# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
93# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
94# choice) has very fast version optimized for i586.
95#
597c9cc5 96# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (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#
7f55cf45
JF
156# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
157#
f848718a
AR
158# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
159# MakeMaker (e.g. using ActiveState under Cygwin).
160#
499c2939
JK
161# Define NO_PERL if you do not want Perl scripts or libraries at all.
162#
3cfaf11b
ER
163# Define NO_TCLTK if you do not want Tcl/Tk GUI.
164#
5f5dbd71
SP
165# The TCL_PATH variable governs the location of the Tcl interpreter
166# used to optimize git-gui for your system. Only used if NO_TCLTK
167# is not set. Defaults to the bare 'tclsh'.
168#
169# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
81b63c70
ER
170# If not set it defaults to the bare 'wish'. If it is set to the empty
171# string then NO_TCLTK will be forced (this is used by configure script).
172#
8ecce684
NP
173# Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
174# parallel delta searching when packing objects.
175#
43fe901b
BD
176# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
177# is a simplified version of the merge sort used in glibc. This is
178# recommended if Git triggers O(n^2) behavior in your platform's qsort().
179#
5f7c643a
JK
180# Define NO_EXTERNAL_GREP if you don't want "git grep" to ever call
181# your external grep (e.g., if your system lacks grep, if its grep is
182# broken, or spawning external process is slower than built-in grep git has).
34779c53
JS
183#
184# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
185# information on a not yet closed file that lstat would return for the same
186# file after it was closed.
be66a6c4 187#
348df166
JS
188# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
189# when hardlinking a file to another name and unlinking the original file right
be66a6c4 190# away (some NTFS drivers seem to zero the contents in that scenario).
2c8f8b19 191#
3426e34f
JS
192# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
193# programs as a tar, where bin/ and libexec/ might be on different file systems.
f0ed8226
MSO
194#
195# Define USE_NED_ALLOCATOR if you want to replace the platforms default
196# memory allocators with the nedmalloc allocator written by Niall Douglas.
02232adf
JK
197#
198# Define NO_REGEX if you have no or inferior regex support in your C library.
5bdac8b3 199
9b88fcef 200GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
36546385 201 @$(SHELL_PATH) ./GIT-VERSION-GEN
9b88fcef 202-include GIT-VERSION-FILE
a9db2974 203
e15f5451
PJ
204uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
205uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
206uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
207uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
208uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
46059cc6 209uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
e15f5451 210
94d23317 211# CFLAGS and LDFLAGS are for the users to override from the command line.
12aa7456 212
b05701c5 213CFLAGS = -g -O2 -Wall
94d23317 214LDFLAGS =
12aa7456 215ALL_CFLAGS = $(CFLAGS)
94d23317 216ALL_LDFLAGS = $(LDFLAGS)
4dc00021 217STRIP ?= strip
29c2cce4 218
49fa65a7
JS
219# Among the variables below, these:
220# gitexecdir
221# template_dir
026fa0d5
SP
222# mandir
223# infodir
49fa65a7
JS
224# htmldir
225# ETC_GITCONFIG (but not sysconfdir)
026fa0d5
SP
226# can be specified as a relative path some/where/else;
227# this is interpreted as relative to $(prefix) and "git" at
49fa65a7
JS
228# runtime figures out where they are based on the path to the executable.
229# This can help installing the suite in a relocatable way.
230
b05701c5 231prefix = $(HOME)
026fa0d5
SP
232bindir_relative = bin
233bindir = $(prefix)/$(bindir_relative)
234mandir = share/man
235infodir = share/info
236gitexecdir = libexec/git-core
9354768a 237sharedir = $(prefix)/share
026fa0d5
SP
238template_dir = share/git-core/templates
239htmldir = share/doc/git-doc
b51b8bbf
JT
240ifeq ($(prefix),/usr)
241sysconfdir = /etc
026fa0d5 242ETC_GITCONFIG = $(sysconfdir)/gitconfig
b51b8bbf
JT
243else
244sysconfdir = $(prefix)/etc
026fa0d5 245ETC_GITCONFIG = etc/gitconfig
b51b8bbf 246endif
10861bea 247lib = lib
a682ef9f 248# DESTDIR=
352c8111 249pathsep = :
5c2a7fbc 250
5d043a3d 251# default configuration for gitweb
c8d138a8 252GITWEB_CONFIG = gitweb_config.perl
17a8b250 253GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
2de21fac 254GITWEB_HOME_LINK_STR = projects
5d043a3d
MW
255GITWEB_SITENAME =
256GITWEB_PROJECTROOT = /pub/git
ca5e9495 257GITWEB_PROJECT_MAXDEPTH = 2007
32f4aacc
ML
258GITWEB_EXPORT_OK =
259GITWEB_STRICT_EXPORT =
19a8721e 260GITWEB_BASE_URL =
5d043a3d
MW
261GITWEB_LIST =
262GITWEB_HOMETEXT = indextext.html
263GITWEB_CSS = gitweb.css
281f2f6b 264GITWEB_LOGO = git-logo.png
0b5deba1 265GITWEB_FAVICON = git-favicon.png
b2d3476e
AC
266GITWEB_SITE_HEADER =
267GITWEB_SITE_FOOTER =
5d043a3d 268
8ea7ad69 269export prefix bindir sharedir sysconfdir
e14421b9 270
b05701c5
PR
271CC = gcc
272AR = ar
4cb08df5 273RM = rm -f
229a7ed7 274TAR = tar
89b2f19c 275FIND = find
b05701c5
PR
276INSTALL = install
277RPMBUILD = rpmbuild
5f5dbd71 278TCL_PATH = tclsh
81b63c70 279TCLTK_PATH = wish
158629b2 280PTHREAD_LIBS = -lpthread
e83c5163 281
5f5dbd71
SP
282export TCL_PATH TCLTK_PATH
283
44c9e859
LT
284# sparse is architecture-neutral, which means that we need to tell it
285# explicitly what architecture to check for. Fix this up for yours..
b05701c5 286SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
44c9e859 287
28818ffa
PB
288
289
290### --- END CONFIGURATION SECTION ---
291
8d7f586f 292# Those must not be GNU-specific; they are shared with perl/ which may
18b0fc1c
PB
293# be built by a different compiler. (Note that this is an artifact now
294# but it still might be nice to keep that distinction.)
295BASIC_CFLAGS =
296BASIC_LDFLAGS =
8d7f586f 297
5c928c06
JS
298# Guard against environment variables
299BUILTIN_OBJS =
300BUILT_INS =
301COMPAT_CFLAGS =
302COMPAT_OBJS =
303LIB_H =
304LIB_OBJS =
305PROGRAMS =
306SCRIPT_PERL =
307SCRIPT_SH =
308TEST_PROGRAMS =
309
74ca5e6d
JH
310SCRIPT_SH += git-am.sh
311SCRIPT_SH += git-bisect.sh
afcbc8e7 312SCRIPT_SH += git-difftool--helper.sh
74ca5e6d
JH
313SCRIPT_SH += git-filter-branch.sh
314SCRIPT_SH += git-lost-found.sh
315SCRIPT_SH += git-merge-octopus.sh
316SCRIPT_SH += git-merge-one-file.sh
317SCRIPT_SH += git-merge-resolve.sh
74ca5e6d 318SCRIPT_SH += git-mergetool.sh
21d0ba7e 319SCRIPT_SH += git-mergetool--lib.sh
74ca5e6d
JH
320SCRIPT_SH += git-parse-remote.sh
321SCRIPT_SH += git-pull.sh
322SCRIPT_SH += git-quiltimport.sh
323SCRIPT_SH += git-rebase--interactive.sh
324SCRIPT_SH += git-rebase.sh
325SCRIPT_SH += git-repack.sh
326SCRIPT_SH += git-request-pull.sh
327SCRIPT_SH += git-sh-setup.sh
328SCRIPT_SH += git-stash.sh
329SCRIPT_SH += git-submodule.sh
330SCRIPT_SH += git-web--browse.sh
331
332SCRIPT_PERL += git-add--interactive.perl
afcbc8e7 333SCRIPT_PERL += git-difftool.perl
74ca5e6d
JH
334SCRIPT_PERL += git-archimport.perl
335SCRIPT_PERL += git-cvsexportcommit.perl
336SCRIPT_PERL += git-cvsimport.perl
337SCRIPT_PERL += git-cvsserver.perl
338SCRIPT_PERL += git-relink.perl
339SCRIPT_PERL += git-send-email.perl
340SCRIPT_PERL += git-svn.perl
60036a41 341
d6ebd259
AE
342SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
343 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
e475fe16 344 git-instaweb
d6ebd259 345
42f77406
JH
346# Empty...
347EXTRA_PROGRAMS =
d6ebd259 348
74ca5e6d
JH
349# ... and all the rest that could be moved out of bindir to gitexecdir
350PROGRAMS += $(EXTRA_PROGRAMS)
74ca5e6d 351PROGRAMS += git-fast-import$X
74ca5e6d 352PROGRAMS += git-hash-object$X
74ca5e6d
JH
353PROGRAMS += git-index-pack$X
354PROGRAMS += git-merge-index$X
355PROGRAMS += git-merge-tree$X
356PROGRAMS += git-mktag$X
74ca5e6d
JH
357PROGRAMS += git-pack-redundant$X
358PROGRAMS += git-patch-id$X
e705d757 359PROGRAMS += git-shell$X
74ca5e6d
JH
360PROGRAMS += git-show-index$X
361PROGRAMS += git-unpack-file$X
362PROGRAMS += git-update-server-info$X
363PROGRAMS += git-upload-pack$X
364PROGRAMS += git-var$X
365
1736855c
JH
366# List built-in command $C whose implementation cmd_$C() is not in
367# builtin-$C.o but is linked in as part of some other command.
74ca5e6d
JH
368BUILT_INS += $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
369
74ca5e6d 370BUILT_INS += git-cherry$X
fcb6c076 371BUILT_INS += git-cherry-pick$X
74ca5e6d
JH
372BUILT_INS += git-format-patch$X
373BUILT_INS += git-fsck-objects$X
374BUILT_INS += git-get-tar-commit-id$X
375BUILT_INS += git-init$X
376BUILT_INS += git-merge-subtree$X
377BUILT_INS += git-peek-remote$X
378BUILT_INS += git-repo-config$X
379BUILT_INS += git-show$X
24b1f65f 380BUILT_INS += git-stage$X
74ca5e6d
JH
381BUILT_INS += git-status$X
382BUILT_INS += git-whatchanged$X
91730800 383
b42934d6 384# what 'all' will build and 'install' will install, in gitexecdir
6506e156 385ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
e83c5163 386
3cfaf11b 387# what 'all' will build but not install in gitexecdir
499c2939 388OTHER_PROGRAMS = git$X
3cfaf11b 389
3d32051f
RA
390# Set paths to tools early so that they can be used for version tests.
391ifndef SHELL_PATH
392 SHELL_PATH = /bin/sh
393endif
394ifndef PERL_PATH
395 PERL_PATH = /usr/bin/perl
396endif
720d150c 397
3a793478
LT
398export PERL_PATH
399
0a02ce72 400LIB_FILE=libgit.a
3443546f 401XDIFF_LIB=xdiff/lib.a
8f3f9b09 402
74ca5e6d
JH
403LIB_H += archive.h
404LIB_H += attr.h
405LIB_H += blob.h
406LIB_H += builtin.h
407LIB_H += cache.h
408LIB_H += cache-tree.h
409LIB_H += commit.h
adbc0b6b 410LIB_H += compat/cygwin.h
fcb6c076 411LIB_H += compat/mingw.h
74ca5e6d
JH
412LIB_H += csum-file.h
413LIB_H += decorate.h
414LIB_H += delta.h
415LIB_H += diffcore.h
416LIB_H += diff.h
417LIB_H += dir.h
418LIB_H += fsck.h
419LIB_H += git-compat-util.h
c12172d2 420LIB_H += graph.h
74ca5e6d
JH
421LIB_H += grep.h
422LIB_H += hash.h
940208a7 423LIB_H += help.h
8af84dad 424LIB_H += levenshtein.h
74ca5e6d
JH
425LIB_H += list-objects.h
426LIB_H += ll-merge.h
427LIB_H += log-tree.h
428LIB_H += mailmap.h
db3a9545 429LIB_H += merge-recursive.h
74ca5e6d
JH
430LIB_H += object.h
431LIB_H += pack.h
94e724a7 432LIB_H += pack-refs.h
74ca5e6d
JH
433LIB_H += pack-revindex.h
434LIB_H += parse-options.h
435LIB_H += patch-ids.h
74ca5e6d
JH
436LIB_H += pkt-line.h
437LIB_H += progress.h
438LIB_H += quote.h
439LIB_H += reflog-walk.h
440LIB_H += refs.h
441LIB_H += remote.h
5b2fd956 442LIB_H += rerere.h
74ca5e6d
JH
443LIB_H += revision.h
444LIB_H += run-command.h
628522ec 445LIB_H += sha1-lookup.h
74ca5e6d 446LIB_H += sideband.h
4a16d072 447LIB_H += sigchain.h
74ca5e6d 448LIB_H += strbuf.h
fcb6c076 449LIB_H += string-list.h
74ca5e6d
JH
450LIB_H += tag.h
451LIB_H += transport.h
452LIB_H += tree.h
453LIB_H += tree-walk.h
454LIB_H += unpack-trees.h
be58e70d 455LIB_H += userdiff.h
74ca5e6d 456LIB_H += utf8.h
d3d20b84 457LIB_H += wt-status.h
74ca5e6d 458
5b8e6f85 459LIB_OBJS += abspath.o
74ca5e6d
JH
460LIB_OBJS += alias.o
461LIB_OBJS += alloc.o
462LIB_OBJS += archive.o
463LIB_OBJS += archive-tar.o
464LIB_OBJS += archive-zip.o
465LIB_OBJS += attr.o
466LIB_OBJS += base85.o
a2ad79ce 467LIB_OBJS += bisect.o
74ca5e6d
JH
468LIB_OBJS += blob.o
469LIB_OBJS += branch.o
470LIB_OBJS += bundle.o
471LIB_OBJS += cache-tree.o
472LIB_OBJS += color.o
473LIB_OBJS += combine-diff.o
474LIB_OBJS += commit.o
475LIB_OBJS += config.o
476LIB_OBJS += connect.o
477LIB_OBJS += convert.o
478LIB_OBJS += copy.o
479LIB_OBJS += csum-file.o
480LIB_OBJS += ctype.o
481LIB_OBJS += date.o
482LIB_OBJS += decorate.o
483LIB_OBJS += diffcore-break.o
484LIB_OBJS += diffcore-delta.o
485LIB_OBJS += diffcore-order.o
486LIB_OBJS += diffcore-pickaxe.o
487LIB_OBJS += diffcore-rename.o
488LIB_OBJS += diff-delta.o
489LIB_OBJS += diff-lib.o
fcb6c076 490LIB_OBJS += diff-no-index.o
74ca5e6d
JH
491LIB_OBJS += diff.o
492LIB_OBJS += dir.o
d82f33e2 493LIB_OBJS += editor.o
74ca5e6d
JH
494LIB_OBJS += entry.o
495LIB_OBJS += environment.o
496LIB_OBJS += exec_cmd.o
497LIB_OBJS += fsck.o
c12172d2 498LIB_OBJS += graph.o
74ca5e6d
JH
499LIB_OBJS += grep.o
500LIB_OBJS += hash.o
501LIB_OBJS += help.o
502LIB_OBJS += ident.o
8af84dad 503LIB_OBJS += levenshtein.o
74ca5e6d
JH
504LIB_OBJS += list-objects.o
505LIB_OBJS += ll-merge.o
506LIB_OBJS += lockfile.o
507LIB_OBJS += log-tree.o
508LIB_OBJS += mailmap.o
509LIB_OBJS += match-trees.o
510LIB_OBJS += merge-file.o
9047ebbc 511LIB_OBJS += merge-recursive.o
96872bc2 512LIB_OBJS += name-hash.o
74ca5e6d
JH
513LIB_OBJS += object.o
514LIB_OBJS += pack-check.o
94e724a7 515LIB_OBJS += pack-refs.o
74ca5e6d
JH
516LIB_OBJS += pack-revindex.o
517LIB_OBJS += pack-write.o
518LIB_OBJS += pager.o
519LIB_OBJS += parse-options.o
520LIB_OBJS += patch-delta.o
521LIB_OBJS += patch-ids.o
74ca5e6d
JH
522LIB_OBJS += path.o
523LIB_OBJS += pkt-line.o
fcb6c076 524LIB_OBJS += preload-index.o
74ca5e6d
JH
525LIB_OBJS += pretty.o
526LIB_OBJS += progress.o
527LIB_OBJS += quote.o
528LIB_OBJS += reachable.o
529LIB_OBJS += read-cache.o
530LIB_OBJS += reflog-walk.o
531LIB_OBJS += refs.o
532LIB_OBJS += remote.o
5b2fd956 533LIB_OBJS += rerere.o
74ca5e6d
JH
534LIB_OBJS += revision.o
535LIB_OBJS += run-command.o
536LIB_OBJS += server-info.o
537LIB_OBJS += setup.o
628522ec 538LIB_OBJS += sha1-lookup.o
fcb6c076 539LIB_OBJS += sha1_file.o
74ca5e6d
JH
540LIB_OBJS += sha1_name.o
541LIB_OBJS += shallow.o
542LIB_OBJS += sideband.o
4a16d072 543LIB_OBJS += sigchain.o
74ca5e6d 544LIB_OBJS += strbuf.o
fcb6c076 545LIB_OBJS += string-list.o
74ca5e6d
JH
546LIB_OBJS += symlinks.o
547LIB_OBJS += tag.o
548LIB_OBJS += trace.o
549LIB_OBJS += transport.o
550LIB_OBJS += tree-diff.o
551LIB_OBJS += tree.o
552LIB_OBJS += tree-walk.o
553LIB_OBJS += unpack-trees.o
554LIB_OBJS += usage.o
fcb6c076 555LIB_OBJS += userdiff.o
74ca5e6d
JH
556LIB_OBJS += utf8.o
557LIB_OBJS += walker.o
112db553 558LIB_OBJS += wrapper.o
74ca5e6d
JH
559LIB_OBJS += write_or_die.o
560LIB_OBJS += ws.o
561LIB_OBJS += wt-status.o
562LIB_OBJS += xdiff-interface.o
563
564BUILTIN_OBJS += builtin-add.o
565BUILTIN_OBJS += builtin-annotate.o
566BUILTIN_OBJS += builtin-apply.o
567BUILTIN_OBJS += builtin-archive.o
1bf072e3 568BUILTIN_OBJS += builtin-bisect--helper.o
74ca5e6d
JH
569BUILTIN_OBJS += builtin-blame.o
570BUILTIN_OBJS += builtin-branch.o
571BUILTIN_OBJS += builtin-bundle.o
572BUILTIN_OBJS += builtin-cat-file.o
573BUILTIN_OBJS += builtin-check-attr.o
574BUILTIN_OBJS += builtin-check-ref-format.o
575BUILTIN_OBJS += builtin-checkout-index.o
576BUILTIN_OBJS += builtin-checkout.o
577BUILTIN_OBJS += builtin-clean.o
8434c2f1 578BUILTIN_OBJS += builtin-clone.o
74ca5e6d
JH
579BUILTIN_OBJS += builtin-commit-tree.o
580BUILTIN_OBJS += builtin-commit.o
581BUILTIN_OBJS += builtin-config.o
582BUILTIN_OBJS += builtin-count-objects.o
583BUILTIN_OBJS += builtin-describe.o
584BUILTIN_OBJS += builtin-diff-files.o
585BUILTIN_OBJS += builtin-diff-index.o
586BUILTIN_OBJS += builtin-diff-tree.o
587BUILTIN_OBJS += builtin-diff.o
588BUILTIN_OBJS += builtin-fast-export.o
589BUILTIN_OBJS += builtin-fetch--tool.o
590BUILTIN_OBJS += builtin-fetch-pack.o
591BUILTIN_OBJS += builtin-fetch.o
592BUILTIN_OBJS += builtin-fmt-merge-msg.o
593BUILTIN_OBJS += builtin-for-each-ref.o
594BUILTIN_OBJS += builtin-fsck.o
595BUILTIN_OBJS += builtin-gc.o
596BUILTIN_OBJS += builtin-grep.o
3d78d1f1 597BUILTIN_OBJS += builtin-help.o
74ca5e6d
JH
598BUILTIN_OBJS += builtin-init-db.o
599BUILTIN_OBJS += builtin-log.o
600BUILTIN_OBJS += builtin-ls-files.o
601BUILTIN_OBJS += builtin-ls-remote.o
602BUILTIN_OBJS += builtin-ls-tree.o
603BUILTIN_OBJS += builtin-mailinfo.o
604BUILTIN_OBJS += builtin-mailsplit.o
1c7b76be 605BUILTIN_OBJS += builtin-merge.o
74ca5e6d
JH
606BUILTIN_OBJS += builtin-merge-base.o
607BUILTIN_OBJS += builtin-merge-file.o
608BUILTIN_OBJS += builtin-merge-ours.o
609BUILTIN_OBJS += builtin-merge-recursive.o
633e3556 610BUILTIN_OBJS += builtin-mktree.o
74ca5e6d
JH
611BUILTIN_OBJS += builtin-mv.o
612BUILTIN_OBJS += builtin-name-rev.o
613BUILTIN_OBJS += builtin-pack-objects.o
614BUILTIN_OBJS += builtin-pack-refs.o
615BUILTIN_OBJS += builtin-prune-packed.o
616BUILTIN_OBJS += builtin-prune.o
617BUILTIN_OBJS += builtin-push.o
618BUILTIN_OBJS += builtin-read-tree.o
be5908ae 619BUILTIN_OBJS += builtin-receive-pack.o
74ca5e6d
JH
620BUILTIN_OBJS += builtin-reflog.o
621BUILTIN_OBJS += builtin-remote.o
622BUILTIN_OBJS += builtin-rerere.o
623BUILTIN_OBJS += builtin-reset.o
624BUILTIN_OBJS += builtin-rev-list.o
625BUILTIN_OBJS += builtin-rev-parse.o
626BUILTIN_OBJS += builtin-revert.o
627BUILTIN_OBJS += builtin-rm.o
628BUILTIN_OBJS += builtin-send-pack.o
629BUILTIN_OBJS += builtin-shortlog.o
630BUILTIN_OBJS += builtin-show-branch.o
631BUILTIN_OBJS += builtin-show-ref.o
632BUILTIN_OBJS += builtin-stripspace.o
633BUILTIN_OBJS += builtin-symbolic-ref.o
634BUILTIN_OBJS += builtin-tag.o
635BUILTIN_OBJS += builtin-tar-tree.o
636BUILTIN_OBJS += builtin-unpack-objects.o
637BUILTIN_OBJS += builtin-update-index.o
638BUILTIN_OBJS += builtin-update-ref.o
639BUILTIN_OBJS += builtin-upload-archive.o
640BUILTIN_OBJS += builtin-verify-pack.o
641BUILTIN_OBJS += builtin-verify-tag.o
642BUILTIN_OBJS += builtin-write-tree.o
70827b15 643
54c261f9 644GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
bef19da9 645EXTLIBS =
cef661fc 646
229a7ed7
JH
647#
648# Platform specific tweaks
649#
f7c15343
JH
650
651# We choose to avoid "if .. else if .. else .. endif endif"
652# because maintaining the nesting to match is a pain. If
653# we had "elif" things would have been much nicer...
f7c15343 654
817151e6
PE
655ifeq ($(uname_S),Linux)
656 NO_STRLCPY = YesPlease
0620b39b 657 NO_MKSTEMPS = YesPlease
38bd6497 658 THREADED_DELTA_SEARCH = YesPlease
817151e6 659endif
ca7a7416
GP
660ifeq ($(uname_S),GNU/kFreeBSD)
661 NO_STRLCPY = YesPlease
0620b39b 662 NO_MKSTEMPS = YesPlease
38bd6497 663 THREADED_DELTA_SEARCH = YesPlease
ca7a7416 664endif
457bb452
BLG
665ifeq ($(uname_S),UnixWare)
666 CC = cc
667 NEEDS_SOCKET = YesPlease
668 NEEDS_NSL = YesPlease
669 NEEDS_SSL_WITH_CRYPTO = YesPlease
670 NEEDS_LIBICONV = YesPlease
671 SHELL_PATH = /usr/local/bin/bash
672 NO_IPV6 = YesPlease
673 NO_HSTRERROR = YesPlease
0620b39b 674 NO_MKSTEMPS = YesPlease
457bb452
BLG
675 BASIC_CFLAGS += -Kthread
676 BASIC_CFLAGS += -I/usr/local/include
677 BASIC_LDFLAGS += -L/usr/local/lib
678 INSTALL = ginstall
679 TAR = gtar
680 NO_STRCASESTR = YesPlease
681 NO_MEMMEM = YesPlease
682endif
683ifeq ($(uname_S),SCO_SV)
684 ifeq ($(uname_R),3.2)
685 CFLAGS = -O2
686 endif
687 ifeq ($(uname_R),5)
688 CC = cc
689 BASIC_CFLAGS += -Kthread
690 endif
691 NEEDS_SOCKET = YesPlease
692 NEEDS_NSL = YesPlease
693 NEEDS_SSL_WITH_CRYPTO = YesPlease
694 NEEDS_LIBICONV = YesPlease
695 SHELL_PATH = /usr/bin/bash
696 NO_IPV6 = YesPlease
697 NO_HSTRERROR = YesPlease
0620b39b 698 NO_MKSTEMPS = YesPlease
457bb452
BLG
699 BASIC_CFLAGS += -I/usr/local/include
700 BASIC_LDFLAGS += -L/usr/local/lib
701 NO_STRCASESTR = YesPlease
702 NO_MEMMEM = YesPlease
703 INSTALL = ginstall
704 TAR = gtar
705endif
f7c15343 706ifeq ($(uname_S),Darwin)
597c9cc5
JH
707 NEEDS_SSL_WITH_CRYPTO = YesPlease
708 NEEDS_LIBICONV = YesPlease
7233d221 709 ifeq ($(shell expr "$(uname_R)" : '[15678]\.'),2)
fe4aafba
WC
710 OLD_ICONV = UnfortunatelyYes
711 endif
7233d221
JS
712 ifeq ($(shell expr "$(uname_R)" : '[15]\.'),2)
713 NO_STRLCPY = YesPlease
714 endif
3d59405c 715 NO_MEMMEM = YesPlease
954597bd 716 THREADED_DELTA_SEARCH = YesPlease
c567383b 717 USE_ST_TIMESPEC = YesPlease
597c9cc5 718endif
f7c15343 719ifeq ($(uname_S),SunOS)
f0ebff0d 720 NEEDS_SOCKET = YesPlease
5a90d4ac 721 NEEDS_NSL = YesPlease
229a7ed7 722 SHELL_PATH = /bin/bash
0e0aea5a 723 SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
229a7ed7 724 NO_STRCASESTR = YesPlease
b21b9f1d 725 NO_MEMMEM = YesPlease
4e0da763 726 NO_MKDTEMP = YesPlease
0620b39b 727 NO_MKSTEMPS = YesPlease
ee78cac2 728 NO_REGEX = YesPlease
a7a24ee7
BC
729 ifeq ($(uname_R),5.7)
730 NEEDS_RESOLV = YesPlease
731 NO_IPV6 = YesPlease
732 NO_SOCKADDR_STORAGE = YesPlease
733 NO_UNSETENV = YesPlease
734 NO_SETENV = YesPlease
735 NO_STRLCPY = YesPlease
736 NO_C99_FORMAT = YesPlease
737 NO_STRTOUMAX = YesPlease
a0c0be97 738 endif
e40b61fb 739 ifeq ($(uname_R),5.8)
731043fd 740 NO_UNSETENV = YesPlease
e40b61fb 741 NO_SETENV = YesPlease
66c4509b 742 NO_C99_FORMAT = YesPlease
bc6b4f52 743 NO_STRTOUMAX = YesPlease
e40b61fb 744 endif
40d88d4f
DS
745 ifeq ($(uname_R),5.9)
746 NO_UNSETENV = YesPlease
747 NO_SETENV = YesPlease
66c4509b 748 NO_C99_FORMAT = YesPlease
bc6b4f52 749 NO_STRTOUMAX = YesPlease
40d88d4f 750 endif
70cf9910
BC
751 ifdef NO_IPV6
752 NEEDS_RESOLV = YesPlease
753 endif
efc07deb 754 INSTALL = /usr/ucb/install
229a7ed7 755 TAR = gtar
1d7b1af4 756 BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
f0ebff0d 757endif
f7c15343 758ifeq ($(uname_O),Cygwin)
63be37b0 759 NO_D_TYPE_IN_DIRENT = YesPlease
35a730f0 760 NO_D_INO_IN_DIRENT = YesPlease
17754517 761 NO_STRCASESTR = YesPlease
b21b9f1d 762 NO_MEMMEM = YesPlease
0620b39b 763 NO_MKSTEMPS = YesPlease
9f0bb90d 764 NO_SYMLINK_HEAD = YesPlease
17754517 765 NEEDS_LIBICONV = YesPlease
1510fea7 766 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
c869753e 767 NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
7a4a2e1f 768 OLD_ICONV = UnfortunatelyYes
2e67a5f4
JH
769 # There are conflicting reports about this.
770 # On some boxes NO_MMAP is needed, and not so elsewhere.
87ac1390
JH
771 # Try commenting this out if you suspect MMAP is more efficient
772 NO_MMAP = YesPlease
49744d63 773 NO_IPV6 = YesPlease
a23cd8ec 774 X = .exe
7c6ef2f2 775endif
b3bf974c
AK
776ifeq ($(uname_S),FreeBSD)
777 NEEDS_LIBICONV = YesPlease
a2f22dbf 778 NO_MEMMEM = YesPlease
8d7f586f
PB
779 BASIC_CFLAGS += -I/usr/local/include
780 BASIC_LDFLAGS += -L/usr/local/lib
81a24b52 781 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
91408042 782 USE_ST_TIMESPEC = YesPlease
38bd6497 783 THREADED_DELTA_SEARCH = YesPlease
069bb576 784 ifeq ($(shell expr "$(uname_R)" : '4\.'),2)
158629b2 785 PTHREAD_LIBS = -pthread
069bb576
DS
786 NO_UINTMAX_T = YesPlease
787 NO_STRTOUMAX = YesPlease
788 endif
b3bf974c 789endif
f7c15343 790ifeq ($(uname_S),OpenBSD)
5fb41e8a 791 NO_STRCASESTR = YesPlease
b21b9f1d 792 NO_MEMMEM = YesPlease
90f2e652 793 USE_ST_TIMESPEC = YesPlease
18c5a525 794 NEEDS_LIBICONV = YesPlease
8d7f586f
PB
795 BASIC_CFLAGS += -I/usr/local/include
796 BASIC_LDFLAGS += -L/usr/local/lib
38bd6497 797 THREADED_DELTA_SEARCH = YesPlease
94d23317
JH
798endif
799ifeq ($(uname_S),NetBSD)
e88856b4
DS
800 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
801 NEEDS_LIBICONV = YesPlease
802 endif
8d7f586f 803 BASIC_CFLAGS += -I/usr/pkg/include
f5b904db 804 BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
38bd6497 805 THREADED_DELTA_SEARCH = YesPlease
9a695fbf 806 USE_ST_TIMESPEC = YesPlease
0620b39b 807 NO_MKSTEMPS = YesPlease
18c5a525 808endif
a6da9395
JR
809ifeq ($(uname_S),AIX)
810 NO_STRCASESTR=YesPlease
b21b9f1d 811 NO_MEMMEM = YesPlease
377d9c40 812 NO_MKDTEMP = YesPlease
0620b39b 813 NO_MKSTEMPS = YesPlease
817151e6 814 NO_STRLCPY = YesPlease
c06ff490 815 NO_NSEC = YesPlease
377d9c40
MR
816 FREAD_READS_DIRECTORIES = UnfortunatelyYes
817 INTERNAL_QSORT = UnfortunatelyYes
a6da9395 818 NEEDS_LIBICONV=YesPlease
377d9c40 819 BASIC_CFLAGS += -D_LARGE_FILES
46059cc6
JH
820 ifneq ($(shell expr "$(uname_V)" : '[1234]'),1)
821 THREADED_DELTA_SEARCH = YesPlease
822 else
823 NO_PTHREADS = YesPlease
824 endif
a6da9395 825endif
c29ba0c3
TS
826ifeq ($(uname_S),GNU)
827 # GNU/Hurd
828 NO_STRLCPY=YesPlease
0620b39b 829 NO_MKSTEMPS = YesPlease
c29ba0c3 830endif
289c4b36
JS
831ifeq ($(uname_S),IRIX64)
832 NO_IPV6=YesPlease
833 NO_SETENV=YesPlease
834 NO_STRCASESTR=YesPlease
b21b9f1d 835 NO_MEMMEM = YesPlease
0620b39b 836 NO_MKSTEMPS = YesPlease
817151e6 837 NO_STRLCPY = YesPlease
289c4b36
JS
838 NO_SOCKADDR_STORAGE=YesPlease
839 SHELL_PATH=/usr/gnu/bin/bash
8d7f586f 840 BASIC_CFLAGS += -DPATH_MAX=1024
289c4b36 841 # for now, build 32-bit version
8d7f586f 842 BASIC_LDFLAGS += -L/usr/lib32
289c4b36 843endif
81cc66a5
RS
844ifeq ($(uname_S),HP-UX)
845 NO_IPV6=YesPlease
846 NO_SETENV=YesPlease
847 NO_STRCASESTR=YesPlease
848 NO_MEMMEM = YesPlease
0620b39b 849 NO_MKSTEMPS = YesPlease
81cc66a5
RS
850 NO_STRLCPY = YesPlease
851 NO_MKDTEMP = YesPlease
852 NO_UNSETENV = YesPlease
853 NO_HSTRERROR = YesPlease
854 NO_SYS_SELECT_H = YesPlease
7d770163 855 SNPRINTF_RETURNS_BOGUS = YesPlease
81cc66a5 856endif
adbc0b6b
DP
857ifneq (,$(findstring CYGWIN,$(uname_S)))
858 COMPAT_OBJS += compat/cygwin.o
34779c53 859 UNRELIABLE_FSTAT = UnfortunatelyYes
adbc0b6b 860endif
f4626df5 861ifneq (,$(findstring MINGW,$(uname_S)))
352c8111 862 pathsep = ;
f4626df5
JS
863 NO_PREAD = YesPlease
864 NO_OPENSSL = YesPlease
e1c06886 865 NO_LIBGEN_H = YesPlease
f4626df5
JS
866 NO_SYMLINK_HEAD = YesPlease
867 NO_IPV6 = YesPlease
868 NO_SETENV = YesPlease
869 NO_UNSETENV = YesPlease
870 NO_STRCASESTR = YesPlease
871 NO_STRLCPY = YesPlease
872 NO_MEMMEM = YesPlease
873 NEEDS_LIBICONV = YesPlease
874 OLD_ICONV = YesPlease
875 NO_C99_FORMAT = YesPlease
876 NO_STRTOUMAX = YesPlease
877 NO_MKDTEMP = YesPlease
0620b39b 878 NO_MKSTEMPS = YesPlease
f4626df5
JS
879 SNPRINTF_RETURNS_BOGUS = YesPlease
880 NO_SVN_TESTS = YesPlease
881 NO_PERL_MAKEMAKER = YesPlease
25655221 882 RUNTIME_PREFIX = YesPlease
f4626df5 883 NO_POSIX_ONLY_PROGRAMS = YesPlease
fdb2a2a6 884 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
c06ff490 885 NO_NSEC = YesPlease
b130a72b 886 USE_WIN32_MMAP = YesPlease
f0ed8226 887 USE_NED_ALLOCATOR = YesPlease
34779c53 888 UNRELIABLE_FSTAT = UnfortunatelyYes
348df166 889 OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
02232adf
JK
890 NO_REGEX = YesPlease
891 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch
23326d14 892 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
02232adf 893 COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o
f4626df5
JS
894 EXTLIBS += -lws2_32
895 X = .exe
48c46f1a
SP
896ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
897 htmldir=doc/git/html/
898 prefix =
899 INSTALL = /bin/install
900 EXTLIBS += /mingw/lib/libz.a
901 NO_R_TO_GCC_LINKER = YesPlease
902 INTERNAL_QSORT = YesPlease
903 THREADED_DELTA_SEARCH = YesPlease
904else
905 NO_CURL = YesPlease
906 NO_PTHREADS = YesPlease
907endif
f4626df5 908endif
f7c15343
JH
909ifneq (,$(findstring arm,$(uname_M)))
910 ARM_SHA1 = YesPlease
0620b39b 911 NO_MKSTEMPS = YesPlease
f7c15343 912endif
597c9cc5 913
55667714 914-include config.mak.autogen
f2d6a256 915-include config.mak
597c9cc5 916
0e0aea5a 917ifdef SANE_TOOL_PATH
61dbb3c4
JH
918SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
919BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
0e0aea5a
JH
920PATH := $(SANE_TOOL_PATH):${PATH}
921else
61dbb3c4 922BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
0e0aea5a
JH
923endif
924
59f86740
BG
925ifeq ($(uname_S),Darwin)
926 ifndef NO_FINK
927 ifeq ($(shell test -d /sw/lib && echo y),y)
928 BASIC_CFLAGS += -I/sw/include
929 BASIC_LDFLAGS += -L/sw/lib
930 endif
931 endif
932 ifndef NO_DARWIN_PORTS
933 ifeq ($(shell test -d /opt/local/lib && echo y),y)
934 BASIC_CFLAGS += -I/opt/local/include
935 BASIC_LDFLAGS += -L/opt/local/lib
936 endif
937 endif
f7d9d04e 938 PTHREAD_LIBS =
59f86740
BG
939endif
940
f5b904db
JH
941ifndef CC_LD_DYNPATH
942 ifdef NO_R_TO_GCC_LINKER
943 # Some gcc does not accept and pass -R to the linker to specify
944 # the runtime dynamic library path.
945 CC_LD_DYNPATH = -Wl,-rpath,
946 else
947 CC_LD_DYNPATH = -R
948 endif
bbfc63dd
JH
949endif
950
e1c06886
DA
951ifdef NO_LIBGEN_H
952 COMPAT_CFLAGS += -DNO_LIBGEN_H
953 COMPAT_OBJS += compat/basename.o
954endif
955
30ae764b
DB
956ifdef NO_CURL
957 BASIC_CFLAGS += -DNO_CURL
958else
229a7ed7 959 ifdef CURLDIR
10861bea 960 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
8d7f586f 961 BASIC_CFLAGS += -I$(CURLDIR)/include
10861bea 962 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
229a7ed7
JH
963 else
964 CURL_LIBCURL = -lcurl
965 endif
30ae764b
DB
966 BUILTIN_OBJS += builtin-http-fetch.o
967 EXTLIBS += $(CURL_LIBCURL)
ccfc02a3 968 LIB_OBJS += http.o http-walker.o
08900987
NH
969 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
970 ifeq "$(curl_check)" "070908"
971 ifndef NO_EXPAT
08900987
NH
972 PROGRAMS += git-http-push$X
973 endif
58e60dd2 974 endif
459a21bd 975 ifndef NO_EXPAT
85b4518f
SB
976 ifdef EXPATDIR
977 BASIC_CFLAGS += -I$(EXPATDIR)/include
978 EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
979 else
980 EXPAT_LIBEXPAT = -lexpat
981 endif
459a21bd 982 endif
229a7ed7
JH
983endif
984
bef19da9
RS
985ifdef ZLIB_PATH
986 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
10861bea 987 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
bef19da9
RS
988endif
989EXTLIBS += -lz
990
58eda022
JS
991ifndef NO_POSIX_ONLY_PROGRAMS
992 PROGRAMS += git-daemon$X
993 PROGRAMS += git-imap-send$X
994endif
dd53c7ab 995ifndef NO_OPENSSL
215a7ad1 996 OPENSSL_LIBSSL = -lssl
455a7f32 997 ifdef OPENSSLDIR
8d7f586f 998 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
10861bea 999 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
455a7f32
JH
1000 else
1001 OPENSSL_LINK =
1002 endif
dd53c7ab 1003else
8d7f586f 1004 BASIC_CFLAGS += -DNO_OPENSSL
215a7ad1
JH
1005 MOZILLA_SHA1 = 1
1006 OPENSSL_LIBSSL =
dd53c7ab 1007endif
597c9cc5 1008ifdef NEEDS_SSL_WITH_CRYPTO
455a7f32 1009 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
597c9cc5 1010else
455a7f32 1011 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
597c9cc5
JH
1012endif
1013ifdef NEEDS_LIBICONV
455a7f32 1014 ifdef ICONVDIR
8d7f586f 1015 BASIC_CFLAGS += -I$(ICONVDIR)/include
10861bea 1016 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
455a7f32
JH
1017 else
1018 ICONV_LINK =
1019 endif
d595a473 1020 EXTLIBS += $(ICONV_LINK) -liconv
597c9cc5 1021endif
f0ebff0d 1022ifdef NEEDS_SOCKET
d595a473 1023 EXTLIBS += -lsocket
f0ebff0d 1024endif
5a90d4ac 1025ifdef NEEDS_NSL
d595a473 1026 EXTLIBS += -lnsl
5a90d4ac 1027endif
70cf9910
BC
1028ifdef NEEDS_RESOLV
1029 EXTLIBS += -lresolv
1030endif
63be37b0 1031ifdef NO_D_TYPE_IN_DIRENT
8d7f586f 1032 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
63be37b0 1033endif
35a730f0 1034ifdef NO_D_INO_IN_DIRENT
8d7f586f 1035 BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
35a730f0 1036endif
fdb2a2a6
JH
1037ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
1038 BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
1039endif
d7371a2d
BG
1040ifdef USE_NSEC
1041 BASIC_CFLAGS += -DUSE_NSEC
1042endif
c567383b
BG
1043ifdef USE_ST_TIMESPEC
1044 BASIC_CFLAGS += -DUSE_ST_TIMESPEC
1045endif
c06ff490
KB
1046ifdef NO_NSEC
1047 BASIC_CFLAGS += -DNO_NSEC
1048endif
579d1fbf 1049ifdef NO_C99_FORMAT
8188e73b 1050 BASIC_CFLAGS += -DNO_C99_FORMAT
579d1fbf 1051endif
c4582f93
MR
1052ifdef SNPRINTF_RETURNS_BOGUS
1053 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
1054 COMPAT_OBJS += compat/snprintf.o
1055endif
cba22528
BC
1056ifdef FREAD_READS_DIRECTORIES
1057 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
1058 COMPAT_OBJS += compat/fopen.o
1059endif
9f0bb90d 1060ifdef NO_SYMLINK_HEAD
8d7f586f 1061 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
9f0bb90d 1062endif
ef34af24 1063ifdef NO_STRCASESTR
4050c0df 1064 COMPAT_CFLAGS += -DNO_STRCASESTR
e40b61fb
JR
1065 COMPAT_OBJS += compat/strcasestr.o
1066endif
817151e6
PE
1067ifdef NO_STRLCPY
1068 COMPAT_CFLAGS += -DNO_STRLCPY
1069 COMPAT_OBJS += compat/strlcpy.o
1070endif
bc6b4f52
JR
1071ifdef NO_STRTOUMAX
1072 COMPAT_CFLAGS += -DNO_STRTOUMAX
1073 COMPAT_OBJS += compat/strtoumax.o
1074endif
1075ifdef NO_STRTOULL
1076 COMPAT_CFLAGS += -DNO_STRTOULL
1077endif
e40b61fb 1078ifdef NO_SETENV
4050c0df 1079 COMPAT_CFLAGS += -DNO_SETENV
e40b61fb 1080 COMPAT_OBJS += compat/setenv.o
ef34af24 1081endif
ca5bb5d5
SP
1082ifdef NO_MKDTEMP
1083 COMPAT_CFLAGS += -DNO_MKDTEMP
1084 COMPAT_OBJS += compat/mkdtemp.o
1085endif
0620b39b
DA
1086ifdef NO_MKSTEMPS
1087 COMPAT_CFLAGS += -DNO_MKSTEMPS
1088 COMPAT_OBJS += compat/mkstemps.o
1089endif
104ff34a 1090ifdef NO_UNSETENV
731043fd
JR
1091 COMPAT_CFLAGS += -DNO_UNSETENV
1092 COMPAT_OBJS += compat/unsetenv.o
1093endif
2600973f
RS
1094ifdef NO_SYS_SELECT_H
1095 BASIC_CFLAGS += -DNO_SYS_SELECT_H
1096endif
730d48a2 1097ifdef NO_MMAP
4050c0df 1098 COMPAT_CFLAGS += -DNO_MMAP
e40b61fb 1099 COMPAT_OBJS += compat/mmap.o
b130a72b
JL
1100else
1101 ifdef USE_WIN32_MMAP
1102 COMPAT_CFLAGS += -DUSE_WIN32_MMAP
1103 COMPAT_OBJS += compat/win32mmap.o
1104 endif
730d48a2 1105endif
348df166
JS
1106ifdef OBJECT_CREATION_USES_RENAMES
1107 COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
be66a6c4 1108endif
6900679c
SH
1109ifdef NO_PREAD
1110 COMPAT_CFLAGS += -DNO_PREAD
1111 COMPAT_OBJS += compat/pread.o
1112endif
1510fea7
SP
1113ifdef NO_FAST_WORKING_DIRECTORY
1114 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
1115endif
c869753e
SP
1116ifdef NO_TRUSTABLE_FILEMODE
1117 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
1118endif
49744d63 1119ifdef NO_IPV6
8d7f586f 1120 BASIC_CFLAGS += -DNO_IPV6
bdc37f5a 1121endif
0bc3e781
DS
1122ifdef NO_UINTMAX_T
1123 BASIC_CFLAGS += -Duintmax_t=uint32_t
1124endif
bdc37f5a
JH
1125ifdef NO_SOCKADDR_STORAGE
1126ifdef NO_IPV6
8d7f586f 1127 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
bdc37f5a 1128else
8d7f586f 1129 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
bdc37f5a 1130endif
49744d63 1131endif
6ba68ab2
YL
1132ifdef NO_INET_NTOP
1133 LIB_OBJS += compat/inet_ntop.o
1134endif
dd467629
JL
1135ifdef NO_INET_PTON
1136 LIB_OBJS += compat/inet_pton.o
1137endif
cef661fc 1138
b6e56eca 1139ifdef NO_ICONV
8d7f586f 1140 BASIC_CFLAGS += -DNO_ICONV
b6e56eca
FP
1141endif
1142
fd547a97
RJ
1143ifdef OLD_ICONV
1144 BASIC_CFLAGS += -DOLD_ICONV
1145endif
1146
609a2289
DS
1147ifdef NO_DEFLATE_BOUND
1148 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
1149endif
1150
7c6ef2f2
NP
1151ifdef PPC_SHA1
1152 SHA1_HEADER = "ppc/sha1.h"
1153 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
1154else
1155ifdef ARM_SHA1
1156 SHA1_HEADER = "arm/sha1.h"
1157 LIB_OBJS += arm/sha1.o arm/sha1_arm.o
1158else
1159ifdef MOZILLA_SHA1
1160 SHA1_HEADER = "mozilla-sha1/sha1.h"
1161 LIB_OBJS += mozilla-sha1/sha1.o
1162else
1163 SHA1_HEADER = <openssl/sha.h>
d595a473 1164 EXTLIBS += $(LIB_4_CRYPTO)
7c6ef2f2
NP
1165endif
1166endif
1167endif
f848718a
AR
1168ifdef NO_PERL_MAKEMAKER
1169 export NO_PERL_MAKEMAKER
1170endif
fa0c87c3
AR
1171ifdef NO_HSTRERROR
1172 COMPAT_CFLAGS += -DNO_HSTRERROR
1173 COMPAT_OBJS += compat/hstrerror.o
1174endif
b21b9f1d
RS
1175ifdef NO_MEMMEM
1176 COMPAT_CFLAGS += -DNO_MEMMEM
1177 COMPAT_OBJS += compat/memmem.o
1178endif
43fe901b
BD
1179ifdef INTERNAL_QSORT
1180 COMPAT_CFLAGS += -DINTERNAL_QSORT
1181 COMPAT_OBJS += compat/qsort.o
1182endif
35fb0e86
SP
1183ifdef RUNTIME_PREFIX
1184 COMPAT_CFLAGS += -DRUNTIME_PREFIX
1185endif
b7774343 1186
46059cc6
JH
1187ifdef NO_PTHREADS
1188 THREADED_DELTA_SEARCH =
1189 BASIC_CFLAGS += -DNO_PTHREADS
1190else
1191 EXTLIBS += $(PTHREAD_LIBS)
1192endif
1193
8ecce684
NP
1194ifdef THREADED_DELTA_SEARCH
1195 BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
833e3df1 1196 LIB_OBJS += thread-utils.o
8ecce684 1197endif
81a24b52
AR
1198ifdef DIR_HAS_BSD_GROUP_SEMANTICS
1199 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
1200endif
5f7c643a
JK
1201ifdef NO_EXTERNAL_GREP
1202 BASIC_CFLAGS += -DNO_EXTERNAL_GREP
1203endif
34779c53
JS
1204ifdef UNRELIABLE_FSTAT
1205 BASIC_CFLAGS += -DUNRELIABLE_FSTAT
1206endif
02232adf
JK
1207ifdef NO_REGEX
1208 COMPAT_CFLAGS += -Icompat/regex
1209 COMPAT_OBJS += compat/regex/regex.o
1210endif
8ecce684 1211
f0ed8226
MSO
1212ifdef USE_NED_ALLOCATOR
1213 COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
1214 COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
1215endif
1216
81b63c70
ER
1217ifeq ($(TCLTK_PATH),)
1218NO_TCLTK=NoThanks
1219endif
1220
499c2939
JK
1221ifeq ($(PERL_PATH),)
1222NO_PERL=NoThanks
1223endif
1224
3b486cd2 1225QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
b7774343
AR
1226QUIET_SUBDIR1 =
1227
a6f37099
AR
1228ifneq ($(findstring $(MAKEFLAGS),w),w)
1229PRINT_DIR = --no-print-directory
1230else # "make -w"
1231NO_SUBDIR = :
1232endif
1233
b7774343 1234ifneq ($(findstring $(MAKEFLAGS),s),s)
2314c947 1235ifndef V
31d0399c 1236 QUIET_CC = @echo ' ' CC $@;
74f2b2a8
SP
1237 QUIET_AR = @echo ' ' AR $@;
1238 QUIET_LINK = @echo ' ' LINK $@;
1239 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
1240 QUIET_GEN = @echo ' ' GEN $@;
3b486cd2 1241 QUIET_SUBDIR0 = +@subdir=
a6f37099
AR
1242 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
1243 $(MAKE) $(PRINT_DIR) -C $$subdir
2314c947 1244 export V
31d0399c 1245 export QUIET_GEN
b7774343
AR
1246 export QUIET_BUILT_IN
1247endif
74f2b2a8 1248endif
7c6ef2f2 1249
4c7100a9
JH
1250ifdef ASCIIDOC8
1251 export ASCIIDOC8
1252endif
1253
addf88e4 1254# Shell quote (do not use $(call) to accommodate ancient setups);
39c015c5
JS
1255
1256SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
32043c9f 1257ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
39c015c5
JS
1258
1259DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
1260bindir_SQ = $(subst ','\'',$(bindir))
026fa0d5 1261bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
8e566f24 1262mandir_SQ = $(subst ','\'',$(mandir))
a149a1a4 1263infodir_SQ = $(subst ','\'',$(infodir))
39c015c5
JS
1264gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
1265template_dir_SQ = $(subst ','\'',$(template_dir))
5d6491c7 1266htmldir_SQ = $(subst ','\'',$(htmldir))
ca3bcabf 1267prefix_SQ = $(subst ','\'',$(prefix))
39c015c5
JS
1268
1269SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
1270PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
81b63c70 1271TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
39c015c5 1272
d595a473
PB
1273LIBS = $(GITLIBS) $(EXTLIBS)
1274
32043c9f 1275BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
506b17b1 1276 $(COMPAT_CFLAGS)
e40b61fb 1277LIB_OBJS += $(COMPAT_OBJS)
8d7f586f
PB
1278
1279ALL_CFLAGS += $(BASIC_CFLAGS)
1280ALL_LDFLAGS += $(BASIC_LDFLAGS)
1281
a42cbacc 1282export TAR INSTALL DESTDIR SHELL_PATH
d595a473
PB
1283
1284
28818ffa
PB
1285### Build rules
1286
c94c8e5f
BC
1287SHELL = $(SHELL_PATH)
1288
6dc4627e 1289all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
6fc301bb 1290ifneq (,$X)
900a5d07 1291 $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
6fc301bb 1292endif
89967023 1293
6fc301bb 1294all::
3cfaf11b 1295ifndef NO_TCLTK
e84a063d 1296 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) gitexecdir='$(gitexec_instdir_SQ)' all
62ba5143 1297 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
3cfaf11b 1298endif
499c2939 1299ifndef NO_PERL
74f2b2a8 1300 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
499c2939 1301endif
74f2b2a8 1302 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
b05701c5 1303
6dc4627e
BC
1304please_set_SHELL_PATH_to_a_more_modern_shell:
1305 @$$(:)
1306
1307shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
1308
4dc00021
JH
1309strip: $(PROGRAMS) git$X
1310 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
1311
334d28ae
JH
1312git.o: git.c common-cmds.h GIT-CFLAGS
1313 $(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
89a56bfb 1314 '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
334d28ae
JH
1315 $(ALL_CFLAGS) -c $(filter %.c,$^)
1316
1317git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
54dadbdb 1318 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
70827b15 1319 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
6a2e50f9 1320
3d78d1f1 1321builtin-help.o: builtin-help.c common-cmds.h GIT-CFLAGS
a149a1a4 1322 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
482cce82 1323 '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
a149a1a4
JH
1324 '-DGIT_MAN_PATH="$(mandir_SQ)"' \
1325 '-DGIT_INFO_PATH="$(infodir_SQ)"' $<
08df6171 1326
91730800 1327$(BUILT_INS): git$X
3e073dc5
AF
1328 $(QUIET_BUILT_IN)$(RM) $@ && \
1329 ln git$X $@ 2>/dev/null || \
1330 ln -s git$X $@ 2>/dev/null || \
1331 cp git$X $@
91730800 1332
79d30668 1333common-cmds.h: ./generate-cmdlist.sh command-list.txt
48dd1da8 1334
766b084f 1335common-cmds.h: $(wildcard Documentation/git-*.txt)
74f2b2a8 1336 $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
a87cd02c 1337
d6ebd259 1338$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
4cb08df5 1339 $(QUIET_GEN)$(RM) $@ $@+ && \
39c015c5 1340 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
4bf9f27d 1341 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
3ff8cbed 1342 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
6c5c62f3 1343 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
61dbb3c4 1344 -e $(BROKEN_PATH_FIX) \
74f2b2a8
SP
1345 $@.sh >$@+ && \
1346 chmod +x $@+ && \
fc36f6a6 1347 mv $@+ $@
bc6146d2 1348
499c2939 1349ifndef NO_PERL
f848718a
AR
1350$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
1351
d1a20575 1352perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
31d0399c 1353 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
f848718a 1354
f6276fe1 1355$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
4cb08df5 1356 $(QUIET_GEN)$(RM) $@ $@+ && \
e883932f 1357 INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
998c4daa
JH
1358 sed -e '1{' \
1359 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1360 -e ' h' \
352c8111 1361 -e ' s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
998c4daa
JH
1362 -e ' H' \
1363 -e ' x' \
1364 -e '}' \
f6276fe1 1365 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
3ff8cbed 1366 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
74f2b2a8
SP
1367 $@.perl >$@+ && \
1368 chmod +x $@+ && \
fc36f6a6 1369 mv $@+ $@
bc6146d2 1370
62f780dc 1371OTHER_PROGRAMS += gitweb/gitweb.cgi
5d043a3d 1372gitweb/gitweb.cgi: gitweb/gitweb.perl
4cb08df5 1373 $(QUIET_GEN)$(RM) $@ $@+ && \
5d043a3d 1374 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
06c084d2
JH
1375 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
1376 -e 's|++GIT_BINDIR++|$(bindir)|g' \
1377 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
26ffcb76 1378 -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
2de21fac 1379 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
06c084d2
JH
1380 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
1381 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
ca5e9495 1382 -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
32f4aacc
ML
1383 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
1384 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
19a8721e 1385 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
06c084d2
JH
1386 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
1387 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
1388 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
1389 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
0b5deba1 1390 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
b2d3476e
AC
1391 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
1392 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
74f2b2a8
SP
1393 $< >$@+ && \
1394 chmod +x $@+ && \
5d043a3d
MW
1395 mv $@+ $@
1396
a51d37c1 1397git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
4cb08df5 1398 $(QUIET_GEN)$(RM) $@ $@+ && \
a51d37c1
EW
1399 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1400 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1401 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
6e959ab0 1402 -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
07002287 1403 -e '/@@GITWEB_CGI@@/d' \
6e959ab0 1404 -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
07002287 1405 -e '/@@GITWEB_CSS@@/d' \
c5699693 1406 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
74f2b2a8
SP
1407 $@.sh > $@+ && \
1408 chmod +x $@+ && \
a51d37c1 1409 mv $@+ $@
499c2939
JK
1410else # NO_PERL
1411$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
1412 $(QUIET_GEN)$(RM) $@ $@+ && \
1413 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1414 -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
1415 unimplemented.sh >$@+ && \
1416 chmod +x $@+ && \
1417 mv $@+ $@
1418endif # NO_PERL
a51d37c1 1419
3900145e 1420configure: configure.ac
4cb08df5 1421 $(QUIET_GEN)$(RM) $@ $<+ && \
3900145e 1422 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
74f2b2a8
SP
1423 $< > $<+ && \
1424 autoconf -o $@ $<+ && \
4cb08df5 1425 $(RM) $<+
3900145e 1426
9b88fcef 1427# These can record GIT_VERSION
54dadbdb 1428git.o git.spec \
9b88fcef
JH
1429 $(patsubst %.sh,%,$(SCRIPT_SH)) \
1430 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
9b88fcef 1431 : GIT-VERSION-FILE
e99fcf96 1432
ca3bcabf 1433%.o: %.c GIT-CFLAGS
74f2b2a8 1434 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
e36cb1c1
LT
1435%.s: %.c GIT-CFLAGS
1436 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
b05701c5 1437%.o: %.S
74f2b2a8 1438 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
a310d434 1439
ca3bcabf 1440exec_cmd.o: exec_cmd.c GIT-CFLAGS
026fa0d5
SP
1441 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
1442 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1443 '-DBINDIR="$(bindir_relative_SQ)"' \
1444 '-DPREFIX="$(prefix_SQ)"' \
1445 $<
1446
c1f8064b 1447builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
74f2b2a8 1448 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
77cb17e9 1449
506b17b1
JS
1450config.o: config.c GIT-CFLAGS
1451 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $<
1452
ca3bcabf 1453http.o: http.c GIT-CFLAGS
74f2b2a8 1454 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
20fc9bc5 1455
8d9fbe57 1456ifdef NO_EXPAT
30ae764b 1457http-walker.o: http-walker.c http.h GIT-CFLAGS
74f2b2a8 1458 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
8d9fbe57
NH
1459endif
1460
8eef8e09 1461git-%$X: %.o $(GITLIBS)
74f2b2a8 1462 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
623c8a14 1463
684ec6c6
RS
1464git-imap-send$X: imap-send.o $(GITLIBS)
1465 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1466 $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
f2561fda 1467
923e3ec8 1468http.o http-walker.o http-push.o transport.o: http.h
39c015c5 1469
8fced61c 1470git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
74f2b2a8 1471 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
39c015c5
JS
1472 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1473
ccfc02a3 1474$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
fe104986 1475$(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
fa470160 1476builtin-revert.o wt-status.o: wt-status.h
e83c5163 1477
28818ffa 1478$(LIB_FILE): $(LIB_OBJS)
4cb08df5 1479 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
28818ffa 1480
857b933e 1481XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
34292bdd 1482 xdiff/xmerge.o xdiff/xpatience.o
17b96be2
AW
1483$(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1484 xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
3443546f
LT
1485
1486$(XDIFF_LIB): $(XDIFF_OBJS)
4cb08df5 1487 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
3443546f
LT
1488
1489
28818ffa
PB
1490doc:
1491 $(MAKE) -C Documentation all
1492
414851a4
MG
1493man:
1494 $(MAKE) -C Documentation man
1495
1496html:
1497 $(MAKE) -C Documentation html
1498
4739809c
DK
1499info:
1500 $(MAKE) -C Documentation info
1501
a325a1a7
MV
1502pdf:
1503 $(MAKE) -C Documentation pdf
1504
f81e7c62 1505TAGS:
4cb08df5 1506 $(RM) TAGS
89b2f19c 1507 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
f81e7c62
FK
1508
1509tags:
4cb08df5 1510 $(RM) tags
89b2f19c 1511 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
28818ffa 1512
a2a9150b
KP
1513cscope:
1514 $(RM) cscope*
1515 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
1516
ca3bcabf 1517### Detect prefix changes
7cdbff14 1518TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
ca3bcabf
YL
1519 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1520
1521GIT-CFLAGS: .FORCE-GIT-CFLAGS
1522 @FLAGS='$(TRACK_CFLAGS)'; \
1523 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1524 echo 1>&2 " * new build flags or prefix"; \
1525 echo "$$FLAGS" >GIT-CFLAGS; \
1526 fi
1527
bfce5087
JH
1528# We need to apply sq twice, once to protect from the shell
1529# that runs GIT-BUILD-OPTIONS, and then again to protect it
1530# and the first level quoting from the shell that runs "echo".
7cf7f54a 1531GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
bfce5087
JH
1532 @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
1533 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
119c8eee 1534 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
1b19ccd2 1535 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
7cf7f54a 1536
6bdb18a9
ER
1537### Detect Tck/Tk interpreter path changes
1538ifndef NO_TCLTK
1539TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1540
1541GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
1542 @VARS='$(TRACK_VARS)'; \
1543 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1544 echo 1>&2 " * new Tcl/Tk interpreter location"; \
1545 echo "$$VARS" >$@; \
1546 fi
1547
1548.PHONY: .FORCE-GIT-GUI-VARS
1549endif
1550
28818ffa
PB
1551### Testing rules
1552
9002ec3a 1553TEST_PROGRAMS += test-chmtime$X
b4285c71 1554TEST_PROGRAMS += test-ctype$X
9002ec3a
JK
1555TEST_PROGRAMS += test-date$X
1556TEST_PROGRAMS += test-delta$X
b63bc0bc 1557TEST_PROGRAMS += test-dump-cache-tree$X
9002ec3a
JK
1558TEST_PROGRAMS += test-genrandom$X
1559TEST_PROGRAMS += test-match-trees$X
1560TEST_PROGRAMS += test-parse-options$X
1561TEST_PROGRAMS += test-path-utils$X
1562TEST_PROGRAMS += test-sha1$X
4a16d072 1563TEST_PROGRAMS += test-sigchain$X
96651ef5
JH
1564
1565all:: $(TEST_PROGRAMS)
1566
abb7c7b3
JS
1567# GNU make supports exporting all variables by "export" without parameters.
1568# However, the environment gets quite big, and some programs have problems
1569# with that.
1570
140245b3 1571export NO_SVN_TESTS
abb7c7b3 1572
96651ef5 1573test: all
28818ffa
PB
1574 $(MAKE) -C t/ all
1575
b4285c71
RS
1576test-ctype$X: ctype.o
1577
5c5ba73b 1578test-date$X: date.o ctype.o
28818ffa 1579
5c5ba73b 1580test-delta$X: diff-delta.o patch-delta.o
28818ffa 1581
481424e1
AR
1582test-parse-options$X: parse-options.o
1583
26c117d0
JH
1584test-parse-options.o: parse-options.h
1585
fa8fe28c
JH
1586.PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
1587
5c5ba73b
JP
1588test-%$X: test-%.o $(GITLIBS)
1589 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
2dca1af4 1590
b65bc21e
JH
1591check-sha1:: test-sha1$X
1592 ./test-sha1.sh
1593
7c4c9f4c 1594check: common-cmds.h
912f9980
JH
1595 if sparse; \
1596 then \
1597 for i in *.c; \
1598 do \
1599 sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
1600 done; \
1601 else \
1602 echo 2>&1 "Did you mean 'make test'?"; \
1603 exit 1; \
1604 fi
28818ffa 1605
36e5e70e 1606remove-dashes:
b4f02d35 1607 ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
28818ffa
PB
1608
1609### Installation rules
1610
0c0ead7e 1611ifneq ($(filter /%,$(firstword $(template_dir))),)
0b50b860 1612template_instdir = $(template_dir)
026fa0d5
SP
1613else
1614template_instdir = $(prefix)/$(template_dir)
0b50b860
JS
1615endif
1616export template_instdir
1617
0c0ead7e 1618ifneq ($(filter /%,$(firstword $(gitexecdir))),)
49fa65a7 1619gitexec_instdir = $(gitexecdir)
026fa0d5
SP
1620else
1621gitexec_instdir = $(prefix)/$(gitexecdir)
49fa65a7
JS
1622endif
1623gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
1624export gitexec_instdir
1625
d6ebd259 1626install: all
41650765 1627 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
49fa65a7
JS
1628 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
1629 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
ede4caf6 1630 $(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'
7ffe7098 1631 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
5be3b17f 1632ifndef NO_PERL
28072a5d 1633 $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
5be3b17f 1634endif
3cfaf11b 1635ifndef NO_TCLTK
62ba5143 1636 $(MAKE) -C gitk-git install
49fa65a7 1637 $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
3cfaf11b 1638endif
6fc301bb 1639ifneq (,$X)
d4b19027 1640 $(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 1641endif
46beb559 1642 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
49fa65a7 1643 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
3e073dc5 1644 { $(RM) "$$execdir/git-add$X" && \
3426e34f 1645 test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
6a0861a8
GP
1646 ln "$$bindir/git$X" "$$execdir/git-add$X" 2>/dev/null || \
1647 cp "$$bindir/git$X" "$$execdir/git-add$X"; } && \
b56c79cc
BC
1648 { for p in $(filter-out git-add$X,$(BUILT_INS)); do \
1649 $(RM) "$$execdir/$$p" && \
1650 ln "$$execdir/git-add$X" "$$execdir/$$p" 2>/dev/null || \
1651 ln -s "git-add$X" "$$execdir/$$p" 2>/dev/null || \
1652 cp "$$execdir/git-add$X" "$$execdir/$$p" || exit; \
fe4a9c36 1653 done; } && \
7b4b59a9 1654 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
28818ffa
PB
1655
1656install-doc:
1657 $(MAKE) -C Documentation install
1658
b1a46b70
MH
1659install-man:
1660 $(MAKE) -C Documentation install-man
1661
ae081f3e
TL
1662install-html:
1663 $(MAKE) -C Documentation install-html
1664
4739809c
DK
1665install-info:
1666 $(MAKE) -C Documentation install-info
1667
a325a1a7
MV
1668install-pdf:
1669 $(MAKE) -C Documentation install-pdf
1670
6538d1ef
EW
1671quick-install-doc:
1672 $(MAKE) -C Documentation quick-install
28818ffa 1673
b1a46b70
MH
1674quick-install-man:
1675 $(MAKE) -C Documentation quick-install-man
1676
6fe570de
MG
1677quick-install-html:
1678 $(MAKE) -C Documentation quick-install-html
1679
28818ffa
PB
1680
1681
1682### Maintainer's dist rules
1683
9b88fcef 1684git.spec: git.spec.in
fc36f6a6
JM
1685 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
1686 mv $@+ $@
a9db2974 1687
27dedf0c 1688GIT_TARNAME=git-$(GIT_VERSION)
6c0f8694 1689dist: git.spec git-archive$(X) configure
9ccb64c8
JH
1690 ./git-archive --format=tar \
1691 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
a9db2974 1692 @mkdir -p $(GIT_TARNAME)
f58494bf 1693 @cp git.spec configure $(GIT_TARNAME)
181129d2 1694 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
d647c2ea 1695 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
181129d2 1696 $(TAR) rf $(GIT_TARNAME).tar \
d647c2ea 1697 $(GIT_TARNAME)/git.spec \
f58494bf 1698 $(GIT_TARNAME)/configure \
d647c2ea 1699 $(GIT_TARNAME)/version \
115f0fe4 1700 $(GIT_TARNAME)/git-gui/version
4cb08df5 1701 @$(RM) -r $(GIT_TARNAME)
9dce3c06 1702 gzip -f -9 $(GIT_TARNAME).tar
a9db2974
CW
1703
1704rpm: dist
27dedf0c 1705 $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
a9db2974 1706
52db0495
TS
1707htmldocs = git-htmldocs-$(GIT_VERSION)
1708manpages = git-manpages-$(GIT_VERSION)
1709dist-doc:
4cb08df5 1710 $(RM) -r .doc-tmp-dir
52db0495
TS
1711 mkdir .doc-tmp-dir
1712 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
1713 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
1714 gzip -n -9 -f $(htmldocs).tar
1715 :
4cb08df5 1716 $(RM) -r .doc-tmp-dir
4392da4d 1717 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
c5360324 1718 $(MAKE) -C Documentation DESTDIR=./ \
7b8cf0cf 1719 man1dir=../.doc-tmp-dir/man1 \
4392da4d 1720 man5dir=../.doc-tmp-dir/man5 \
7b8cf0cf 1721 man7dir=../.doc-tmp-dir/man7 \
52db0495
TS
1722 install
1723 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
1724 gzip -n -9 -f $(manpages).tar
4cb08df5 1725 $(RM) -r .doc-tmp-dir
52db0495 1726
28818ffa 1727### Cleaning rules
87a81c83 1728
922aa807
MM
1729distclean: clean
1730 $(RM) configure
1731
e83c5163 1732clean:
021fcd99 1733 $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
4cfc24af 1734 $(LIB_FILE) $(XDIFF_LIB)
4cb08df5
EM
1735 $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1736 $(RM) $(TEST_PROGRAMS)
a2a9150b 1737 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
4cb08df5 1738 $(RM) -r autom4te.cache
922aa807 1739 $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
4cb08df5
EM
1740 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
1741 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1742 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
ca67f002 1743 $(MAKE) -C Documentation/ clean
499c2939
JK
1744ifndef NO_PERL
1745 $(RM) gitweb/gitweb.cgi
f848718a 1746 $(MAKE) -C perl clean
499c2939 1747endif
b1edc53d 1748 $(MAKE) -C templates/ clean
4b7581f0 1749 $(MAKE) -C t/ clean
3cfaf11b 1750ifndef NO_TCLTK
62ba5143 1751 $(MAKE) -C gitk-git clean
3cfaf11b
ER
1752 $(MAKE) -C git-gui clean
1753endif
7cf7f54a 1754 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
9b88fcef 1755
4dc00021 1756.PHONY: all install clean strip
6dc4627e 1757.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
a2a9150b 1758.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS
7cf7f54a 1759.PHONY: .FORCE-GIT-BUILD-OPTIONS
d89056c2 1760
8c989ec5
JH
1761### Check documentation
1762#
1763check-docs::
3f7ce648 1764 @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
8c989ec5
JH
1765 do \
1766 case "$$v" in \
8c989ec5 1767 git-merge-octopus | git-merge-ours | git-merge-recursive | \
51add76e 1768 git-merge-resolve | git-merge-subtree | \
5c66d0d4 1769 git-fsck-objects | git-init-db | \
5b4617c7 1770 git-?*--?* ) continue ;; \
8c989ec5
JH
1771 esac ; \
1772 test -f "Documentation/$$v.txt" || \
1773 echo "no doc: $$v"; \
79d30668 1774 sed -e '/^#/d' command-list.txt | \
4b02c529 1775 grep -q "^$$v[ ]" || \
8c989ec5
JH
1776 case "$$v" in \
1777 git) ;; \
1778 *) echo "no link: $$v";; \
1779 esac ; \
3f7ce648
JH
1780 done; \
1781 ( \
79d30668 1782 sed -e '/^#/d' \
3f7ce648 1783 -e 's/[ ].*//' \
79d30668 1784 -e 's/^/listed /' command-list.txt; \
3f7ce648
JH
1785 ls -1 Documentation/git*txt | \
1786 sed -e 's|Documentation/|documented |' \
1787 -e 's/\.txt//'; \
1788 ) | while read how cmd; \
1789 do \
1790 case "$$how,$$cmd" in \
1791 *,git-citool | \
1792 *,git-gui | \
0f6f195b 1793 *,git-help | \
3f7ce648
JH
1794 documented,gitattributes | \
1795 documented,gitignore | \
1796 documented,gitmodules | \
2f7ee089 1797 documented,gitcli | \
3f7ce648 1798 documented,git-tools | \
d0594be1
JH
1799 documented,gitcore-tutorial | \
1800 documented,gitcvs-migration | \
1801 documented,gitdiffcore | \
1802 documented,gitglossary | \
1803 documented,githooks | \
1804 documented,gitrepository-layout | \
1805 documented,gittutorial | \
1806 documented,gittutorial-2 | \
3f7ce648
JH
1807 sentinel,not,matching,is,ok ) continue ;; \
1808 esac; \
1809 case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
1810 *" $$cmd "*) ;; \
1811 *) echo "removed but $$how: $$cmd" ;; \
1812 esac; \
1813 done ) | sort
c74390e4
JH
1814
1815### Make sure built-ins do not have dups and listed in git.c
1816#
1817check-builtins::
1818 ./check-builtins.sh
11c57e6a 1819
901c369a
TR
1820### Test suite coverage testing
1821#
1822.PHONY: coverage coverage-clean coverage-build coverage-report
1823
1824coverage:
1825 $(MAKE) coverage-build
1826 $(MAKE) coverage-report
1827
1828coverage-clean:
1829 rm -f *.gcda *.gcno
1830
1831COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
1832COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
1833
1834coverage-build: coverage-clean
1835 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
1836 $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
1837 -j1 test
1838
1839coverage-report:
1840 gcov -b *.c
1841 grep '^function.*called 0 ' *.c.gcov \
1842 | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
1843 | tee coverage-untested-functions