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