Add zlib
[git/pclouds.git] / Makefile
blobf02b426506c163b2bec1a100ade9fa06b9e02568
1 # The default target of this Makefile is...
2 all:
4 # Define V=1 to have a more verbose compile.
6 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
7 # This also implies MOZILLA_SHA1.
9 # Define NO_CURL if you do not have curl installed. git-http-pull and
10 # git-http-push are not built, and you cannot use http:// and https://
11 # transports.
13 # Define CURLDIR=/foo/bar if your curl header and library files are in
14 # /foo/bar/include and /foo/bar/lib directories.
16 # Define NO_EXPAT if you do not have expat installed. git-http-push is
17 # not built, and you cannot push using http:// and https:// transports.
19 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
21 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
22 # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
24 # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
25 # do not support the 'size specifiers' introduced by C99, namely ll, hh,
26 # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
27 # some C compilers supported these specifiers prior to C99 as an extension.
29 # Define NO_STRCASESTR if you don't have strcasestr.
31 # Define NO_STRLCPY if you don't have strlcpy.
33 # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
34 # If your compiler also does not support long long or does not have
35 # strtoull, define NO_STRTOULL.
37 # Define NO_SETENV if you don't have setenv in the C library.
39 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
40 # Enable it on Windows. By default, symrefs are still used.
42 # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
43 # tests. These tests take up a significant amount of the total test time
44 # but are not needed unless you plan to talk to SVN repos.
46 # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
47 # installed in /sw, but don't want GIT to link against any libraries
48 # installed there. If defined you may specify your own (or Fink's)
49 # include directories and library directories by defining CFLAGS
50 # and LDFLAGS appropriately.
52 # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
53 # have DarwinPorts installed in /opt/local, but don't want GIT to
54 # link against any libraries installed there. If defined you may
55 # specify your own (or DarwinPort's) include directories and
56 # library directories by defining CFLAGS and LDFLAGS appropriately.
58 # Define PPC_SHA1 environment variable when running make to make use of
59 # a bundled SHA1 routine optimized for PowerPC.
61 # Define ARM_SHA1 environment variable when running make to make use of
62 # a bundled SHA1 routine optimized for ARM.
64 # Define MOZILLA_SHA1 environment variable when running make to make use of
65 # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
66 # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
67 # choice) has very fast version optimized for i586.
69 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
71 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
73 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
74 # Patrick Mauritz).
76 # Define NO_MMAP if you want to avoid mmap.
78 # Define NO_PREAD if you have a problem with pread() system call (e.g.
79 # cygwin.dll before v1.5.22).
81 # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
82 # generally faster on your platform than accessing the working directory.
84 # Define NO_TRUSTABLE_FILEMODE if your filesystem may claim to support
85 # the executable mode bit, but doesn't really do so.
87 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
89 # Define NO_SOCKADDR_STORAGE if your platform does not have struct
90 # sockaddr_storage.
92 # Define NO_ICONV if your libc does not properly support iconv.
94 # Define OLD_ICONV if your library has an old iconv(), where the second
95 # (input buffer pointer) parameter is declared with type (const char **).
97 # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
98 # that tells runtime paths to dynamic libraries;
99 # "-Wl,-rpath=/path/lib" is used instead.
101 # Define USE_NSEC below if you want git to care about sub-second file mtimes
102 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
103 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
104 # randomly break unless your underlying filesystem supports those sub-second
105 # times (my ext3 doesn't).
107 # Define USE_STDEV below if you want git to care about the underlying device
108 # change being considered an inode change from the update-cache perspective.
110 # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
112 # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
113 # MakeMaker (e.g. using ActiveState under Cygwin).
115 # Define NO_TCLTK if you do not want Tcl/Tk GUI.
117 # The TCL_PATH variable governs the location of the Tcl interpreter
118 # used to optimize git-gui for your system. Only used if NO_TCLTK
119 # is not set. Defaults to the bare 'tclsh'.
121 # The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
122 # If not set it defaults to the bare 'wish'. If it is set to the empty
123 # string then NO_TCLTK will be forced (this is used by configure script).
126 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
127 @$(SHELL_PATH) ./GIT-VERSION-GEN
128 -include GIT-VERSION-FILE
130 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
131 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
132 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
133 uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
134 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
136 ifneq (,$(findstring MINGW,$(uname_S)))
137 MINGW=YesPlease
138 endif
139 # CFLAGS and LDFLAGS are for the users to override from the command line.
141 CFLAGS = -g -O2 -Wall
142 LDFLAGS =
143 ALL_CFLAGS = $(CFLAGS)
144 ALL_LDFLAGS = $(LDFLAGS)
145 STRIP ?= strip
147 prefix = $(HOME)
148 bindir = $(prefix)/bin
149 gitexecdir = $(bindir)
150 sharedir = $(prefix)/share
151 template_dir = $(sharedir)/git-core/templates
152 ifeq ($(prefix),/usr)
153 sysconfdir = /etc
154 else
155 sysconfdir = $(prefix)/etc
156 endif
157 ETC_GITCONFIG = $(sysconfdir)/gitconfig
158 # DESTDIR=
160 # default configuration for gitweb
161 GITWEB_CONFIG = gitweb_config.perl
162 GITWEB_HOME_LINK_STR = projects
163 GITWEB_SITENAME =
164 GITWEB_PROJECTROOT = /pub/git
165 GITWEB_EXPORT_OK =
166 GITWEB_STRICT_EXPORT =
167 GITWEB_BASE_URL =
168 GITWEB_LIST =
169 GITWEB_HOMETEXT = indextext.html
170 GITWEB_CSS = gitweb.css
171 GITWEB_LOGO = git-logo.png
172 GITWEB_FAVICON = git-favicon.png
173 GITWEB_SITE_HEADER =
174 GITWEB_SITE_FOOTER =
176 export prefix bindir gitexecdir sharedir template_dir sysconfdir
178 CC = gcc
179 AR = ar
180 RM = rm -f
181 TAR = tar
182 INSTALL = install
183 RPMBUILD = rpmbuild
184 TCL_PATH = tclsh
185 TCLTK_PATH = wish
187 export TCL_PATH TCLTK_PATH
189 # sparse is architecture-neutral, which means that we need to tell it
190 # explicitly what architecture to check for. Fix this up for yours..
191 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
195 ### --- END CONFIGURATION SECTION ---
197 # Those must not be GNU-specific; they are shared with perl/ which may
198 # be built by a different compiler. (Note that this is an artifact now
199 # but it still might be nice to keep that distinction.)
200 BASIC_CFLAGS =
201 BASIC_LDFLAGS =
203 SCRIPT_SH = \
204 git-bisect.sh git-checkout.sh \
205 git-clean.sh git-clone.sh git-commit.sh \
206 git-fetch.sh \
207 git-ls-remote.sh \
208 git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
209 git-pull.sh git-rebase.sh git-rebase--interactive.sh \
210 git-repack.sh git-request-pull.sh git-reset.sh \
211 git-sh-setup.sh \
212 git-tag.sh git-verify-tag.sh \
213 git-am.sh \
214 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
215 git-merge-resolve.sh git-merge-ours.sh \
216 git-lost-found.sh git-quiltimport.sh git-submodule.sh \
217 git-filter-branch.sh \
218 git-stash.sh
220 SCRIPT_PERL = \
221 git-add--interactive.perl \
222 git-archimport.perl git-cvsimport.perl git-relink.perl \
223 git-cvsserver.perl git-remote.perl \
224 git-svnimport.perl git-cvsexportcommit.perl \
225 git-send-email.perl git-svn.perl
227 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
228 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
229 git-status git-instaweb
231 # ... and all the rest that could be moved out of bindir to gitexecdir
232 PROGRAMS = git-ssh-fetch$X git-local-fetch$X git-ssh-upload$X \
233 git-upload-pack$X \
234 $(EXTRA_PROGRAMS)
236 # Empty...
237 EXTRA_PROGRAMS =
239 BUILT_INS = \
240 git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
241 git-get-tar-commit-id$X git-init$X git-repo-config$X \
242 git-fsck-objects$X git-cherry-pick$X \
243 $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
245 # what 'all' will build and 'install' will install, in gitexecdir
246 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
248 # what 'all' will build but not install in gitexecdir
249 OTHER_PROGRAMS = git$X gitweb/gitweb.cgi
250 ifndef NO_TCLTK
251 OTHER_PROGRAMS += gitk-wish
252 endif
254 # Backward compatibility -- to be removed after 1.0
255 PROGRAMS += git-ssh-pull$X git-ssh-push$X
257 # Set paths to tools early so that they can be used for version tests.
258 ifndef SHELL_PATH
259 SHELL_PATH = /bin/sh
260 endif
261 ifndef PERL_PATH
262 PERL_PATH = /usr/bin/perl
263 endif
265 export PERL_PATH
267 LIB_FILE=libgit.a
268 XDIFF_LIB=xdiff/lib.a
270 LIB_H = \
271 archive.h blob.h cache.h commit.h csum-file.h delta.h grep.h \
272 diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
273 run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
274 tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
275 spawn-pipe.h \
276 utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \
277 remote.h
279 DIFF_OBJS = \
280 diff.o diff-lib.o diffcore-break.o diffcore-order.o \
281 diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \
282 diffcore-delta.o log-tree.o
284 LIB_OBJS = \
285 blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \
286 date.o diff-delta.o entry.o exec_cmd.o ident.o \
287 interpolate.o \
288 lockfile.o \
289 spawn-pipe.o \
290 patch-ids.o \
291 object.o pack-check.o pack-write.o patch-delta.o path.o pkt-line.o \
292 sideband.o reachable.o reflog-walk.o \
293 quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \
294 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
295 tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
296 revision.o pager.o tree-walk.o xdiff-interface.o \
297 write_or_die.o trace.o list-objects.o grep.o match-trees.o \
298 alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
299 color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
300 convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o
302 BOX_FILE = box/libbox.a
304 BOX_H = \
305 applets.h autoconf.h busybox.h dump.h grp_.h \
306 libbb.h platform.h pwd_.h shadow_.h \
307 usage.h xatonum.h xregex.h
309 BOX_OBJS = \
310 applets/applets.o \
311 archival/bbunzip.o \
312 archival/gzip.o \
313 archival/libunarchive/check_header_gzip.o \
314 archival/libunarchive/data_align.o \
315 archival/libunarchive/data_extract_all.o \
316 archival/libunarchive/data_extract_to_stdout.o \
317 archival/libunarchive/data_skip.o \
318 archival/libunarchive/decompress_bunzip2.o \
319 archival/libunarchive/decompress_unzip.o \
320 archival/libunarchive/filter_accept_all.o \
321 archival/libunarchive/filter_accept_reject_list.o \
322 archival/libunarchive/find_list_entry.o \
323 archival/libunarchive/get_header_tar.o \
324 archival/libunarchive/header_list.o \
325 archival/libunarchive/header_skip.o \
326 archival/libunarchive/init_handle.o \
327 archival/libunarchive/seek_by_jump.o \
328 archival/libunarchive/seek_by_read.o \
329 archival/tar.o \
330 archival/unzip.o \
331 coreutils/basename.o \
332 coreutils/cat.o \
333 coreutils/chmod.o \
334 coreutils/cp.o \
335 coreutils/cmp.o \
336 coreutils/cut.o \
337 coreutils/date.o \
338 coreutils/diff.o \
339 coreutils/dirname.o \
340 coreutils/echo.o \
341 coreutils/env.o \
342 coreutils/expr.o \
343 coreutils/false.o \
344 coreutils/head.o \
345 coreutils/libcoreutils/cp_mv_stat.o \
346 coreutils/ls.o \
347 coreutils/md5_sha1_sum.o \
348 coreutils/mkdir.o \
349 coreutils/mv.o \
350 coreutils/od.o \
351 coreutils/printenv.o \
352 coreutils/printf.o \
353 coreutils/pwd.o \
354 coreutils/realpath.o \
355 coreutils/rmdir.o \
356 coreutils/rm.o \
357 coreutils/seq.o \
358 coreutils/sleep.o \
359 coreutils/sort.o \
360 coreutils/sum.o \
361 coreutils/tail.o \
362 coreutils/test.o \
363 coreutils/touch.o \
364 coreutils/tr.o \
365 coreutils/true.o \
366 coreutils/uniq.o \
367 coreutils/wc.o \
368 coreutils/yes.o \
369 debianutils/which.o \
370 editors/awk.o \
371 editors/patch.o \
372 editors/sed.o \
373 findutils/find.o \
374 findutils/grep.o \
375 libbb/ask_confirmation.o \
376 libbb/bb_do_delay.o \
377 libbb/bb_strtonum.o \
378 libbb/chomp.o \
379 libbb/compare_string_array.o \
380 libbb/concat_path_file.o \
381 libbb/concat_subpath_file.o \
382 libbb/copyfd.o \
383 libbb/copy_file.o \
384 libbb/crc32.o \
385 libbb/default_error_retval.o \
386 libbb/dump.o \
387 libbb/error_msg_and_die.o \
388 libbb/error_msg.o \
389 libbb/execable.o \
390 libbb/fclose_nonstdin.o \
391 libbb/fflush_stdout_and_exit.o \
392 libbb/fgets_str.o \
393 libbb/full_write.o \
394 libbb/get_last_path_component.o \
395 libbb/get_line_from_file.o \
396 libbb/getopt32.o \
397 libbb/herror_msg_and_die.o \
398 libbb/herror_msg.o \
399 libbb/info_msg.o \
400 libbb/isdirectory.o \
401 libbb/last_char_is.o \
402 libbb/llist.o \
403 libbb/make_directory.o \
404 libbb/md5.o \
405 libbb/messages.o \
406 libbb/parse_mode.o \
407 libbb/perror_msg_and_die.o \
408 libbb/perror_msg.o \
409 libbb/perror_nomsg_and_die.o \
410 libbb/perror_nomsg.o \
411 libbb/process_escape_sequence.o \
412 libbb/read.o \
413 libbb/recursive_action.o \
414 libbb/remove_file.o \
415 libbb/safe_strncpy.o \
416 libbb/safe_write.o \
417 libbb/simplify_path.o \
418 libbb/skip_whitespace.o \
419 libbb/trim.o \
420 libbb/u_signal_names.o \
421 libbb/vdprintf.o \
422 libbb/verror_msg.o \
423 libbb/vperror_msg.o \
424 libbb/warn_ignoring_args.o \
425 libbb/wfopen_input.o \
426 libbb/wfopen.o \
427 libbb/xatonum.o \
428 libbb/xfuncs.o \
429 libbb/xgetcwd.o \
430 libbb/xreadlink.o \
431 libbb/xregcomp.o \
432 shell/ash.o \
434 BOX_CFLAGS = -Ibox/include -Ibox/libbb -I. -DBB_VER=\"$(GIT_VERSION)\"
436 BOX_H := $(patsubst %.h,box/include/%.h,$(BOX_H))
437 BOX_OBJS := $(patsubst %.o,box/%.o,$(BOX_OBJS))
439 BUILTIN_OBJS = \
440 builtin-add.o \
441 builtin-annotate.o \
442 builtin-apply.o \
443 builtin-archive.o \
444 builtin-blame.o \
445 builtin-branch.o \
446 builtin-bundle.o \
447 builtin-cat-file.o \
448 builtin-check-attr.o \
449 builtin-checkout-index.o \
450 builtin-check-ref-format.o \
451 builtin-commit-tree.o \
452 builtin-count-objects.o \
453 builtin-describe.o \
454 builtin-diff.o \
455 builtin-diff-files.o \
456 builtin-diff-index.o \
457 builtin-diff-tree.o \
458 builtin-fetch--tool.o \
459 builtin-fmt-merge-msg.o \
460 builtin-for-each-ref.o \
461 builtin-fsck.o \
462 builtin-gc.o \
463 builtin-grep.o \
464 builtin-init-db.o \
465 builtin-log.o \
466 builtin-ls-files.o \
467 builtin-ls-tree.o \
468 builtin-mailinfo.o \
469 builtin-mailsplit.o \
470 builtin-merge-base.o \
471 builtin-merge-file.o \
472 builtin-mv.o \
473 builtin-name-rev.o \
474 builtin-pack-objects.o \
475 builtin-prune.o \
476 builtin-prune-packed.o \
477 builtin-push.o \
478 builtin-read-tree.o \
479 builtin-reflog.o \
480 builtin-config.o \
481 builtin-rerere.o \
482 builtin-rev-list.o \
483 builtin-rev-parse.o \
484 builtin-revert.o \
485 builtin-rm.o \
486 builtin-runstatus.o \
487 builtin-shortlog.o \
488 builtin-show-branch.o \
489 builtin-stripspace.o \
490 builtin-symbolic-ref.o \
491 builtin-tar-tree.o \
492 builtin-unpack-objects.o \
493 builtin-update-index.o \
494 builtin-update-ref.o \
495 builtin-upload-archive.o \
496 builtin-verify-pack.o \
497 builtin-write-tree.o \
498 builtin-show-ref.o \
499 builtin-pack-refs.o \
500 builtin-update-server-info.o \
501 builtin-merge-recursive.o \
502 builtin-merge-tree.o \
503 builtin-fetch-pack.o \
504 builtin-hash-object.o builtin-index-pack.o \
505 builtin-fast-import.o \
506 builtin-merge-index.o builtin-mktag.o builtin-mktree.o builtin-patch-id.o \
507 builtin-peek-remote.o builtin-receive-pack.o \
508 builtin-send-pack.o builtin-shell.o \
509 builtin-show-index.o \
510 builtin-unpack-file.o \
511 builtin-pack-redundant.o builtin-var.o \
513 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
514 ifdef MINGW
515 ifndef NO_GITBOX
516 GITLIBS += $(BOX_FILE)
517 BUILTIN_OBJS += builtin-box.o
518 endif
519 endif
520 ifdef GITBOX
521 GITLIBS += $(BOX_FILE)
522 BUILTIN_OBJS += builtin-box.o
523 endif
524 EXTLIBS = -lz
527 # Platform specific tweaks
530 # We choose to avoid "if .. else if .. else .. endif endif"
531 # because maintaining the nesting to match is a pain. If
532 # we had "elif" things would have been much nicer...
534 ifeq ($(uname_S),Linux)
535 NO_STRLCPY = YesPlease
536 endif
537 ifeq ($(uname_S),GNU/kFreeBSD)
538 NO_STRLCPY = YesPlease
539 endif
540 ifeq ($(uname_S),Darwin)
541 NEEDS_SSL_WITH_CRYPTO = YesPlease
542 NEEDS_LIBICONV = YesPlease
543 OLD_ICONV = UnfortunatelyYes
544 NO_STRLCPY = YesPlease
545 endif
546 ifeq ($(uname_S),SunOS)
547 NEEDS_SOCKET = YesPlease
548 NEEDS_NSL = YesPlease
549 SHELL_PATH = /bin/bash
550 NO_STRCASESTR = YesPlease
551 NO_HSTRERROR = YesPlease
552 ifeq ($(uname_R),5.8)
553 NEEDS_LIBICONV = YesPlease
554 NO_UNSETENV = YesPlease
555 NO_SETENV = YesPlease
556 NO_C99_FORMAT = YesPlease
557 NO_STRTOUMAX = YesPlease
558 endif
559 ifeq ($(uname_R),5.9)
560 NO_UNSETENV = YesPlease
561 NO_SETENV = YesPlease
562 NO_C99_FORMAT = YesPlease
563 NO_STRTOUMAX = YesPlease
564 endif
565 INSTALL = ginstall
566 TAR = gtar
567 BASIC_CFLAGS += -D__EXTENSIONS__
568 endif
569 ifeq ($(uname_O),Cygwin)
570 NO_D_TYPE_IN_DIRENT = YesPlease
571 NO_D_INO_IN_DIRENT = YesPlease
572 NO_STRCASESTR = YesPlease
573 NO_SYMLINK_HEAD = YesPlease
574 NEEDS_LIBICONV = YesPlease
575 NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
576 NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
577 # There are conflicting reports about this.
578 # On some boxes NO_MMAP is needed, and not so elsewhere.
579 # Try commenting this out if you suspect MMAP is more efficient
580 NO_MMAP = YesPlease
581 NO_IPV6 = YesPlease
582 X = .exe
583 endif
584 ifeq ($(uname_S),FreeBSD)
585 NEEDS_LIBICONV = YesPlease
586 BASIC_CFLAGS += -I/usr/local/include
587 BASIC_LDFLAGS += -L/usr/local/lib
588 endif
589 ifeq ($(uname_S),OpenBSD)
590 NO_STRCASESTR = YesPlease
591 NEEDS_LIBICONV = YesPlease
592 BASIC_CFLAGS += -I/usr/local/include
593 BASIC_LDFLAGS += -L/usr/local/lib
594 endif
595 ifeq ($(uname_S),NetBSD)
596 ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
597 NEEDS_LIBICONV = YesPlease
598 endif
599 BASIC_CFLAGS += -I/usr/pkg/include
600 BASIC_LDFLAGS += -L/usr/pkg/lib
601 ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib
602 endif
603 ifeq ($(uname_S),AIX)
604 NO_STRCASESTR=YesPlease
605 NO_STRLCPY = YesPlease
606 NEEDS_LIBICONV=YesPlease
607 endif
608 ifeq ($(uname_S),IRIX64)
609 NO_IPV6=YesPlease
610 NO_SETENV=YesPlease
611 NO_STRCASESTR=YesPlease
612 NO_STRLCPY = YesPlease
613 NO_SOCKADDR_STORAGE=YesPlease
614 SHELL_PATH=/usr/gnu/bin/bash
615 BASIC_CFLAGS += -DPATH_MAX=1024
616 # for now, build 32-bit version
617 BASIC_LDFLAGS += -L/usr/lib32
618 endif
619 ifdef MINGW
620 ifneq (,$(findstring MINGW,$(uname_S)))
621 SHELL_PATH = $(shell cd /bin && pwd -W)/sh
622 PERL_PATH = $(shell cd /bin && pwd -W)/perl
623 endif
624 NO_MMAP=YesPlease
625 NO_PREAD=YesPlease
626 NO_OPENSSL=YesPlease
627 NO_CURL=YesPlease
628 NO_SYMLINK_HEAD=YesPlease
629 NO_IPV6=YesPlease
630 NO_ETC_PASSWD=YesPlease
631 NO_SETENV=YesPlease
632 NO_UNSETENV=YesPlease
633 NO_STRCASESTR=YesPlease
634 NO_STRLCPY=YesPlease
635 NO_ICONV=YesPlease
636 NO_C99_FORMAT = YesPlease
637 NO_STRTOUMAX = YesPlease
638 NO_SYMLINKS=YesPlease
639 NO_SVN_TESTS=YesPlease
640 ifneq (,$(findstring MINGW,$(uname_S)))
641 NO_PERL_MAKEMAKER=YesPlease
642 endif
643 COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat
644 COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o
645 EXTLIBS += -lws2_32
646 X = .exe
647 NOEXECTEMPL = .noexec
648 template_dir = ../share/git-core/templates/
649 ETC_GITCONFIG = ../etc/gitconfig
650 SCRIPT_SH += cpio.sh
651 endif
652 ifneq (,$(findstring arm,$(uname_M)))
653 ARM_SHA1 = YesPlease
654 endif
656 -include config.mak.autogen
657 -include config.mak
659 ifeq ($(uname_S),Darwin)
660 ifndef NO_FINK
661 ifeq ($(shell test -d /sw/lib && echo y),y)
662 BASIC_CFLAGS += -I/sw/include
663 BASIC_LDFLAGS += -L/sw/lib
664 endif
665 endif
666 ifndef NO_DARWIN_PORTS
667 ifeq ($(shell test -d /opt/local/lib && echo y),y)
668 BASIC_CFLAGS += -I/opt/local/include
669 BASIC_LDFLAGS += -L/opt/local/lib
670 endif
671 endif
672 endif
674 ifdef NO_R_TO_GCC_LINKER
675 # Some gcc does not accept and pass -R to the linker to specify
676 # the runtime dynamic library path.
677 CC_LD_DYNPATH = -Wl,-rpath=
678 else
679 CC_LD_DYNPATH = -R
680 endif
682 ifndef NO_CURL
683 ifdef CURLDIR
684 # Try "-Wl,-rpath=$(CURLDIR)/lib" in such a case.
685 BASIC_CFLAGS += -I$(CURLDIR)/include
686 CURL_LIBCURL = -L$(CURLDIR)/lib $(CC_LD_DYNPATH)$(CURLDIR)/lib -lcurl
687 else
688 CURL_LIBCURL = -lcurl
689 endif
690 PROGRAMS += git-http-fetch$X
691 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
692 ifeq "$(curl_check)" "070908"
693 ifndef NO_EXPAT
694 PROGRAMS += git-http-push$X
695 endif
696 endif
697 ifndef NO_EXPAT
698 EXPAT_LIBEXPAT = -lexpat
699 endif
700 endif
702 ifndef NO_OPENSSL
703 OPENSSL_LIBSSL = -lssl
704 ifdef OPENSSLDIR
705 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
706 OPENSSL_LINK = -L$(OPENSSLDIR)/lib $(CC_LD_DYNPATH)$(OPENSSLDIR)/lib
707 else
708 OPENSSL_LINK =
709 endif
710 else
711 BASIC_CFLAGS += -DNO_OPENSSL
712 MOZILLA_SHA1 = 1
713 OPENSSL_LIBSSL =
714 endif
715 ifdef NEEDS_SSL_WITH_CRYPTO
716 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
717 else
718 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
719 endif
720 ifdef NEEDS_LIBICONV
721 ifdef ICONVDIR
722 BASIC_CFLAGS += -I$(ICONVDIR)/include
723 ICONV_LINK = -L$(ICONVDIR)/lib $(CC_LD_DYNPATH)$(ICONVDIR)/lib
724 else
725 ICONV_LINK =
726 endif
727 EXTLIBS += $(ICONV_LINK) -liconv
728 endif
729 ifdef NEEDS_SOCKET
730 ifndef MINGW
731 EXTLIBS += -lsocket
732 endif
733 endif
734 ifdef NEEDS_NSL
735 EXTLIBS += -lnsl
736 endif
737 ifdef NO_D_TYPE_IN_DIRENT
738 BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
739 endif
740 ifdef NO_D_INO_IN_DIRENT
741 BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
742 endif
743 ifdef NO_C99_FORMAT
744 BASIC_CFLAGS += -DNO_C99_FORMAT
745 endif
746 ifdef NO_SYMLINK_HEAD
747 BASIC_CFLAGS += -DNO_SYMLINK_HEAD
748 endif
749 ifdef NO_STRCASESTR
750 COMPAT_CFLAGS += -DNO_STRCASESTR
751 COMPAT_OBJS += compat/strcasestr.o
752 endif
753 ifdef NO_STRLCPY
754 COMPAT_CFLAGS += -DNO_STRLCPY
755 COMPAT_OBJS += compat/strlcpy.o
756 endif
757 ifdef NO_STRTOUMAX
758 COMPAT_CFLAGS += -DNO_STRTOUMAX
759 COMPAT_OBJS += compat/strtoumax.o
760 endif
761 ifdef NO_STRTOULL
762 COMPAT_CFLAGS += -DNO_STRTOULL
763 endif
764 ifdef NO_SETENV
765 COMPAT_CFLAGS += -DNO_SETENV
766 COMPAT_OBJS += compat/setenv.o
767 endif
768 ifdef NO_UNSETENV
769 COMPAT_CFLAGS += -DNO_UNSETENV
770 COMPAT_OBJS += compat/unsetenv.o
771 endif
772 ifdef NO_MMAP
773 COMPAT_CFLAGS += -DNO_MMAP
774 COMPAT_OBJS += compat/mmap.o
775 endif
776 ifdef NO_PREAD
777 COMPAT_CFLAGS += -DNO_PREAD
778 COMPAT_OBJS += compat/pread.o
779 endif
780 ifdef NO_FAST_WORKING_DIRECTORY
781 BASIC_CFLAGS += -DNO_FAST_WORKING_DIRECTORY
782 endif
783 ifdef NO_TRUSTABLE_FILEMODE
784 BASIC_CFLAGS += -DNO_TRUSTABLE_FILEMODE
785 endif
786 ifdef NO_IPV6
787 BASIC_CFLAGS += -DNO_IPV6
788 endif
789 ifdef NO_SOCKADDR_STORAGE
790 ifdef NO_IPV6
791 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in
792 else
793 BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6
794 endif
795 endif
796 ifdef NO_INET_NTOP
797 LIB_OBJS += compat/inet_ntop.o
798 endif
799 ifdef NO_INET_PTON
800 LIB_OBJS += compat/inet_pton.o
801 endif
803 ifdef NO_ICONV
804 BASIC_CFLAGS += -DNO_ICONV
805 endif
807 ifdef OLD_ICONV
808 BASIC_CFLAGS += -DOLD_ICONV
809 endif
811 ifdef PPC_SHA1
812 SHA1_HEADER = "ppc/sha1.h"
813 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
814 else
815 ifdef ARM_SHA1
816 SHA1_HEADER = "arm/sha1.h"
817 LIB_OBJS += arm/sha1.o arm/sha1_arm.o
818 else
819 ifdef MOZILLA_SHA1
820 SHA1_HEADER = "mozilla-sha1/sha1.h"
821 LIB_OBJS += mozilla-sha1/sha1.o
822 else
823 SHA1_HEADER = <openssl/sha.h>
824 EXTLIBS += $(LIB_4_CRYPTO)
825 endif
826 endif
827 endif
828 ifdef NO_PERL_MAKEMAKER
829 export NO_PERL_MAKEMAKER
830 endif
831 ifdef NO_HSTRERROR
832 COMPAT_CFLAGS += -DNO_HSTRERROR
833 COMPAT_OBJS += compat/hstrerror.o
834 endif
836 ifeq ($(TCLTK_PATH),)
837 NO_TCLTK=NoThanks
838 endif
840 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
841 QUIET_SUBDIR1 =
843 ifneq ($(findstring $(MAKEFLAGS),w),w)
844 PRINT_DIR = --no-print-directory
845 else # "make -w"
846 NO_SUBDIR = :
847 endif
849 ifneq ($(findstring $(MAKEFLAGS),s),s)
850 ifndef V
851 QUIET_CC = @echo ' ' CC $@;
852 QUIET_AR = @echo ' ' AR $@;
853 QUIET_LINK = @echo ' ' LINK $@;
854 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
855 QUIET_GEN = @echo ' ' GEN $@;
856 QUIET_SUBDIR0 = +@subdir=
857 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
858 $(MAKE) $(PRINT_DIR) -C $$subdir
859 export V
860 export QUIET_GEN
861 export QUIET_BUILT_IN
862 endif
863 endif
865 ifdef ASCIIDOC8
866 export ASCIIDOC8
867 endif
869 # Shell quote (do not use $(call) to accommodate ancient setups);
871 SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
872 ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
874 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
875 bindir_SQ = $(subst ','\'',$(bindir))
876 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
877 template_dir_SQ = $(subst ','\'',$(template_dir))
878 prefix_SQ = $(subst ','\'',$(prefix))
880 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
881 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
882 TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
884 LIBS = $(GITLIBS) $(EXTLIBS)
886 BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
887 $(COMPAT_CFLAGS)
888 LIB_OBJS += $(COMPAT_OBJS)
890 ALL_CFLAGS += $(BASIC_CFLAGS)
891 ALL_LDFLAGS += $(BASIC_LDFLAGS)
893 ifdef MINGW
894 ifdef NO_GITBOX
895 ALL_CFLAGS += -DNO_GITBOX
896 else
897 ALL_CFLAGS += $(BOX_CFLAGS)
898 ALL_LDFLAGS += $(BOX_LDFLAGS)
899 endif
900 endif
902 ifdef GITBOX
903 ALL_CFLAGS += $(BOX_CFLAGS) -std=gnu99 -D_GNU_SOURCE -DGITBOX
904 ALL_LDFLAGS += $(BOX_LDFLAGS) -lm
905 endif
906 export TAR INSTALL DESTDIR SHELL_PATH
909 ### Build rules
911 all: $(ALL_PROGRAMS) $(OTHER_PROGRAMS)
913 all:
914 ifndef NO_TCLTK
915 $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all
916 endif
917 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
918 $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) NOEXECTEMPL='$(NOEXECTEMPL)'
920 strip: $(PROGRAMS) git$X
921 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
923 gitk-wish: gitk GIT-GUI-VARS
924 $(QUIET_GEN)$(RM) $@ $@+ && \
925 sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
926 chmod +x $@+ && \
927 mv -f $@+ $@
929 git.o: git.c common-cmds.h GIT-CFLAGS
930 $(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
931 $(ALL_CFLAGS) -c $(filter %.c,$^)
933 git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
934 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
935 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
937 help.o: common-cmds.h
939 git-merge-subtree$X: git-merge-recursive$X
940 $(QUIET_BUILT_IN)$(RM) $@ && ln git-merge-recursive$X $@
942 $(BUILT_INS): git$X
943 $(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
945 common-cmds.h: ./generate-cmdlist.sh
947 common-cmds.h: $(wildcard Documentation/git-*.txt)
948 $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
950 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
951 $(QUIET_GEN)$(RM) $@ $@+ && \
952 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
953 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
954 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
955 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
956 $@.sh >$@+ && \
957 chmod +x $@+ && \
958 mv $@+ $@
960 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
962 perl/perl.mak: GIT-CFLAGS
963 $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
965 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
966 $(QUIET_GEN)$(RM) $@ $@+ && \
967 INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
968 sed -e '1{' \
969 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
970 -e ' h' \
971 -e ' s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
972 -e ' H' \
973 -e ' x' \
974 -e '}' \
975 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
976 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
977 $@.perl >$@+ && \
978 chmod +x $@+ && \
979 mv $@+ $@
981 git-status: git-commit
982 $(QUIET_GEN)cp $< $@+ && mv $@+ $@
984 gitweb/gitweb.cgi: gitweb/gitweb.perl
985 $(QUIET_GEN)$(RM) $@ $@+ && \
986 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
987 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
988 -e 's|++GIT_BINDIR++|$(bindir)|g' \
989 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
990 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
991 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
992 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
993 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
994 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
995 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
996 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
997 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
998 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
999 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
1000 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
1001 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
1002 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
1003 $< >$@+ && \
1004 chmod +x $@+ && \
1005 mv $@+ $@
1007 git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
1008 $(QUIET_GEN)$(RM) $@ $@+ && \
1009 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1010 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1011 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1012 -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
1013 -e '/@@GITWEB_CGI@@/d' \
1014 -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
1015 -e '/@@GITWEB_CSS@@/d' \
1016 $@.sh > $@+ && \
1017 chmod +x $@+ && \
1018 mv $@+ $@
1020 configure: configure.ac
1021 $(QUIET_GEN)$(RM) $@ $<+ && \
1022 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1023 $< > $<+ && \
1024 autoconf -o $@ $<+ && \
1025 $(RM) $<+
1027 # These can record GIT_VERSION
1028 git.o git.spec \
1029 $(patsubst %.sh,%,$(SCRIPT_SH)) \
1030 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
1031 : GIT-VERSION-FILE
1033 %.o: %.c GIT-CFLAGS
1034 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1035 %.s: %.c GIT-CFLAGS
1036 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
1037 %.o: %.S
1038 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1040 exec_cmd.o: exec_cmd.c GIT-CFLAGS
1041 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
1042 builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
1043 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
1045 config.o: config.c GIT-CFLAGS
1046 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $<
1048 http.o: http.c GIT-CFLAGS
1049 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
1051 ifdef NO_EXPAT
1052 http-fetch.o: http-fetch.c http.h GIT-CFLAGS
1053 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
1054 endif
1056 git-%$X: %.o $(GITLIBS)
1057 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1059 ssh-pull.o: ssh-fetch.c
1060 ssh-push.o: ssh-upload.c
1061 git-local-fetch$X: fetch.o
1062 git-ssh-fetch$X: rsh.o fetch.o
1063 git-ssh-upload$X: rsh.o
1064 git-ssh-pull$X: rsh.o fetch.o
1065 git-ssh-push$X: rsh.o
1067 git-imap-send$X: imap-send.o $(LIB_FILE)
1069 http.o http-fetch.o http-push.o: http.h
1070 git-http-fetch$X: fetch.o http.o http-fetch.o $(GITLIBS)
1071 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1072 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1074 git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
1075 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1076 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1078 $(LIB_OBJS) $(BUILTIN_OBJS) fetch.o: $(LIB_H)
1079 $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
1080 $(DIFF_OBJS): diffcore.h
1082 $(LIB_FILE): $(LIB_OBJS)
1083 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
1085 $(BOX_OBJS): $(LIB_H) $(BOX_H)
1086 box/shell/ash.o: box/shell/ash_fork.c box/shell/ash_fork.h
1087 $(BOX_FILE): $(BOX_OBJS)
1088 $(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(BOX_OBJS)
1090 XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1091 xdiff/xmerge.o
1092 $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1093 xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
1095 $(XDIFF_LIB): $(XDIFF_OBJS)
1096 $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
1099 perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS
1100 (cd perl && $(PERL_PATH) Makefile.PL \
1101 PREFIX='$(prefix_SQ)')
1103 doc:
1104 $(MAKE) -C Documentation all
1106 TAGS:
1107 $(RM) TAGS
1108 find . -name '*.[hcS]' -print | xargs etags -a
1110 tags:
1111 $(RM) tags
1112 find . -name '*.[hcS]' -print | xargs ctags -a
1114 ### Detect prefix changes
1115 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
1116 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
1118 GIT-CFLAGS: .FORCE-GIT-CFLAGS
1119 @FLAGS='$(TRACK_CFLAGS)'; \
1120 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
1121 echo 1>&2 " * new build flags or prefix"; \
1122 echo "$$FLAGS" >GIT-CFLAGS; \
1125 ### Detect Tck/Tk interpreter path changes
1126 ifndef NO_TCLTK
1127 TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
1129 GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
1130 @VARS='$(TRACK_VARS)'; \
1131 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
1132 echo 1>&2 " * new Tcl/Tk interpreter location"; \
1133 echo "$$VARS" >$@; \
1136 .PHONY: .FORCE-GIT-GUI-VARS
1137 endif
1139 ### Testing rules
1141 TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X
1143 all: $(TEST_PROGRAMS)
1145 # GNU make supports exporting all variables by "export" without parameters.
1146 # However, the environment gets quite big, and some programs have problems
1147 # with that.
1149 export NO_SYMLINKS
1150 export NO_SVN_TESTS
1152 test: all
1153 $(MAKE) -C t/ all
1155 test-date$X: date.o ctype.o
1157 test-delta$X: diff-delta.o patch-delta.o
1159 test-%$X: test-%.o $(GITLIBS)
1160 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
1162 check-sha1:: test-sha1$X
1163 ./test-sha1.sh
1165 check: common-cmds.h
1166 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
1168 remove-dashes:
1169 ./fixup-builtins $(BUILT_INS)
1171 ### Installation rules
1173 install: all
1174 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(bindir_SQ)'
1175 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
1176 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
1177 $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
1178 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
1179 $(MAKE) -C perl prefix='$(prefix_SQ)' install
1180 ifndef NO_TCLTK
1181 $(INSTALL) gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
1182 $(MAKE) -C git-gui install
1183 endif
1184 if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
1185 then \
1186 ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
1187 '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \
1188 cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
1189 '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
1192 install-doc:
1193 $(MAKE) -C Documentation install
1195 quick-install-doc:
1196 $(MAKE) -C Documentation quick-install
1200 ### Maintainer's dist rules
1202 git.spec: git.spec.in
1203 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
1204 mv $@+ $@
1206 GIT_TARNAME=git-$(GIT_VERSION)
1207 dist: git.spec git-archive configure
1208 ./git-archive --format=tar \
1209 --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
1210 @mkdir -p $(GIT_TARNAME)
1211 @cp git.spec configure $(GIT_TARNAME)
1212 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
1213 @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
1214 $(TAR) rf $(GIT_TARNAME).tar \
1215 $(GIT_TARNAME)/git.spec \
1216 $(GIT_TARNAME)/configure \
1217 $(GIT_TARNAME)/version \
1218 $(GIT_TARNAME)/git-gui/version
1219 @$(RM) -r $(GIT_TARNAME)
1220 gzip -f -9 $(GIT_TARNAME).tar
1222 rpm: dist
1223 $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
1225 htmldocs = git-htmldocs-$(GIT_VERSION)
1226 manpages = git-manpages-$(GIT_VERSION)
1227 dist-doc:
1228 $(RM) -r .doc-tmp-dir
1229 mkdir .doc-tmp-dir
1230 $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
1231 cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
1232 gzip -n -9 -f $(htmldocs).tar
1234 $(RM) -r .doc-tmp-dir
1235 mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
1236 $(MAKE) -C Documentation DESTDIR=./ \
1237 man1dir=../.doc-tmp-dir/man1 \
1238 man5dir=../.doc-tmp-dir/man5 \
1239 man7dir=../.doc-tmp-dir/man7 \
1240 install
1241 cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
1242 gzip -n -9 -f $(manpages).tar
1243 $(RM) -r .doc-tmp-dir
1245 ### Cleaning rules
1247 clean:
1248 $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
1249 $(LIB_FILE) $(XDIFF_LIB)
1250 $(RM) $(ALL_PROGRAMS) git$X
1251 $(RM) $(TEST_PROGRAMS)
1252 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
1253 $(RM) -r autom4te.cache
1254 $(RM) configure config.log config.mak.autogen config.mak.append config.status config.cache
1255 $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
1256 $(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
1257 $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
1258 $(RM) gitweb/gitweb.cgi
1259 $(MAKE) -C Documentation/ clean
1260 $(MAKE) -C perl clean
1261 $(MAKE) -C templates/ clean
1262 $(MAKE) -C t/ clean
1263 ifndef NO_TCLTK
1264 $(RM) gitk-wish
1265 $(MAKE) -C git-gui clean
1266 endif
1267 $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
1269 .PHONY: all install clean strip
1270 .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS
1272 ### Check documentation
1274 check-docs::
1275 @for v in $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk; \
1276 do \
1277 case "$$v" in \
1278 git-merge-octopus | git-merge-ours | git-merge-recursive | \
1279 git-merge-resolve | git-merge-stupid | \
1280 git-add--interactive | git-fsck-objects | git-init-db | \
1281 git-repo-config | git-fetch--tool | \
1282 git-ssh-pull | git-ssh-push ) continue ;; \
1283 esac ; \
1284 test -f "Documentation/$$v.txt" || \
1285 echo "no doc: $$v"; \
1286 sed -e '1,/^__DATA__/d' Documentation/cmd-list.perl | \
1287 grep -q "^$$v[ ]" || \
1288 case "$$v" in \
1289 git) ;; \
1290 *) echo "no link: $$v";; \
1291 esac ; \
1292 done | sort
1294 ### Make sure built-ins do not have dups and listed in git.c
1296 check-builtins::
1297 ./check-builtins.sh