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