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