1 # The default target of this Makefile is...
4 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
5 # This also implies MOZILLA_SHA1.
7 # Define NO_CURL if you do not have curl installed. git-http-pull and
8 # git-http-push are not built, and you cannot use http:// and https://
11 # Define CURLDIR=/foo/bar if your curl header and library files are in
12 # /foo/bar/include and /foo/bar/lib directories.
14 # Define NO_EXPAT if you do not have expat installed. git-http-push is
15 # not built, and you cannot push using http:// and https:// transports.
17 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
19 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
20 # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
22 # Define NO_STRCASESTR if you don't have strcasestr.
24 # Define NO_STRLCPY if you don't have strlcpy.
26 # Define NO_SETENV if you don't have setenv in the C library.
28 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
29 # Enable it on Windows. By default, symrefs are still used.
31 # Define PPC_SHA1 environment variable when running make to make use of
32 # a bundled SHA1 routine optimized for PowerPC.
34 # Define ARM_SHA1 environment variable when running make to make use of
35 # a bundled SHA1 routine optimized for ARM.
37 # Define MOZILLA_SHA1 environment variable when running make to make use of
38 # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
39 # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
40 # choice) has very fast version optimized for i586.
42 # Define USE_PIC if you need the main git objects to be built with -fPIC
43 # in order to build and link perl/Git.so. x86-64 seems to need this.
45 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
47 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
49 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
52 # Define NO_MMAP if you want to avoid mmap.
54 # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
56 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
58 # Define NO_SOCKADDR_STORAGE if your platform does not have struct
61 # Define NO_ICONV if your libc does not properly support iconv.
63 # Define NO_ACCURATE_DIFF if your diff program at least sometimes misses
64 # a missing newline at the end of the file.
66 # Define NO_PYTHON if you want to loose all benefits of the recursive merge.
68 # Define COLLISION_CHECK below if you believe that SHA1's
69 # 1461501637330902918203684832716283019655932542976 hashes do not give you
70 # sufficient guarantee that no collisions between objects will ever happen.
72 # Define USE_NSEC below if you want git to care about sub-second file mtimes
73 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
74 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
75 # randomly break unless your underlying filesystem supports those sub-second
76 # times (my ext3 doesn't).
78 # Define USE_STDEV below if you want git to care about the underlying device
79 # change being considered an inode change from the update-cache perspective.
81 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
82 @
$(SHELL_PATH
) .
/GIT-VERSION-GEN
83 -include GIT-VERSION-FILE
85 uname_S
:= $(shell sh
-c
'uname -s 2>/dev/null || echo not')
86 uname_M
:= $(shell sh
-c
'uname -m 2>/dev/null || echo not')
87 uname_O
:= $(shell sh
-c
'uname -o 2>/dev/null || echo not')
88 uname_R
:= $(shell sh
-c
'uname -r 2>/dev/null || echo not')
89 uname_P
:= $(shell sh
-c
'uname -p 2>/dev/null || echo not')
91 # CFLAGS and LDFLAGS are for the users to override from the command line.
95 ALL_CFLAGS
= $(CFLAGS
)
96 ALL_LDFLAGS
= $(LDFLAGS
)
100 bindir = $(prefix)/bin
101 gitexecdir
= $(bindir)
102 template_dir
= $(prefix)/share
/git-core
/templates
/
103 GIT_PYTHON_DIR
= $(prefix)/share
/git-core
/python
112 # sparse is architecture-neutral, which means that we need to tell it
113 # explicitly what architecture to check for. Fix this up for yours..
114 SPARSE_FLAGS
= -D__BIG_ENDIAN__
-D__powerpc__
118 ### --- END CONFIGURATION SECTION ---
120 # Those must not be GNU-specific; they are shared with perl/ which may
121 # be built by a different compiler.
126 git-bisect.sh git-branch.sh git-checkout.sh \
127 git-cherry.sh git-clean.sh git-clone.sh git-commit.sh \
130 git-merge-one-file.sh git-parse-remote.sh \
131 git-prune.sh git-pull.sh git-rebase.sh \
132 git-repack.sh git-request-pull.sh git-reset.sh \
133 git-resolve.sh git-revert.sh git-sh-setup.sh \
134 git-tag.sh git-verify-tag.sh \
135 git-applymbox.sh git-applypatch.sh git-am.sh \
136 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
137 git-merge-resolve.sh git-merge-ours.sh \
138 git-lost-found.sh git-quiltimport.sh
141 git-archimport.perl git-cvsimport.perl git-relink.perl \
142 git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \
143 git-annotate.perl git-cvsserver.perl \
144 git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \
148 git-merge-recursive.py
150 SCRIPTS
= $(patsubst %.sh
,%,$(SCRIPT_SH
)) \
151 $(patsubst %.perl
,%,$(SCRIPT_PERL
)) \
152 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) \
153 git-cherry-pick git-status
155 # The ones that do not have to link with lcrypto, lz nor xdiff.
159 # ... and all the rest that could be moved out of bindir to gitexecdir
161 git-checkout-index
$X \
162 git-convert-objects
$X git-fetch-pack
$X git-fsck-objects
$X \
163 git-hash-object
$X git-index-pack
$X git-local-fetch
$X \
165 git-merge-index
$X git-mktag
$X git-mktree
$X git-pack-objects
$X git-patch-id
$X \
166 git-peek-remote
$X git-prune-packed
$X git-receive-pack
$X \
167 git-send-pack
$X git-shell
$X \
168 git-show-index
$X git-ssh-fetch
$X \
169 git-ssh-upload
$X git-unpack-file
$X \
170 git-unpack-objects
$X git-update-server-info
$X \
171 git-upload-pack
$X git-verify-pack
$X \
173 git-name-rev
$X git-pack-redundant
$X git-repo-config
$X git-var
$X \
174 git-describe
$X git-merge-tree
$X git-blame
$X git-imap-send
$X
176 BUILT_INS
= git-log
$X git-whatchanged
$X git-show
$X git-update-ref
$X \
177 git-count-objects
$X git-diff
$X git-push
$X git-mailsplit
$X \
178 git-grep
$X git-add
$X git-rm
$X git-rev-list
$X git-stripspace
$X \
179 git-check-ref-format
$X git-rev-parse
$X git-mailinfo
$X \
180 git-init-db
$X git-tar-tree
$X git-upload-tar
$X git-format-patch
$X \
181 git-ls-files
$X git-ls-tree
$X git-get-tar-commit-id
$X \
182 git-read-tree
$X git-commit-tree
$X git-write-tree
$X \
183 git-apply
$X git-show-branch
$X git-diff-files
$X git-update-index
$X \
184 git-diff-index
$X git-diff-stages
$X git-diff-tree
$X git-cat-file
$X
186 # what 'all' will build and 'install' will install, in gitexecdir
187 ALL_PROGRAMS
= $(PROGRAMS
) $(SIMPLE_PROGRAMS
) $(SCRIPTS
)
189 # Backward compatibility -- to be removed after 1.0
190 PROGRAMS
+= git-ssh-pull
$X git-ssh-push
$X
192 # Set paths to tools early so that they can be used for version tests.
197 PERL_PATH
= /usr
/bin
/perl
200 PYTHON_PATH
= /usr
/bin
/python
207 XDIFF_LIB
=xdiff
/lib.a
210 blob.h cache.h commit.h csum-file.h delta.h \
211 diff.h object.h pack.h pkt-line.h quote.h refs.h \
212 run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
213 tree-walk.h log-tree.h
dir.h
216 diff.o diff-lib.o diffcore-break.o diffcore-order.o \
217 diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \
218 diffcore-delta.o log-tree.o
221 blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \
222 date.o diff-delta.o entry.o exec_cmd.o ident.o lockfile.o \
223 object.o pack-check.o patch-delta.o path.o pkt-line.o \
224 quote.o read-cache.o refs.o run-command.o
dir.o object-refs.o \
225 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
226 tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
227 fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \
231 builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
232 builtin-grep.o builtin-add.o builtin-rev-list.o builtin-check-ref-format.o \
233 builtin-rm.o builtin-init-db.o builtin-rev-parse.o \
234 builtin-tar-tree.o builtin-upload-tar.o builtin-update-index.o \
235 builtin-ls-files.o builtin-ls-tree.o builtin-write-tree.o \
236 builtin-read-tree.o builtin-commit-tree.o builtin-mailinfo.o \
237 builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
238 builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
239 builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
242 GITLIBS
= $(LIB_FILE
) $(XDIFF_LIB
)
246 # Platform specific tweaks
249 # We choose to avoid "if .. else if .. else .. endif endif"
250 # because maintaining the nesting to match is a pain. If
251 # we had "elif" things would have been much nicer...
253 ifeq ($(uname_S
),Linux
)
254 NO_STRLCPY
= YesPlease
256 ifeq ($(uname_S
),Darwin
)
257 NEEDS_SSL_WITH_CRYPTO
= YesPlease
258 NEEDS_LIBICONV
= YesPlease
259 NO_STRLCPY
= YesPlease
261 ifeq ($(shell test -d
/sw
/lib
&& echo y
),y
)
262 BASIC_CFLAGS
+= -I
/sw
/include
263 BASIC_LDFLAGS
+= -L
/sw
/lib
266 ifeq ($(shell test -d
/opt
/local
/lib
&& echo y
),y
)
267 BASIC_CFLAGS
+= -I
/opt
/local
/include
268 BASIC_LDFLAGS
+= -L
/opt
/local
/lib
271 ifeq ($(uname_S
),SunOS
)
272 NEEDS_SOCKET
= YesPlease
273 NEEDS_NSL
= YesPlease
274 SHELL_PATH
= /bin
/bash
275 NO_STRCASESTR
= YesPlease
276 NO_STRLCPY
= YesPlease
277 ifeq ($(uname_R
),5.8)
278 NEEDS_LIBICONV
= YesPlease
279 NO_UNSETENV
= YesPlease
280 NO_SETENV
= YesPlease
282 ifeq ($(uname_R
),5.9)
283 NO_UNSETENV
= YesPlease
284 NO_SETENV
= YesPlease
288 BASIC_CFLAGS
+= -D__EXTENSIONS__
290 ifeq ($(uname_O
),Cygwin
)
291 NO_D_TYPE_IN_DIRENT
= YesPlease
292 NO_D_INO_IN_DIRENT
= YesPlease
293 NO_STRCASESTR
= YesPlease
294 NO_STRLCPY
= YesPlease
295 NO_SYMLINK_HEAD
= YesPlease
296 NEEDS_LIBICONV
= YesPlease
297 # There are conflicting reports about this.
298 # On some boxes NO_MMAP is needed, and not so elsewhere.
299 # Try uncommenting this if you see things break -- YMMV.
300 # NO_MMAP = YesPlease
304 ifeq ($(uname_S
),FreeBSD
)
305 NEEDS_LIBICONV
= YesPlease
306 BASIC_CFLAGS
+= -I
/usr
/local
/include
307 BASIC_LDFLAGS
+= -L
/usr
/local
/lib
309 ifeq ($(uname_S
),OpenBSD
)
310 NO_STRCASESTR
= YesPlease
311 NEEDS_LIBICONV
= YesPlease
312 BASIC_CFLAGS
+= -I
/usr
/local
/include
313 BASIC_LDFLAGS
+= -L
/usr
/local
/lib
315 ifeq ($(uname_S
),NetBSD
)
316 ifeq ($(shell expr
"$(uname_R)" : '[01]\.'),2)
317 NEEDS_LIBICONV
= YesPlease
319 BASIC_CFLAGS
+= -I
/usr
/pkg
/include
320 BASIC_LDFLAGS
+= -L
/usr
/pkg
/lib
321 ALL_LDFLAGS
+= -Wl
,-rpath
,/usr
/pkg
/lib
323 ifeq ($(uname_S
),AIX
)
324 NO_STRCASESTR
=YesPlease
325 NO_STRLCPY
= YesPlease
326 NEEDS_LIBICONV
=YesPlease
328 ifeq ($(uname_S
),IRIX64
)
331 NO_STRCASESTR
=YesPlease
332 NO_STRLCPY
= YesPlease
333 NO_SOCKADDR_STORAGE
=YesPlease
334 SHELL_PATH
=/usr
/gnu
/bin
/bash
335 BASIC_CFLAGS
+= -DPATH_MAX
=1024
336 # for now, build 32-bit version
337 BASIC_LDFLAGS
+= -L
/usr
/lib32
339 ifneq (,$(findstring arm
,$(uname_M
)))
345 ifdef WITH_OWN_SUBPROCESS_PY
346 PYMODULES
+= compat
/subprocess.py
349 ifneq ($(shell $(PYTHON_PATH
) -c
'import subprocess;print"OK"' 2>/dev
/null
),OK
)
350 PYMODULES
+= compat
/subprocess.py
357 # This is still problematic -- gcc does not always want -R.
358 BASIC_CFLAGS
+= -I
$(CURLDIR
)/include
359 CURL_LIBCURL
= -L
$(CURLDIR
)/lib
-R
$(CURLDIR
)/lib
-lcurl
361 CURL_LIBCURL
= -lcurl
363 PROGRAMS
+= git-http-fetch
$X
364 curl_check
:= $(shell (echo
070908; curl-config
--vernum
) |
sort -r | sed
-ne
2p
)
365 ifeq "$(curl_check)" "070908"
367 PROGRAMS
+= git-http-push
$X
371 EXPAT_LIBEXPAT
= -lexpat
376 OPENSSL_LIBSSL
= -lssl
378 # Again this may be problematic -- gcc does not always want -R.
379 BASIC_CFLAGS
+= -I
$(OPENSSLDIR
)/include
380 OPENSSL_LINK
= -L
$(OPENSSLDIR
)/lib
-R
$(OPENSSLDIR
)/lib
385 BASIC_CFLAGS
+= -DNO_OPENSSL
389 ifdef NEEDS_SSL_WITH_CRYPTO
390 LIB_4_CRYPTO
= $(OPENSSL_LINK
) -lcrypto
-lssl
392 LIB_4_CRYPTO
= $(OPENSSL_LINK
) -lcrypto
396 # Again this may be problematic -- gcc does not always want -R.
397 BASIC_CFLAGS
+= -I
$(ICONVDIR
)/include
398 ICONV_LINK
= -L
$(ICONVDIR
)/lib
-R
$(ICONVDIR
)/lib
402 EXTLIBS
+= $(ICONV_LINK
) -liconv
406 SIMPLE_LIB
+= -lsocket
412 ifdef NO_D_TYPE_IN_DIRENT
413 BASIC_CFLAGS
+= -DNO_D_TYPE_IN_DIRENT
415 ifdef NO_D_INO_IN_DIRENT
416 BASIC_CFLAGS
+= -DNO_D_INO_IN_DIRENT
418 ifdef NO_SYMLINK_HEAD
419 BASIC_CFLAGS
+= -DNO_SYMLINK_HEAD
422 COMPAT_CFLAGS
+= -DNO_STRCASESTR
423 COMPAT_OBJS
+= compat
/strcasestr.o
426 COMPAT_CFLAGS
+= -DNO_STRLCPY
427 COMPAT_OBJS
+= compat
/strlcpy.o
430 COMPAT_CFLAGS
+= -DNO_SETENV
431 COMPAT_OBJS
+= compat
/setenv.o
434 COMPAT_CFLAGS
+= -DNO_UNSETENV
435 COMPAT_OBJS
+= compat
/unsetenv.o
438 COMPAT_CFLAGS
+= -DNO_MMAP
439 COMPAT_OBJS
+= compat
/mmap.o
442 BASIC_CFLAGS
+= -DNO_IPV6
444 ifdef NO_SOCKADDR_STORAGE
446 BASIC_CFLAGS
+= -Dsockaddr_storage
=sockaddr_in
448 BASIC_CFLAGS
+= -Dsockaddr_storage
=sockaddr_in6
452 LIB_OBJS
+= compat
/inet_ntop.o
456 BASIC_CFLAGS
+= -DNO_ICONV
460 SHA1_HEADER
= "ppc/sha1.h"
461 LIB_OBJS
+= ppc
/sha1.o ppc
/sha1ppc.o
464 SHA1_HEADER
= "arm/sha1.h"
465 LIB_OBJS
+= arm
/sha1.o arm
/sha1_arm.o
468 SHA1_HEADER
= "mozilla-sha1/sha1.h"
469 LIB_OBJS
+= mozilla-sha1
/sha1.o
471 SHA1_HEADER
= <openssl
/sha.h
>
472 EXTLIBS
+= $(LIB_4_CRYPTO
)
479 ifdef NO_ACCURATE_DIFF
480 BASIC_CFLAGS
+= -DNO_ACCURATE_DIFF
483 # Shell quote (do not use $(call) to accomodate ancient setups);
485 SHA1_HEADER_SQ
= $(subst ','\'',$(SHA1_HEADER))
487 DESTDIR_SQ = $(subst ','\'',$(DESTDIR
))
488 bindir_SQ
= $(subst ','\'',$(bindir))
489 gitexecdir_SQ = $(subst ','\'',$(gitexecdir
))
490 template_dir_SQ
= $(subst ','\'',$(template_dir))
491 prefix_SQ = $(subst ','\'',$(prefix))
493 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
494 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH
))
495 PYTHON_PATH_SQ
= $(subst ','\'',$(PYTHON_PATH))
496 GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR
))
498 LIBS
= $(GITLIBS
) $(EXTLIBS
)
500 BASIC_CFLAGS
+= -DSHA1_HEADER
='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS
)
501 LIB_OBJS
+= $(COMPAT_OBJS
)
503 ALL_CFLAGS
+= $(BASIC_CFLAGS
)
504 ALL_LDFLAGS
+= $(BASIC_LDFLAGS
)
506 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
511 all: $(ALL_PROGRAMS
) $(BUILT_INS
) git
$X gitk
517 strip: $(PROGRAMS
) git
$X
518 $(STRIP
) $(STRIP_OPTS
) $(PROGRAMS
) git
$X
520 git
$X: git.c common-cmds.h
$(BUILTIN_OBJS
) $(GITLIBS
) GIT-CFLAGS
521 $(CC
) -DGIT_VERSION
='"$(GIT_VERSION)"' \
522 $(ALL_CFLAGS
) -o
$@
$(filter %.c
,$^
) \
523 $(BUILTIN_OBJS
) $(ALL_LDFLAGS
) $(LIBS
)
525 builtin-help.o
: common-cmds.h
528 rm -f
$@
&& ln git
$X $@
530 common-cmds.h
: Documentation
/git-
*.txt
531 .
/generate-cmdlist.sh
> $@
+
534 $(patsubst %.sh
,%,$(SCRIPT_SH
)) : % : %.sh
536 sed
-e
'1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
537 -e
's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
538 -e
's/@@NO_CURL@@/$(NO_CURL)/g' \
539 -e
's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \
544 $(patsubst %.perl
,%,$(SCRIPT_PERL
)): perl
/Makefile
545 $(patsubst %.perl
,%,$(SCRIPT_PERL
)): % : %.perl
547 INSTLIBDIR
=`make -s -C perl instlibdir` && \
548 sed
-e
'1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1|' \
549 -e
's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
550 -e
's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
555 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) : % : %.py GIT-CFLAGS
557 sed
-e
'1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
558 -e
's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR_SQ)|g' \
559 -e
's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
564 git-cherry-pick
: git-revert
568 git-status
: git-commit
572 # These can record GIT_VERSION
574 $(patsubst %.sh
,%,$(SCRIPT_SH
)) \
575 $(patsubst %.perl
,%,$(SCRIPT_PERL
)) \
576 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) \
580 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) $<
582 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) $<
584 exec_cmd.o
: exec_cmd.c GIT-CFLAGS
585 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
586 builtin-init-db.o
: builtin-init-db.c GIT-CFLAGS
587 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) -DDEFAULT_GIT_TEMPLATE_DIR
='"$(template_dir_SQ)"' $<
589 http.o
: http.c GIT-CFLAGS
590 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) -DGIT_USER_AGENT
='"git/$(GIT_VERSION)"' $<
593 http-fetch.o
: http-fetch.c http.h GIT-CFLAGS
594 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) -DNO_EXPAT
$<
597 git-
%$X: %.o
$(GITLIBS
)
598 $(CC
) $(ALL_CFLAGS
) -o
$@
$(ALL_LDFLAGS
) $(filter %.o
,$^
) $(LIBS
)
600 $(SIMPLE_PROGRAMS
) : $(LIB_FILE
)
601 $(SIMPLE_PROGRAMS
) : git-
%$X : %.o
602 $(CC
) $(ALL_CFLAGS
) -o
$@
$(ALL_LDFLAGS
) $(filter %.o
,$^
) \
603 $(LIB_FILE
) $(SIMPLE_LIB
)
605 git-local-fetch
$X: fetch.o
606 git-ssh-fetch
$X: rsh.o fetch.o
607 git-ssh-upload
$X: rsh.o
608 git-ssh-pull
$X: rsh.o fetch.o
609 git-ssh-push
$X: rsh.o
611 git-imap-send
$X: imap-send.o
$(LIB_FILE
)
613 http.o http-fetch.o http-push.o
: http.h
614 git-http-fetch
$X: fetch.o http.o http-fetch.o
$(LIB_FILE
)
615 $(CC
) $(ALL_CFLAGS
) -o
$@
$(ALL_LDFLAGS
) $(filter %.o
,$^
) \
616 $(LIBS
) $(CURL_LIBCURL
) $(EXPAT_LIBEXPAT
)
618 git-http-push
$X: revision.o http.o http-push.o
$(LIB_FILE
)
619 $(CC
) $(ALL_CFLAGS
) -o
$@
$(ALL_LDFLAGS
) $(filter %.o
,$^
) \
620 $(LIBS
) $(CURL_LIBCURL
) $(EXPAT_LIBEXPAT
)
622 $(LIB_OBJS
) $(BUILTIN_OBJS
): $(LIB_H
)
623 $(patsubst git-
%$X,%.o
,$(PROGRAMS
)): $(LIB_H
) $(wildcard */*.h
)
624 $(DIFF_OBJS
): diffcore.h
626 $(LIB_FILE
): $(LIB_OBJS
)
627 rm -f
$@
&& $(AR
) rcs
$@
$(LIB_OBJS
)
629 XDIFF_OBJS
=xdiff
/xdiffi.o xdiff
/xprepare.o xdiff
/xutils.o xdiff
/xemit.o
631 $(XDIFF_LIB
): $(XDIFF_OBJS
)
632 rm -f
$@
&& $(AR
) rcs
$@
$(XDIFF_OBJS
)
635 PERL_DEFINE
= $(BASIC_CFLAGS
) -DGIT_VERSION
='"$(GIT_VERSION)"'
636 PERL_DEFINE_SQ
= $(subst ','\'',$(PERL_DEFINE))
637 PERL_LIBS = $(BASIC_LDFLAGS) $(EXTLIBS)
638 PERL_LIBS_SQ = $(subst ','\'',$(PERL_LIBS
))
639 perl
/Makefile
: perl
/Git.pm perl
/Makefile.PL GIT-CFLAGS
640 (cd perl
&& $(PERL_PATH
) Makefile.PL \
641 PREFIX
='$(prefix_SQ)' \
642 DEFINE
='$(PERL_DEFINE_SQ)' \
643 LIBS
='$(PERL_LIBS_SQ)')
646 $(MAKE
) -C Documentation
all
650 find .
-name
'*.[hcS]' -print | xargs etags
-a
654 find .
-name
'*.[hcS]' -print | xargs ctags
-a
656 ### Detect prefix changes
657 TRACK_CFLAGS
= $(subst ','\'',$(ALL_CFLAGS)):$(GIT_PYTHON_DIR_SQ):\
658 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
660 GIT-CFLAGS: .FORCE-GIT-CFLAGS
661 @FLAGS='$(TRACK_CFLAGS
)'; \
662 if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
663 echo 1>&2 " * new build flags or prefix"; \
664 echo "$$FLAGS" >GIT-CFLAGS; \
669 # GNU make supports exporting all variables by "export" without parameters.
670 # However, the environment gets quite big, and some programs have problems
678 test-date$X: test-date.c date.o ctype.o
679 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o
681 test-delta$X: test-delta.c diff-delta.o patch-delta.o
682 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^
684 test-dump-cache-tree$X: dump-cache-tree.o $(GITLIBS)
685 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
688 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
692 ### Installation rules
695 $(INSTALL) -d -m755 '$(DESTDIR_SQ
)$(bindir_SQ
)'
696 $(INSTALL) -d -m755 '$(DESTDIR_SQ
)$(gitexecdir_SQ
)'
697 $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ
)$(gitexecdir_SQ
)'
698 $(INSTALL) git$X gitk '$(DESTDIR_SQ
)$(bindir_SQ
)'
699 $(MAKE) -C templates install
700 $(MAKE) -C perl install
701 $(INSTALL) -d -m755 '$(DESTDIR_SQ
)$(GIT_PYTHON_DIR_SQ
)'
702 $(INSTALL) $(PYMODULES) '$(DESTDIR_SQ
)$(GIT_PYTHON_DIR_SQ
)'
703 if test 'z
$(bindir_SQ
)' != 'z
$(gitexecdir_SQ
)'; \
705 ln -f '$(DESTDIR_SQ
)$(bindir_SQ
)/git
$X' \
706 '$(DESTDIR_SQ
)$(gitexecdir_SQ
)/git
$X' || \
707 cp '$(DESTDIR_SQ
)$(bindir_SQ
)/git
$X' \
708 '$(DESTDIR_SQ
)$(gitexecdir_SQ
)/git
$X'; \
710 $(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ
)$(gitexecdir_SQ
)/$p' && ln '$(DESTDIR_SQ
)$(gitexecdir_SQ
)/git
$X' '$(DESTDIR_SQ
)$(gitexecdir_SQ
)/$p' ;)
713 $(MAKE) -C Documentation install
718 ### Maintainer's
dist rules
720 git.spec
: git.spec.in
721 sed
-e
's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
+
724 GIT_TARNAME
=git-
$(GIT_VERSION
)
725 dist: git.spec git-tar-tree
726 .
/git-tar-tree HEAD^
{tree
} $(GIT_TARNAME
) > $(GIT_TARNAME
).
tar
727 @mkdir
-p
$(GIT_TARNAME
)
728 @cp git.spec
$(GIT_TARNAME
)
729 @echo
$(GIT_VERSION
) > $(GIT_TARNAME
)/version
730 $(TAR
) rf
$(GIT_TARNAME
).
tar \
731 $(GIT_TARNAME
)/git.spec
$(GIT_TARNAME
)/version
732 @
rm -rf
$(GIT_TARNAME
)
733 gzip
-f
-9 $(GIT_TARNAME
).
tar
736 $(RPMBUILD
) -ta
$(GIT_TARNAME
).
tar.gz
738 htmldocs
= git-htmldocs-
$(GIT_VERSION
)
739 manpages
= git-manpages-
$(GIT_VERSION
)
743 $(MAKE
) -C Documentation WEBDOC_DEST
=..
/.doc-tmp-dir install-webdoc
744 cd .doc-tmp-dir
&& $(TAR
) cf ..
/$(htmldocs
).
tar .
745 gzip
-n
-9 -f
$(htmldocs
).
tar
748 mkdir .doc-tmp-dir .doc-tmp-dir
/man1 .doc-tmp-dir
/man7
749 $(MAKE
) -C Documentation DESTDIR
=.
/ \
750 man1
=..
/.doc-tmp-dir
/man1 \
751 man7
=..
/.doc-tmp-dir
/man7 \
753 cd .doc-tmp-dir
&& $(TAR
) cf ..
/$(manpages
).
tar .
754 gzip
-n
-9 -f
$(manpages
).
tar
760 rm -f
*.o mozilla-sha1
/*.o arm
/*.o ppc
/*.o compat
/*.o xdiff
/*.o \
761 $(LIB_FILE
) $(XDIFF_LIB
)
762 rm -f
$(ALL_PROGRAMS
) $(BUILT_INS
) git
$X
763 rm -f
*.spec
*.pyc
*.pyo
*/*.pyc
*/*.pyo common-cmds.h TAGS
tags
764 rm -rf
$(GIT_TARNAME
) .doc-tmp-dir
765 rm -f
$(GIT_TARNAME
).
tar.gz git-core_
$(GIT_VERSION
)-*.
tar.gz
766 rm -f
$(htmldocs
).
tar.gz
$(manpages
).
tar.gz
767 $(MAKE
) -C Documentation
/ clean
768 [ ! -f perl
/Makefile
] ||
$(MAKE
) -C perl
/ clean ||
$(MAKE
) -C perl
/ clean
769 $(MAKE
) -C templates
/ clean
771 rm -f GIT-VERSION-FILE GIT-CFLAGS
773 .PHONY
: all install clean strip
774 .PHONY
: .FORCE-GIT-VERSION-FILE TAGS
tags .FORCE-GIT-CFLAGS
776 ### Check documentation
779 @for v in
$(ALL_PROGRAMS
) $(BUILT_INS
) git
$X gitk
; \
782 git-merge-octopus | git-merge-ours | git-merge-recursive | \
783 git-merge-resolve | git-merge-stupid | \
784 git-ssh-pull | git-ssh-push
) continue
;; \
786 test -f
"Documentation/$$v.txt" || \
787 echo
"no doc: $$v"; \
788 grep
-q
"^gitlink:$$v\[[0-9]\]::" Documentation
/git.txt || \
791 *) echo
"no link: $$v";; \