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