Fix compile error due to utime.h being in a conditional section.
[git/platforms.git] / Makefile
bloba6ed827fe6d2097e3bc5fc2aa63c8bb24cc79171
1 # The default target of this Makefile is...
2 all::
4 # Define V=1 to have a more verbose compile.
6 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
7 # or vsnprintf() return -1 instead of number of characters which would
8 # have been written to the final string if enough space had been available.
10 # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
11 # when attempting to read from an fopen'ed directory.
13 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
14 # This also implies MOZILLA_SHA1.
16 # Define NO_CURL if you do not have curl installed. git-http-pull and
17 # git-http-push are not built, and you cannot use http:// and https://
18 # transports.
20 # Define CURLDIR=/foo/bar if your curl header and library files are in
21 # /foo/bar/include and /foo/bar/lib directories.
23 # Define NO_EXPAT if you do not have expat installed. git-http-push is
24 # not built, and you cannot push using http:// and https:// transports.
26 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
28 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
29 # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
31 # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
32 # do not support the 'size specifiers' introduced by C99, namely ll, hh,
33 # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
34 # some C compilers supported these specifiers prior to C99 as an extension.
36 # Define NO_STRCASESTR if you don't have strcasestr.
38 # Define NO_MEMMEM if you don't have memmem.
40 # Define NO_STRLCPY if you don't have strlcpy.
42 # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
43 # If your compiler also does not support long long or does not have
44 # strtoull, define NO_STRTOULL.
46 # Define NO_SETENV if you don't have setenv in the C library.
48 # Define NO_UNSETENV if you don't have unsetenv in the C library.
50 # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
52 # Define NO_SYS_SELECT_H if you don't have sys/select.h.
54 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
55 # Enable it on Windows. By default, symrefs are still used.
57 # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
58 # tests. These tests take up a significant amount of the total test time
59 # but are not needed unless you plan to talk to SVN repos.
61 # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
62 # installed in /sw, but don't want GIT to link against any libraries
63 # installed there. If defined you may specify your own (or Fink's)
64 # include directories and library directories by defining CFLAGS
65 # and LDFLAGS appropriately.
67 # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
68 # have DarwinPorts installed in /opt/local, but don't want GIT to
69 # link against any libraries installed there. If defined you may
70 # specify your own (or DarwinPort's) include directories and
71 # library directories by defining CFLAGS and LDFLAGS appropriately.
73 # Define PPC_SHA1 environment variable when running make to make use of
74 # a bundled SHA1 routine optimized for PowerPC.
76 # Define ARM_SHA1 environment variable when running make to make use of
77 # a bundled SHA1 routine optimized for ARM.
79 # Define MOZILLA_SHA1 environment variable when running make to make use of
80 # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
81 # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
82 # choice) has very fast version optimized for i586.
84 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
86 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
88 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
89 # Patrick Mauritz).
91 # Define NO_MMAP if you want to avoid mmap.
93 # Define NO_PREAD if you have a problem with pread() system call (e.g.
94 # cygwin.dll before v1.5.22).
96 # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
97 # generally faster on your platform than accessing the working directory.
99 # Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
100 # the executable mode bit, but doesn't really do so.
102 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
104 # Define NO_SOCKADDR_STORAGE if your platform does not have struct
105 # sockaddr_storage.
107 # Define NO_ICONV if your libc does not properly support iconv.
109 # Define OLD_ICONV if your library has an old iconv(), where the second
110 # (input buffer pointer) parameter is declared with type (const char **).
112 # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
114 # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
115 # that tells runtime paths to dynamic libraries;
116 # "-Wl,-rpath=/path/lib" is used instead.
118 # Define USE_NSEC below if you want git to care about sub-second file mtimes
119 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
120 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
121 # randomly break unless your underlying filesystem supports those sub-second
122 # times (my ext3 doesn't).
124 # Define USE_STDEV below if you want git to care about the underlying device
125 # change being considered an inode change from the update-index perspective.
127 # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
129 # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
131 # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
132 # MakeMaker (e.g. using ActiveState under Cygwin).
134 # Define NO_TCLTK if you do not want Tcl/Tk GUI.
136 # The TCL_PATH variable governs the location of the Tcl interpreter
137 # used to optimize git-gui for your system. Only used if NO_TCLTK
138 # is not set. Defaults to the bare 'tclsh'.
140 # The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
141 # If not set it defaults to the bare 'wish'. If it is set to the empty
142 # string then NO_TCLTK will be forced (this is used by configure script).
144 # Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
145 # parallel delta searching when packing objects.
147 # Define INTERNAL_QSORT to use Git's implementation of qsort(), which
148 # is a simplified version of the merge sort used in glibc. This is
149 # recommended if Git triggers O(n^2) behavior in your platform's qsort().
151 # Define NO_EXTERNAL_GREP if you don't want "git grep" to ever call
152 # your external grep (e.g., if your system lacks grep, if its grep is
153 # broken, or spawning external process is slower than built-in grep git has).
155 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
156 @$(SHELL_PATH) ./GIT-VERSION-GEN
157 -include GIT-VERSION-FILE
159 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
160 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
161 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
162 uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
163 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
165 # CFLAGS and LDFLAGS are for the users to override from the command line.
167 CFLAGS = -g -O2 -Wall
168 LDFLAGS =
169 ALL_CFLAGS = $(CFLAGS)
170 ALL_LDFLAGS = $(LDFLAGS)
171 STRIP ?= strip
173 prefix = $(HOME)
174 bindir = $(prefix)/bin
175 mandir = $(prefix)/share/man
176 infodir = $(prefix)/share/info
177 gitexecdir = $(bindir)
178 sharedir = $(prefix)/share
179 template_dir = $(sharedir)/git-core/templates
180 htmldir=$(sharedir)/doc/git-doc
181 ifeq ($(prefix),/usr)
182 sysconfdir = /etc
183 else
184 sysconfdir = $(prefix)/etc
185 endif
186 lib = lib
187 ETC_GITCONFIG = $(sysconfdir)/gitconfig
188 # DESTDIR=
190 # default configuration for gitweb
191 GITWEB_CONFIG = gitweb_config.perl
192 GITWEB_HOME_LINK_STR = projects
193 GITWEB_SITENAME =
194 GITWEB_PROJECTROOT = /pub/git
195 GITWEB_PROJECT_MAXDEPTH = 2007
196 GITWEB_EXPORT_OK =
197 GITWEB_STRICT_EXPORT =
198 GITWEB_BASE_URL =
199 GITWEB_LIST =
200 GITWEB_HOMETEXT = indextext.html
201 GITWEB_CSS = gitweb.css
202 GITWEB_LOGO = git-logo.png
203 GITWEB_FAVICON = git-favicon.png
204 GITWEB_SITE_HEADER =
205 GITWEB_SITE_FOOTER =
207 export prefix bindir gitexecdir sharedir htmldir sysconfdir
209 CC = gcc
210 AR = ar
211 RM = rm -f
212 TAR = tar
213 FIND = find
214 INSTALL = install
215 RPMBUILD = rpmbuild
216 TCL_PATH = tclsh
217 TCLTK_PATH = wish
219 export TCL_PATH TCLTK_PATH
221 # sparse is architecture-neutral, which means that we need to tell it
222 # explicitly what architecture to check for. Fix this up for yours..
223 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
227 ### --- END CONFIGURATION SECTION ---
229 # Those must not be GNU-specific; they are shared with perl/ which may
230 # be built by a different compiler. (Note that this is an artifact now
231 # but it still might be nice to keep that distinction.)
232 BASIC_CFLAGS =
233 BASIC_LDFLAGS =
235 SCRIPT_SH = \
236 git-bisect.sh \
237 git-clone.sh \
238 git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
239 git-pull.sh git-rebase.sh git-rebase--interactive.sh \
240 git-repack.sh git-request-pull.sh \
241 git-sh-setup.sh \
242 git-am.sh \
243 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
244 git-merge-resolve.sh \
245 git-lost-found.sh git-quiltimport.sh git-submodule.sh \
246 git-filter-branch.sh \
247 git-stash.sh \
248 git-web--browse.sh
250 SCRIPT_PERL = \
251 git-add--interactive.perl \
252 git-archimport.perl git-cvsimport.perl git-relink.perl \
253 git-cvsserver.perl git-cvsexportcommit.perl \
254 git-send-email.perl git-svn.perl
256 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
257 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
258 git-instaweb
260 # ... and all the rest that could be moved out of bindir to gitexecdir
261 PROGRAMS = \
262 git-fetch-pack$X \
263 git-hash-object$X git-index-pack$X \
264 git-fast-import$X \
265 git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \
266 git-receive-pack$X \
267 git-send-pack$X git-shell$X \
268 git-show-index$X \
269 git-unpack-file$X \
270 git-update-server-info$X \
271 git-upload-pack$X \
272 git-pack-redundant$X git-var$X \
273 git-merge-tree$X \
274 $(POSIX_ONLY_PROGRAMS) \
275 $(EXTRA_PROGRAMS)
277 # Empty...
278 EXTRA_PROGRAMS =
280 # List built-in command $C whose implementation cmd_$C() is not in
281 # builtin-$C.o but is linked in as part of some other command.
282 BUILT_INS = \
283 git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
284 git-get-tar-commit-id$X git-init$X git-repo-config$X \
285 git-fsck-objects$X git-cherry-pick$X git-peek-remote$X git-status$X \
286 git-merge-subtree$X \
287 $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
289 # what 'all' will build and 'install' will install, in gitexecdir
290 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
292 # what 'all' will build but not install in gitexecdir
293 OTHER_PROGRAMS = git$X gitweb/gitweb.cgi
295 # Set paths to tools early so that they can be used for version tests.
296 ifndef SHELL_PATH
297 SHELL_PATH = /bin/sh
298 endif
299 ifndef PERL_PATH
300 PERL_PATH = /usr/bin/perl
301 endif
303 export PERL_PATH
305 LIB_FILE=libgit.a
306 XDIFF_LIB=xdiff/lib.a
308 LIB_H = \
309 archive.h blob.h cache.h cache-tree.h commit.h csum-file.h delta.h grep.h \
310 diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
311 run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
312 tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
313 utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \
314 mailmap.h remote.h parse-options.h transport.h diffcore.h hash.h ll-merge.h fsck.h \
315 pack-revindex.h compat/mingw.h
317 DIFF_OBJS = \
318 diff.o diff-lib.o diffcore-break.o diffcore-order.o \
319 diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \
320 diffcore-delta.o log-tree.o
322 LIB_OBJS = \
323 blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \
324 date.o diff-delta.o entry.o exec_cmd.o ident.o \
325 pretty.o interpolate.o hash.o \
326 lockfile.o \
327 patch-ids.o \
328 object.o pack-check.o pack-write.o patch-delta.o path.o pkt-line.o \
329 sideband.o reachable.o reflog-walk.o \
330 quote.o read-cache.o refs.o run-command.o dir.o \
331 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
332 tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
333 revision.o pager.o tree-walk.o xdiff-interface.o \
334 write_or_die.o trace.o list-objects.o grep.o match-trees.o \
335 alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
336 color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
337 convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \
338 transport.o bundle.o walker.o parse-options.o ws.o archive.o branch.o \
339 ll-merge.o alias.o fsck.o pack-revindex.o
341 BUILTIN_OBJS = \
342 builtin-add.o \
343 builtin-annotate.o \
344 builtin-apply.o \
345 builtin-archive.o \
346 builtin-blame.o \
347 builtin-branch.o \
348 builtin-bundle.o \
349 builtin-cat-file.o \
350 builtin-check-attr.o \
351 builtin-checkout.o \
352 builtin-checkout-index.o \
353 builtin-check-ref-format.o \
354 builtin-clean.o \
355 builtin-commit.o \
356 builtin-commit-tree.o \
357 builtin-count-objects.o \
358 builtin-describe.o \
359 builtin-diff.o \
360 builtin-diff-files.o \
361 builtin-diff-index.o \
362 builtin-diff-tree.o \
363 builtin-fast-export.o \
364 builtin-fetch.o \
365 builtin-fetch-pack.o \
366 builtin-fetch--tool.o \
367 builtin-fmt-merge-msg.o \
368 builtin-for-each-ref.o \
369 builtin-fsck.o \
370 builtin-gc.o \
371 builtin-grep.o \
372 builtin-init-db.o \
373 builtin-log.o \
374 builtin-ls-files.o \
375 builtin-ls-tree.o \
376 builtin-ls-remote.o \
377 builtin-mailinfo.o \
378 builtin-mailsplit.o \
379 builtin-merge-base.o \
380 builtin-merge-file.o \
381 builtin-merge-ours.o \
382 builtin-merge-recursive.o \
383 builtin-mv.o \
384 builtin-name-rev.o \
385 builtin-pack-objects.o \
386 builtin-prune.o \
387 builtin-prune-packed.o \
388 builtin-push.o \
389 builtin-read-tree.o \
390 builtin-reflog.o \
391 builtin-remote.o \
392 builtin-send-pack.o \
393 builtin-config.o \
394 builtin-rerere.o \
395 builtin-reset.o \
396 builtin-rev-list.o \
397 builtin-rev-parse.o \
398 builtin-revert.o \
399 builtin-rm.o \
400 builtin-shortlog.o \
401 builtin-show-branch.o \
402 builtin-stripspace.o \
403 builtin-symbolic-ref.o \
404 builtin-tag.o \
405 builtin-tar-tree.o \
406 builtin-unpack-objects.o \
407 builtin-update-index.o \
408 builtin-update-ref.o \
409 builtin-upload-archive.o \
410 builtin-verify-pack.o \
411 builtin-verify-tag.o \
412 builtin-write-tree.o \
413 builtin-show-ref.o \
414 builtin-pack-refs.o
416 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
417 EXTLIBS =
420 # Platform specific tweaks
423 # We choose to avoid "if .. else if .. else .. endif endif"
424 # because maintaining the nesting to match is a pain. If
425 # we had "elif" things would have been much nicer...
427 ifeq ($(uname_S),Linux)
428 NO_STRLCPY = YesPlease
429 endif
430 ifeq ($(uname_S),GNU/kFreeBSD)
431 NO_STRLCPY = YesPlease
432 endif
433 ifeq ($(uname_S),Darwin)
434 NEEDS_SSL_WITH_CRYPTO = YesPlease
435 NEEDS_LIBICONV = YesPlease
436 ifneq ($(shell expr "$(uname_R)" : '9\.'),2)
437 OLD_ICONV = UnfortunatelyYes
438 endif
439 NO_STRLCPY = YesPlease
440 NO_MEMMEM = YesPlease
441 endif
442 ifeq ($(uname_S),SunOS)
443 NEEDS_SOCKET = YesPlease
444 NEEDS_NSL = YesPlease
445 SHELL_PATH = /bin/bash
446 NO_STRCASESTR = YesPlease
447 NO_MEMMEM = YesPlease
448 NO_HSTRERROR = YesPlease
449 NO_MKDTEMP = YesPlease
450 ifeq ($(uname_R),5.8)
451 NEEDS_LIBICONV = YesPlease
452 NO_UNSETENV = YesPlease
453 NO_SETENV = YesPlease
454 NO_C99_FORMAT = YesPlease
455 NO_STRTOUMAX = YesPlease
456 endif
457 ifeq ($(uname_R),5.9)
458 NO_UNSETENV = YesPlease
459 NO_SETENV = YesPlease
460 NO_C99_FORMAT = YesPlease
461 NO_STRTOUMAX = YesPlease
462 endif
463 INSTALL = ginstall
464 TAR = gtar
465 BASIC_CFLAGS += -D__EXTENSIONS__
466 endif
467 ifeq ($(uname_O),Cygwin)
468 NO_D_TYPE_IN_DIRENT = YesPlease
469 NO_D_INO_IN_DIRENT = YesPlease
470 NO_STRCASESTR = YesPlease
471 NO_MEMMEM = YesPlease
472 NO_SYMLINK_HEAD = YesPlease
473 NEEDS_LIBICONV = YesPlease
474 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
475 NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
476 OLD_ICONV = UnfortunatelyYes
477 # There are conflicting reports about this.
478 # On some boxes NO_MMAP is needed, and not so elsewhere.
479 # Try commenting this out if you suspect MMAP is more efficient
480 NO_MMAP = YesPlease
481 NO_IPV6 = YesPlease
482 X = .exe
483 endif
484 ifeq ($(uname_S),FreeBSD)
485 NEEDS_LIBICONV = YesPlease
486 NO_MEMMEM = YesPlease
487 BASIC_CFLAGS += -I/usr/local/include
488 BASIC_LDFLAGS += -L/usr/local/lib
489 DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
490 endif
491 ifeq ($(uname_S),OpenBSD)
492 NO_STRCASESTR = YesPlease
493 NO_MEMMEM = YesPlease
494 NEEDS_LIBICONV = YesPlease
495 BASIC_CFLAGS += -I/usr/local/include
496 BASIC_LDFLAGS += -L/usr/local/lib
497 endif
498 ifeq ($(uname_S),NetBSD)
499 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
500 NEEDS_LIBICONV = YesPlease
501 endif
502 BASIC_CFLAGS += -I/usr/pkg/include
503 BASIC_LDFLAGS += -L/usr/pkg/lib
504 ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib
505 endif
506 ifeq ($(uname_S),AIX)
507 NO_STRCASESTR=YesPlease
508 NO_MEMMEM = YesPlease
509 NO_STRLCPY = YesPlease
510 NEEDS_LIBICONV=YesPlease
511 endif
512 ifeq ($(uname_S),GNU)
513 # GNU/Hurd
514 NO_STRLCPY=YesPlease
515 endif
516 ifeq ($(uname_S),IRIX64)
517 NO_IPV6=YesPlease
518 NO_SETENV=YesPlease
519 NO_STRCASESTR=YesPlease
520 NO_MEMMEM = YesPlease
521 NO_STRLCPY = YesPlease
522 NO_SOCKADDR_STORAGE=YesPlease
523 SHELL_PATH=/usr/gnu/bin/bash
524 BASIC_CFLAGS += -DPATH_MAX=1024
525 # for now, build 32-bit version
526 BASIC_LDFLAGS += -L/usr/lib32
527 endif
528 ifeq ($(uname_S),HP-UX)
529 NO_IPV6=YesPlease
530 NO_SETENV=YesPlease
531 NO_STRCASESTR=YesPlease
532 NO_MEMMEM = YesPlease
533 NO_STRLCPY = YesPlease
534 NO_MKDTEMP = YesPlease
535 NO_UNSETENV = YesPlease
536 NO_HSTRERROR = YesPlease
537 NO_SYS_SELECT_H = YesPlease
538 endif
539 ifneq (,$(findstring MINGW,$(uname_S)))
540 NO_MMAP = YesPlease
541 NO_PREAD = YesPlease
542 NO_OPENSSL = YesPlease
543 NO_CURL = YesPlease
544 NO_SYMLINK_HEAD = YesPlease
545 NO_IPV6 = YesPlease
546 NO_SETENV = YesPlease
547 NO_UNSETENV = YesPlease
548 NO_STRCASESTR = YesPlease
549 NO_STRLCPY = YesPlease
550 NO_MEMMEM = YesPlease
551 NEEDS_LIBICONV = YesPlease
552 OLD_ICONV = YesPlease
553 NO_C99_FORMAT = YesPlease
554 NO_STRTOUMAX = YesPlease
555 NO_MKDTEMP = YesPlease
556 SNPRINTF_RETURNS_BOGUS = YesPlease
557 NO_SVN_TESTS = YesPlease
558 NO_PERL_MAKEMAKER = YesPlease
559 NO_POSIX_ONLY_PROGRAMS = YesPlease
560 COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat
561 COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
562 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
563 COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o
564 EXTLIBS += -lws2_32
565 X = .exe
566 NOEXECTEMPL = .noexec
567 template_dir = ../share/git-core/templates/
568 ETC_GITCONFIG = ../etc/gitconfig
569 endif
570 ifneq (,$(findstring arm,$(uname_M)))
571 ARM_SHA1 = YesPlease
572 endif
574 -include config.mak.autogen
575 -include config.mak
577 ifeq ($(uname_S),Darwin)
578 ifndef NO_FINK
579 ifeq ($(shell test -d /sw/lib && echo y),y)
580 BASIC_CFLAGS += -I/sw/include
581 BASIC_LDFLAGS += -L/sw/lib
582 endif
583 endif
584 ifndef NO_DARWIN_PORTS
585 ifeq ($(shell test -d /opt/local/lib && echo y),y)
586 BASIC_CFLAGS += -I/opt/local/include
587 BASIC_LDFLAGS += -L/opt/local/lib
588 endif
589 endif
590 endif
592 ifdef NO_R_TO_GCC_LINKER
593 # Some gcc does not accept and pass -R to the linker to specify
594 # the runtime dynamic library path.
595 CC_LD_DYNPATH = -Wl,-rpath=
596 else
597 CC_LD_DYNPATH = -R
598 endif
600 ifdef NO_CURL
601 BASIC_CFLAGS += -DNO_CURL
602 else
603 ifdef CURLDIR
604 # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
605 BASIC_CFLAGS += -I$(CURLDIR)/include
606 CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
607 else
608 CURL_LIBCURL = -lcurl
609 endif
610 BUILTIN_OBJS += builtin-http-fetch.o
611 EXTLIBS += $(CURL_LIBCURL)
612 LIB_OBJS += http.o http-walker.o
613 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
614 ifeq "$(curl_check)" "070908"
615 ifndef NO_EXPAT
616 PROGRAMS += git-http-push$X
617 endif
618 endif
619 ifndef NO_EXPAT
620 EXPAT_LIBEXPAT = -lexpat
621 endif
622 endif
624 ifdef ZLIB_PATH
625 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
626 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
627 endif
628 EXTLIBS += -lz
630 ifndef NO_POSIX_ONLY_PROGRAMS
631 POSIX_ONLY_PROGRAMS = \
632 git-daemon$X \
633 git-imap-send$X
634 endif
635 ifndef NO_OPENSSL
636 OPENSSL_LIBSSL = -lssl
637 ifdef OPENSSLDIR
638 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
639 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
640 else
641 OPENSSL_LINK =
642 endif
643 else
644 BASIC_CFLAGS += -DNO_OPENSSL
645 MOZILLA_SHA1 = 1
646 OPENSSL_LIBSSL =
647 endif
648 ifdef NEEDS_SSL_WITH_CRYPTO
649 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
650 else
651 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
652 endif
653 ifdef NEEDS_LIBICONV
654 ifdef ICONVDIR
655 BASIC_CFLAGS += -I$(ICONVDIR)/include
656 ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
657 else
658 ICONV_LINK =
659 endif
660 EXTLIBS += $(ICONV_LINK) -liconv
661 endif
662 ifdef NEEDS_SOCKET
663 EXTLIBS += -lsocket
664 endif
665 ifdef NEEDS_NSL
666 EXTLIBS += -lnsl
667 endif
668 ifdef NO_D_TYPE_IN_DIRENT
669 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
670 endif
671 ifdef NO_D_INO_IN_DIRENT
672 BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
673 endif
674 ifdef NO_C99_FORMAT
675 BASIC_CFLAGS += -DNO_C99_FORMAT
676 endif
677 ifdef SNPRINTF_RETURNS_BOGUS
678 COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
679 COMPAT_OBJS += compat/snprintf.o
680 endif
681 ifdef FREAD_READS_DIRECTORIES
682 COMPAT_CFLAGS += -DFREAD_READS_DIRECTORIES
683 COMPAT_OBJS += compat/fopen.o
684 endif
685 ifdef NO_SYMLINK_HEAD
686 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
687 endif
688 ifdef NO_STRCASESTR
689 COMPAT_CFLAGS += -DNO_STRCASESTR
690 COMPAT_OBJS += compat/strcasestr.o
691 endif
692 ifdef NO_STRLCPY
693 COMPAT_CFLAGS += -DNO_STRLCPY
694 COMPAT_OBJS += compat/strlcpy.o
695 endif
696 ifdef NO_STRTOUMAX
697 COMPAT_CFLAGS += -DNO_STRTOUMAX
698 COMPAT_OBJS += compat/strtoumax.o
699 endif
700 ifdef NO_STRTOULL
701 COMPAT_CFLAGS += -DNO_STRTOULL
702 endif
703 ifdef NO_SETENV
704 COMPAT_CFLAGS += -DNO_SETENV
705 COMPAT_OBJS += compat/setenv.o
706 endif
707 ifdef NO_MKDTEMP
708 COMPAT_CFLAGS += -DNO_MKDTEMP
709 COMPAT_OBJS += compat/mkdtemp.o
710 endif
711 ifdef NO_UNSETENV
712 COMPAT_CFLAGS += -DNO_UNSETENV
713 COMPAT_OBJS += compat/unsetenv.o
714 endif
715 ifdef NO_SYS_SELECT_H
716 BASIC_CFLAGS += -DNO_SYS_SELECT_H
717 endif
718 ifdef NO_MMAP
719 COMPAT_CFLAGS += -DNO_MMAP
720 COMPAT_OBJS += compat/mmap.o
721 endif
722 ifdef NO_PREAD
723 COMPAT_CFLAGS += -DNO_PREAD
724 COMPAT_OBJS += compat/pread.o
725 endif
726 ifdef NO_FAST_WORKING_DIRECTORY
727 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
728 endif
729 ifdef NO_TRUSTABLE_FILEMODE
730 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
731 endif
732 ifdef NO_IPV6
733 BASIC_CFLAGS += -DNO_IPV6
734 endif
735 ifdef NO_SOCKADDR_STORAGE
736 ifdef NO_IPV6
737 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
738 else
739 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
740 endif
741 endif
742 ifdef NO_INET_NTOP
743 LIB_OBJS += compat/inet_ntop.o
744 endif
745 ifdef NO_INET_PTON
746 LIB_OBJS += compat/inet_pton.o
747 endif
749 ifdef NO_ICONV
750 BASIC_CFLAGS += -DNO_ICONV
751 endif
753 ifdef OLD_ICONV
754 BASIC_CFLAGS += -DOLD_ICONV
755 endif
757 ifdef NO_DEFLATE_BOUND
758 BASIC_CFLAGS += -DNO_DEFLATE_BOUND
759 endif
761 ifdef PPC_SHA1
762 SHA1_HEADER = "ppc/sha1.h"
763 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
764 else
765 ifdef ARM_SHA1
766 SHA1_HEADER = "arm/sha1.h"
767 LIB_OBJS += arm/sha1.o arm/sha1_arm.o
768 else
769 ifdef MOZILLA_SHA1
770 SHA1_HEADER = "mozilla-sha1/sha1.h"
771 LIB_OBJS += mozilla-sha1/sha1.o
772 else
773 SHA1_HEADER = <openssl/sha.h>
774 EXTLIBS += $(LIB_4_CRYPTO)
775 endif
776 endif
777 endif
778 ifdef NO_PERL_MAKEMAKER
779 export NO_PERL_MAKEMAKER
780 endif
781 ifdef NO_HSTRERROR
782 COMPAT_CFLAGS += -DNO_HSTRERROR
783 COMPAT_OBJS += compat/hstrerror.o
784 endif
785 ifdef NO_MEMMEM
786 COMPAT_CFLAGS += -DNO_MEMMEM
787 COMPAT_OBJS += compat/memmem.o
788 endif
789 ifdef INTERNAL_QSORT
790 COMPAT_CFLAGS += -DINTERNAL_QSORT
791 COMPAT_OBJS += compat/qsort.o
792 endif
794 ifdef THREADED_DELTA_SEARCH
795 BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
796 EXTLIBS += -lpthread
797 LIB_OBJS += thread-utils.o
798 endif
799 ifdef DIR_HAS_BSD_GROUP_SEMANTICS
800 COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
801 endif
802 ifdef NO_EXTERNAL_GREP
803 BASIC_CFLAGS += -DNO_EXTERNAL_GREP
804 endif
806 ifeq ($(TCLTK_PATH),)
807 NO_TCLTK=NoThanks
808 endif
810 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
811 QUIET_SUBDIR1 =
813 ifneq ($(findstring $(MAKEFLAGS),w),w)
814 PRINT_DIR = --no-print-directory
815 else # "make -w"
816 NO_SUBDIR = :
817 endif
819 ifneq ($(findstring $(MAKEFLAGS),s),s)
820 ifndef V
821 QUIET_CC = @echo ' ' CC $@;
822 QUIET_AR = @echo ' ' AR $@;
823 QUIET_LINK = @echo ' ' LINK $@;
824 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
825 QUIET_GEN = @echo ' ' GEN $@;
826 QUIET_SUBDIR0 = +@subdir=
827 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
828 $(MAKE) $(PRINT_DIR) -C $$subdir
829 export V
830 export QUIET_GEN
831 export QUIET_BUILT_IN
832 endif
833 endif
835 ifdef ASCIIDOC8
836 export ASCIIDOC8
837 endif
839 # Shell quote (do not use $(call) to accommodate ancient setups);
841 SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
842 ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
844 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
845 bindir_SQ = $(subst ','\'',$(bindir))
846 mandir_SQ = $(subst ','\'',$(mandir))
847 infodir_SQ = $(subst ','\'',$(infodir))
848 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
849 template_dir_SQ = $(subst ','\'',$(template_dir))
850 htmldir_SQ = $(subst ','\'',$(htmldir))
851 prefix_SQ = $(subst ','\'',$(prefix))
853 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
854 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
855 TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
857 LIBS = $(GITLIBS) $(EXTLIBS)
859 BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
860 $(COMPAT_CFLAGS)
861 LIB_OBJS += $(COMPAT_OBJS)
863 ALL_CFLAGS += $(BASIC_CFLAGS)
864 ALL_LDFLAGS += $(BASIC_LDFLAGS)
866 export TAR INSTALL DESTDIR SHELL_PATH
869 ### Build rules
871 all:: $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
872 ifneq (,$X)
873 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$p';)
874 endif
876 all::
877 ifndef NO_TCLTK
878 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all
879 $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all
880 endif
881 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
882 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) NOEXECTEMPL='$(NOEXECTEMPL)'
884 strip: $(PROGRAMS) git$X
885 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
887 git.o: git.c common-cmds.h GIT-CFLAGS
888 $(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
889 $(ALL_CFLAGS) -c $(filter %.c,$^)
891 git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
892 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
893 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
895 help.o: help.c common-cmds.h GIT-CFLAGS
896 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
897 '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
898 '-DGIT_MAN_PATH="$(mandir_SQ)"' \
899 '-DGIT_INFO_PATH="$(infodir_SQ)"' $<
901 $(BUILT_INS): git$X
902 $(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
904 common-cmds.h: ./generate-cmdlist.sh command-list.txt
906 common-cmds.h: $(wildcard Documentation/git-*.txt)
907 $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
909 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
910 $(QUIET_GEN)$(RM) $@ $@+ && \
911 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
912 -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
913 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
914 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
915 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
916 $@.sh >$@+ && \
917 chmod +x $@+ && \
918 mv $@+ $@
920 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
922 perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
923 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
925 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
926 $(QUIET_GEN)$(RM) $@ $@+ && \
927 INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
928 sed -e '1{' \
929 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
930 -e ' h' \
931 -e ' s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
932 -e ' H' \
933 -e ' x' \
934 -e '}' \
935 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
936 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
937 $@.perl >$@+ && \
938 chmod +x $@+ && \
939 mv $@+ $@
941 gitweb/gitweb.cgi: gitweb/gitweb.perl
942 $(QUIET_GEN)$(RM) $@ $@+ && \
943 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
944 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
945 -e 's|++GIT_BINDIR++|$(bindir)|g' \
946 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
947 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
948 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
949 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
950 -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
951 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
952 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
953 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
954 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
955 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
956 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
957 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
958 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
959 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
960 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
961 $< >$@+ && \
962 chmod +x $@+ && \
963 mv $@+ $@
965 git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
966 $(QUIET_GEN)$(RM) $@ $@+ && \
967 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
968 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
969 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
970 -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
971 -e '/@@GITWEB_CGI@@/d' \
972 -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
973 -e '/@@GITWEB_CSS@@/d' \
974 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
975 $@.sh > $@+ && \
976 chmod +x $@+ && \
977 mv $@+ $@
979 configure: configure.ac
980 $(QUIET_GEN)$(RM) $@ $<+ && \
981 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
982 $< > $<+ && \
983 autoconf -o $@ $<+ && \
984 $(RM) $<+
986 # These can record GIT_VERSION
987 git.o git.spec \
988 $(patsubst %.sh,%,$(SCRIPT_SH)) \
989 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
990 : GIT-VERSION-FILE
992 %.o: %.c GIT-CFLAGS
993 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
994 %.s: %.c GIT-CFLAGS
995 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
996 %.o: %.S
997 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
999 exec_cmd.o: exec_cmd.c GIT-CFLAGS
1000 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
1001 builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
1002 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
1004 config.o: config.c GIT-CFLAGS
1005 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $<
1007 http.o: http.c GIT-CFLAGS
1008 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
1010 ifdef NO_EXPAT
1011 http-walker.o: http-walker.c http.h GIT-CFLAGS
1012 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
1013 endif
1015 git-%$X: %.o $(GITLIBS)
1016 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1018 git-imap-send$X: imap-send.o $(LIB_FILE)
1020 http.o http-walker.o http-push.o transport.o: http.h
1022 git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
1023 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1024 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1026 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
1027 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
1028 builtin-revert.o wt-status.o: wt-status.h
1030 $(LIB_FILE): $(LIB_OBJS)
1031 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
1033 XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1034 xdiff/xmerge.o
1035 $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1036 xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
1038 $(XDIFF_LIB): $(XDIFF_OBJS)
1039 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
1042 doc:
1043 $(MAKE) -C Documentation all
1045 info:
1046 $(MAKE) -C Documentation info
1048 TAGS:
1049 $(RM) TAGS
1050 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
1052 tags:
1053 $(RM) tags
1054 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
1056 cscope:
1057 $(RM) cscope*
1058 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
1060 ### Detect prefix changes
1061 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
1062 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1064 GIT-CFLAGS: .FORCE-GIT-CFLAGS
1065 @FLAGS='$(TRACK_CFLAGS)'; \
1066 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1067 echo 1>&2 " * new build flags or prefix"; \
1068 echo "$$FLAGS" >GIT-CFLAGS; \
1071 GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
1072 @echo SHELL_PATH=\''$(SHELL_PATH_SQ)'\' >$@
1074 ### Detect Tck/Tk interpreter path changes
1075 ifndef NO_TCLTK
1076 TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1078 GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
1079 @VARS='$(TRACK_VARS)'; \
1080 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1081 echo 1>&2 " * new Tcl/Tk interpreter location"; \
1082 echo "$$VARS" >$@; \
1085 .PHONY: .FORCE-GIT-GUI-VARS
1086 endif
1088 ### Testing rules
1090 TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X test-parse-options$X
1092 all:: $(TEST_PROGRAMS)
1094 # GNU make supports exporting all variables by "export" without parameters.
1095 # However, the environment gets quite big, and some programs have problems
1096 # with that.
1098 export NO_SVN_TESTS
1100 test: all
1101 $(MAKE) -C t/ all
1103 test-date$X: date.o ctype.o
1105 test-delta$X: diff-delta.o patch-delta.o
1107 test-parse-options$X: parse-options.o
1109 .PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
1111 test-%$X: test-%.o $(GITLIBS)
1112 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1114 check-sha1:: test-sha1$X
1115 ./test-sha1.sh
1117 check: common-cmds.h
1118 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
1120 remove-dashes:
1121 ./fixup-builtins $(BUILT_INS)
1123 ### Installation rules
1125 ifeq ($(firstword $(subst /, ,$(template_dir))),..)
1126 template_instdir = $(gitexecdir)/$(template_dir)
1127 else
1128 template_instdir = $template_dir
1129 endif
1130 export template_instdir
1132 install: all
1133 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
1134 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
1135 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
1136 $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
1137 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
1138 $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
1139 ifndef NO_TCLTK
1140 $(MAKE) -C gitk-git install
1141 $(MAKE) -C git-gui install
1142 endif
1143 if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
1144 then \
1145 ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
1146 '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \
1147 cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
1148 '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
1150 $(foreach p,$(BUILT_INS), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
1151 ifneq (,$X)
1152 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
1153 endif
1155 install-doc:
1156 $(MAKE) -C Documentation install
1158 install-info:
1159 $(MAKE) -C Documentation install-info
1161 quick-install-doc:
1162 $(MAKE) -C Documentation quick-install
1166 ### Maintainer's dist rules
1168 git.spec: git.spec.in
1169 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
1170 mv $@+ $@
1172 GIT_TARNAME=git-$(GIT_VERSION)
1173 dist: git.spec git-archive$(X) configure
1174 ./git-archive --format=tar \
1175 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
1176 @mkdir -p $(GIT_TARNAME)
1177 @cp git.spec configure $(GIT_TARNAME)
1178 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
1179 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
1180 $(TAR) rf $(GIT_TARNAME).tar \
1181 $(GIT_TARNAME)/git.spec \
1182 $(GIT_TARNAME)/configure \
1183 $(GIT_TARNAME)/version \
1184 $(GIT_TARNAME)/git-gui/version
1185 @$(RM) -r $(GIT_TARNAME)
1186 gzip -f -9 $(GIT_TARNAME).tar
1188 rpm: dist
1189 $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
1191 htmldocs = git-htmldocs-$(GIT_VERSION)
1192 manpages = git-manpages-$(GIT_VERSION)
1193 dist-doc:
1194 $(RM) -r .doc-tmp-dir
1195 mkdir .doc-tmp-dir
1196 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
1197 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
1198 gzip -n -9 -f $(htmldocs).tar
1200 $(RM) -r .doc-tmp-dir
1201 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
1202 $(MAKE) -C Documentation DESTDIR=./ \
1203 man1dir=../.doc-tmp-dir/man1 \
1204 man5dir=../.doc-tmp-dir/man5 \
1205 man7dir=../.doc-tmp-dir/man7 \
1206 install
1207 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
1208 gzip -n -9 -f $(manpages).tar
1209 $(RM) -r .doc-tmp-dir
1211 ### Cleaning rules
1213 distclean: clean
1214 $(RM) configure
1216 clean:
1217 $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
1218 $(LIB_FILE) $(XDIFF_LIB)
1219 $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
1220 $(RM) $(TEST_PROGRAMS)
1221 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
1222 $(RM) -r autom4te.cache
1223 $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
1224 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
1225 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1226 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
1227 $(RM) gitweb/gitweb.cgi
1228 $(MAKE) -C Documentation/ clean
1229 $(MAKE) -C perl clean
1230 $(MAKE) -C templates/ clean
1231 $(MAKE) -C t/ clean
1232 ifndef NO_TCLTK
1233 $(MAKE) -C gitk-git clean
1234 $(MAKE) -C git-gui clean
1235 endif
1236 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
1238 .PHONY: all install clean strip
1239 .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS
1240 .PHONY: .FORCE-GIT-BUILD-OPTIONS
1242 ### Check documentation
1244 check-docs::
1245 @(for v in $(ALL_PROGRAMS) $(BUILT_INS) git gitk; \
1246 do \
1247 case "$$v" in \
1248 git-merge-octopus | git-merge-ours | git-merge-recursive | \
1249 git-merge-resolve | git-merge-stupid | git-merge-subtree | \
1250 git-fsck-objects | git-init-db | \
1251 git-?*--?* ) continue ;; \
1252 esac ; \
1253 test -f "Documentation/$$v.txt" || \
1254 echo "no doc: $$v"; \
1255 sed -e '/^#/d' command-list.txt | \
1256 grep -q "^$$v[ ]" || \
1257 case "$$v" in \
1258 git) ;; \
1259 *) echo "no link: $$v";; \
1260 esac ; \
1261 done; \
1263 sed -e '/^#/d' \
1264 -e 's/[ ].*//' \
1265 -e 's/^/listed /' command-list.txt; \
1266 ls -1 Documentation/git*txt | \
1267 sed -e 's|Documentation/|documented |' \
1268 -e 's/\.txt//'; \
1269 ) | while read how cmd; \
1270 do \
1271 case "$$how,$$cmd" in \
1272 *,git-citool | \
1273 *,git-gui | \
1274 *,git-help | \
1275 documented,gitattributes | \
1276 documented,gitignore | \
1277 documented,gitmodules | \
1278 documented,gitcli | \
1279 documented,git-tools | \
1280 sentinel,not,matching,is,ok ) continue ;; \
1281 esac; \
1282 case " $(ALL_PROGRAMS) $(BUILT_INS) git gitk " in \
1283 *" $$cmd "*) ;; \
1284 *) echo "removed but $$how: $$cmd" ;; \
1285 esac; \
1286 done ) | sort
1288 ### Make sure built-ins do not have dups and listed in git.c
1290 check-builtins::
1291 ./check-builtins.sh