]> git.ipfire.org Git - thirdparty/git.git/blame - Makefile
Makefile: do not assume lack of IPV6 means no sockaddr_storage.
[thirdparty/git.git] / Makefile
CommitLineData
2731d048
JH
1# The default target of this Makefile is...
2all:
3
5bdac8b3
PB
4# Define MOZILLA_SHA1 environment variable when running make to make use of
5# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
6# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
7# choice) has very fast version optimized for i586.
bdd4da59 8#
5bdac8b3
PB
9# Define NO_OPENSSL environment variable if you do not have OpenSSL. You will
10# miss out git-rev-list --merge-order. This also implies MOZILLA_SHA1.
2cb45e95 11#
58e60dd2
NH
12# Define NO_CURL if you do not have curl installed. git-http-pull and
13# git-http-push are not built, and you cannot use http:// and https://
14# transports.
b2c0bd65 15#
6d9bbc50
PM
16# Define CURLDIR=/foo/bar if your curl header and library files are in
17# /foo/bar/include and /foo/bar/lib directories.
18#
58e60dd2
NH
19# Define NO_EXPAT if you do not have expat installed. git-http-push is
20# not built, and you cannot push using http:// and https:// transports.
21#
ef34af24
LT
22# Define NO_STRCASESTR if you don't have strcasestr.
23#
e40b61fb
JR
24# Define NO_SETENV if you don't have setenv in the C library.
25#
2fabd217
PR
26# Define USE_SYMLINK_HEAD if you want .git/HEAD to be a symbolic link.
27# Don't enable it on Windows.
28#
5bdac8b3
PB
29# Define PPC_SHA1 environment variable when running make to make use of
30# a bundled SHA1 routine optimized for PowerPC.
597c9cc5 31#
7c6ef2f2
NP
32# Define ARM_SHA1 environment variable when running make to make use of
33# a bundled SHA1 routine optimized for ARM.
34#
597c9cc5 35# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
f0ebff0d 36#
597c9cc5 37# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
f0ebff0d
PM
38#
39# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
40# Patrick Mauritz).
41#
730d48a2
JS
42# Define NO_MMAP if you want to avoid mmap.
43#
343d35c9
JH
44# Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
45#
49744d63
PA
46# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
47#
bdc37f5a
JH
48# Define NO_SOCKADDR_STORAGE if your platform does not have struct
49# sockaddr_storage.
50#
5bdac8b3
PB
51# Define COLLISION_CHECK below if you believe that SHA1's
52# 1461501637330902918203684832716283019655932542976 hashes do not give you
53# sufficient guarantee that no collisions between objects will ever happen.
54
5bdac8b3
PB
55# Define USE_NSEC below if you want git to care about sub-second file mtimes
56# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
57# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
58# randomly break unless your underlying filesystem supports those sub-second
59# times (my ext3 doesn't).
60
5bdac8b3
PB
61# Define USE_STDEV below if you want git to care about the underlying device
62# change being considered an inode change from the update-cache perspective.
63
9b88fcef
JH
64GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
65 @sh ./GIT-VERSION-GEN
66-include GIT-VERSION-FILE
a9db2974 67
94d23317 68# CFLAGS and LDFLAGS are for the users to override from the command line.
12aa7456 69
b05701c5 70CFLAGS = -g -O2 -Wall
94d23317 71LDFLAGS =
12aa7456 72ALL_CFLAGS = $(CFLAGS)
94d23317 73ALL_LDFLAGS = $(LDFLAGS)
4dc00021 74STRIP ?= strip
29c2cce4 75
b05701c5
PR
76prefix = $(HOME)
77bindir = $(prefix)/bin
77cb17e9 78gitexecdir = $(prefix)/bin
b05701c5 79template_dir = $(prefix)/share/git-core/templates/
720d150c 80GIT_PYTHON_DIR = $(prefix)/share/git-core/python
a682ef9f 81# DESTDIR=
5c2a7fbc 82
b05701c5
PR
83CC = gcc
84AR = ar
229a7ed7 85TAR = tar
b05701c5
PR
86INSTALL = install
87RPMBUILD = rpmbuild
e83c5163 88
44c9e859
LT
89# sparse is architecture-neutral, which means that we need to tell it
90# explicitly what architecture to check for. Fix this up for yours..
b05701c5 91SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
44c9e859 92
28818ffa
PB
93
94
95### --- END CONFIGURATION SECTION ---
96
215a7ad1
JH
97SCRIPT_SH = \
98 git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \
99 git-cherry.sh git-clone.sh git-commit.sh \
100 git-count-objects.sh git-diff.sh git-fetch.sh \
101 git-format-patch.sh git-log.sh git-ls-remote.sh \
e32faa8a 102 git-merge-one-file.sh git-parse-remote.sh \
215a7ad1
JH
103 git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
104 git-repack.sh git-request-pull.sh git-reset.sh \
105 git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \
27dedf0c 106 git-tag.sh git-verify-tag.sh git-whatchanged.sh \
d1c5f2a4 107 git-applymbox.sh git-applypatch.sh git-am.sh \
2276aa6c 108 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
04e7ca1a 109 git-merge-resolve.sh git-merge-ours.sh git-grep.sh \
0086e2c8 110 git-lost-found.sh
215a7ad1
JH
111
112SCRIPT_PERL = \
113 git-archimport.perl git-cvsimport.perl git-relink.perl \
1331df87 114 git-shortlog.perl git-fmt-merge-msg.perl \
5e0306ad 115 git-svnimport.perl git-mv.perl git-cvsexportcommit.perl
60036a41 116
720d150c 117SCRIPT_PYTHON = \
e4cf17ce 118 git-merge-recursive.py
720d150c 119
d6ebd259
AE
120SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
121 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
122 $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
b42934d6 123 git-cherry-pick
d6ebd259 124
597c9cc5
JH
125# The ones that do not have to link with lcrypto nor lz.
126SIMPLE_PROGRAMS = \
2f29dd52 127 git-get-tar-commit-id$X git-mailinfo$X git-mailsplit$X \
27dedf0c 128 git-stripspace$X git-daemon$X
597c9cc5 129
b42934d6 130# ... and all the rest that could be moved out of bindir to gitexecdir
215a7ad1 131PROGRAMS = \
79a9d8ea
PA
132 git-apply$X git-cat-file$X \
133 git-checkout-index$X git-clone-pack$X git-commit-tree$X \
134 git-convert-objects$X git-diff-files$X \
135 git-diff-index$X git-diff-stages$X \
136 git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
9cf6d335 137 git-hash-object$X git-index-pack$X git-init-db$X \
79a9d8ea
PA
138 git-local-fetch$X git-ls-files$X git-ls-tree$X git-merge-base$X \
139 git-merge-index$X git-mktag$X git-pack-objects$X git-patch-id$X \
140 git-peek-remote$X git-prune-packed$X git-read-tree$X \
141 git-receive-pack$X git-rev-list$X git-rev-parse$X \
35eb2d36 142 git-send-pack$X git-show-branch$X git-shell$X \
79a9d8ea
PA
143 git-show-index$X git-ssh-fetch$X \
144 git-ssh-upload$X git-tar-tree$X git-unpack-file$X \
145 git-unpack-objects$X git-update-index$X git-update-server-info$X \
146 git-upload-pack$X git-verify-pack$X git-write-tree$X \
03feddd6 147 git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
908e5310
LT
148 git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \
149 git-describe$X
d6ebd259 150
b42934d6 151# what 'all' will build and 'install' will install, in gitexecdir
77cb17e9 152ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
e83c5163 153
894a8a8b 154# Backward compatibility -- to be removed after 1.0
2f29dd52 155PROGRAMS += git-ssh-pull$X git-ssh-push$X
f71a69ab 156
3d32051f
RA
157# Set paths to tools early so that they can be used for version tests.
158ifndef SHELL_PATH
159 SHELL_PATH = /bin/sh
160endif
161ifndef PERL_PATH
162 PERL_PATH = /usr/bin/perl
163endif
164ifndef PYTHON_PATH
165 PYTHON_PATH = /usr/bin/python
166endif
167
720d150c
JH
168PYMODULES = \
169 gitMergeCommon.py
170
0a02ce72 171LIB_FILE=libgit.a
8f3f9b09 172
215a7ad1
JH
173LIB_H = \
174 blob.h cache.h commit.h count-delta.h csum-file.h delta.h \
175 diff.h epoch.h object.h pack.h pkt-line.h quote.h refs.h \
4050c0df 176 run-command.h strbuf.h tag.h tree.h git-compat-util.h
b1bf95bb 177
215a7ad1
JH
178DIFF_OBJS = \
179 diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
ac1b3d12 180 diffcore-pickaxe.o diffcore-rename.o tree-diff.o
d1df5743 181
215a7ad1
JH
182LIB_OBJS = \
183 blob.o commit.o connect.o count-delta.o csum-file.o \
77cb17e9 184 date.o diff-delta.o entry.o exec_cmd.o ident.o index.o \
215a7ad1 185 object.o pack-check.o patch-delta.o path.o pkt-line.o \
0f56479d 186 quote.o read-cache.o refs.o run-command.o \
215a7ad1 187 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
f3123c4a 188 tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
ad897215 189 fetch-clone.o \
4546738b 190 $(DIFF_OBJS)
d19938ab 191
cc1ad5c8
LT
192LIBS = $(LIB_FILE)
193LIBS += -lz
cef661fc 194
4769948a
JH
195# Shell quote;
196# Result of this needs to be placed inside ''
197shq = $(subst ','\'',$(1))
198# This has surrounding ''
199shellquote = '$(call shq,$(1))'
200
229a7ed7
JH
201#
202# Platform specific tweaks
203#
f7c15343
JH
204
205# We choose to avoid "if .. else if .. else .. endif endif"
206# because maintaining the nesting to match is a pain. If
207# we had "elif" things would have been much nicer...
208uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
209uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
210uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
e40b61fb 211uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
f7c15343
JH
212
213ifeq ($(uname_S),Darwin)
597c9cc5
JH
214 NEEDS_SSL_WITH_CRYPTO = YesPlease
215 NEEDS_LIBICONV = YesPlease
0cfddacd 216 ## fink
94d23317
JH
217 ALL_CFLAGS += -I/sw/include
218 ALL_LDFLAGS += -L/sw/lib
0cfddacd 219 ## darwinports
94d23317
JH
220 ALL_CFLAGS += -I/opt/local/include
221 ALL_LDFLAGS += -L/opt/local/lib
597c9cc5 222endif
f7c15343 223ifeq ($(uname_S),SunOS)
f0ebff0d 224 NEEDS_SOCKET = YesPlease
5a90d4ac 225 NEEDS_NSL = YesPlease
2fd955cc 226 NEEDS_LIBICONV = YesPlease
229a7ed7
JH
227 SHELL_PATH = /bin/bash
228 NO_STRCASESTR = YesPlease
e40b61fb
JR
229 ifeq ($(uname_R),5.8)
230 NO_SETENV = YesPlease
231 endif
229a7ed7
JH
232 INSTALL = ginstall
233 TAR = gtar
12aa7456 234 ALL_CFLAGS += -D__EXTENSIONS__
f0ebff0d 235endif
f7c15343 236ifeq ($(uname_O),Cygwin)
17754517
PA
237 NO_STRCASESTR = YesPlease
238 NEEDS_LIBICONV = YesPlease
2e67a5f4
JH
239 # There are conflicting reports about this.
240 # On some boxes NO_MMAP is needed, and not so elsewhere.
241 # Try uncommenting this if you see things break -- YMMV.
242 # NO_MMAP = YesPlease
49744d63 243 NO_IPV6 = YesPlease
a23cd8ec 244 X = .exe
7c6ef2f2 245endif
f7c15343 246ifeq ($(uname_S),OpenBSD)
5fb41e8a 247 NO_STRCASESTR = YesPlease
18c5a525 248 NEEDS_LIBICONV = YesPlease
94d23317
JH
249 ALL_CFLAGS += -I/usr/local/include
250 ALL_LDFLAGS += -L/usr/local/lib
251endif
252ifeq ($(uname_S),NetBSD)
253 NEEDS_LIBICONV = YesPlease
254 ALL_CFLAGS += -I/usr/pkg/include
255 ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
18c5a525 256endif
a6da9395
JR
257ifeq ($(uname_S),AIX)
258 NO_STRCASESTR=YesPlease
259 NEEDS_LIBICONV=YesPlease
260endif
f7c15343
JH
261ifneq (,$(findstring arm,$(uname_M)))
262 ARM_SHA1 = YesPlease
263endif
597c9cc5 264
f2d6a256 265-include config.mak
597c9cc5 266
b34403aa
TH
267ifdef WITH_OWN_SUBPROCESS_PY
268 PYMODULES += compat/subprocess.py
269else
270 ifneq ($(shell $(PYTHON_PATH) -c 'import subprocess;print"OK"' 2>/dev/null),OK)
271 PYMODULES += compat/subprocess.py
272 endif
273endif
274
275ifdef WITH_SEND_EMAIL
276 SCRIPT_PERL += git-send-email.perl
277endif
278
229a7ed7
JH
279ifndef NO_CURL
280 ifdef CURLDIR
94d23317 281 # This is still problematic -- gcc does not always want -R.
12aa7456 282 ALL_CFLAGS += -I$(CURLDIR)/include
229a7ed7
JH
283 CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
284 else
285 CURL_LIBCURL = -lcurl
286 endif
2f29dd52 287 PROGRAMS += git-http-fetch$X
08900987
NH
288 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
289 ifeq "$(curl_check)" "070908"
290 ifndef NO_EXPAT
291 EXPAT_LIBEXPAT = -lexpat
292 PROGRAMS += git-http-push$X
293 endif
58e60dd2 294 endif
229a7ed7
JH
295endif
296
dd53c7ab
PB
297ifndef NO_OPENSSL
298 LIB_OBJS += epoch.o
215a7ad1 299 OPENSSL_LIBSSL = -lssl
455a7f32
JH
300 ifdef OPENSSLDIR
301 # Again this may be problematic -- gcc does not always want -R.
12aa7456 302 ALL_CFLAGS += -I$(OPENSSLDIR)/include
455a7f32
JH
303 OPENSSL_LINK = -L$(OPENSSLDIR)/lib -R$(OPENSSLDIR)/lib
304 else
305 OPENSSL_LINK =
306 endif
dd53c7ab 307else
12aa7456 308 ALL_CFLAGS += -DNO_OPENSSL
215a7ad1
JH
309 MOZILLA_SHA1 = 1
310 OPENSSL_LIBSSL =
dd53c7ab 311endif
597c9cc5 312ifdef NEEDS_SSL_WITH_CRYPTO
455a7f32 313 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl
597c9cc5 314else
455a7f32 315 LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
597c9cc5
JH
316endif
317ifdef NEEDS_LIBICONV
455a7f32
JH
318 ifdef ICONVDIR
319 # Again this may be problematic -- gcc does not always want -R.
12aa7456 320 ALL_CFLAGS += -I$(ICONVDIR)/include
455a7f32
JH
321 ICONV_LINK = -L$(ICONVDIR)/lib -R$(ICONVDIR)/lib
322 else
323 ICONV_LINK =
324 endif
325 LIB_4_ICONV = $(ICONV_LINK) -liconv
597c9cc5
JH
326else
327 LIB_4_ICONV =
328endif
f0ebff0d
PM
329ifdef NEEDS_SOCKET
330 LIBS += -lsocket
331 SIMPLE_LIB += -lsocket
332endif
5a90d4ac
JH
333ifdef NEEDS_NSL
334 LIBS += -lnsl
335 SIMPLE_LIB += -lnsl
336endif
ef34af24 337ifdef NO_STRCASESTR
4050c0df 338 COMPAT_CFLAGS += -DNO_STRCASESTR
e40b61fb
JR
339 COMPAT_OBJS += compat/strcasestr.o
340endif
341ifdef NO_SETENV
4050c0df 342 COMPAT_CFLAGS += -DNO_SETENV
e40b61fb 343 COMPAT_OBJS += compat/setenv.o
ef34af24 344endif
730d48a2 345ifdef NO_MMAP
4050c0df 346 COMPAT_CFLAGS += -DNO_MMAP
e40b61fb 347 COMPAT_OBJS += compat/mmap.o
730d48a2 348endif
49744d63 349ifdef NO_IPV6
bdc37f5a
JH
350 ALL_CFLAGS += -DNO_IPV6
351endif
352ifdef NO_SOCKADDR_STORAGE
353ifdef NO_IPV6
354 ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in
355else
356 ALL_CFLAGS += -Dsockaddr_storage=sockaddr_in6
357endif
49744d63 358endif
cef661fc 359
7c6ef2f2
NP
360ifdef PPC_SHA1
361 SHA1_HEADER = "ppc/sha1.h"
362 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
363else
364ifdef ARM_SHA1
365 SHA1_HEADER = "arm/sha1.h"
366 LIB_OBJS += arm/sha1.o arm/sha1_arm.o
367else
368ifdef MOZILLA_SHA1
369 SHA1_HEADER = "mozilla-sha1/sha1.h"
370 LIB_OBJS += mozilla-sha1/sha1.o
371else
372 SHA1_HEADER = <openssl/sha.h>
373 LIBS += $(LIB_4_CRYPTO)
374endif
375endif
376endif
377
e40b61fb
JR
378ALL_CFLAGS += -DSHA1_HEADER=$(call shellquote,$(SHA1_HEADER)) $(COMPAT_CFLAGS)
379LIB_OBJS += $(COMPAT_OBJS)
ec2d1511 380export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
28818ffa
PB
381### Build rules
382
b42934d6 383all: $(ALL_PROGRAMS) git$X gitk
89967023 384
d3af621b
JH
385all:
386 $(MAKE) -C templates
b05701c5 387
4dc00021
JH
388strip: $(PROGRAMS) git$X
389 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
390
9b88fcef 391git$X: git.c $(LIB_FILE)
77cb17e9 392 $(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
4050c0df 393 $(CFLAGS) $(COMPAT_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE)
6a2e50f9 394
d6ebd259 395$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
bc6146d2 396 rm -f $@
4769948a 397 sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
3ff8cbed
JH
398 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
399 $@.sh >$@
bc6146d2
JH
400 chmod +x $@
401
402$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
403 rm -f $@
4769948a 404 sed -e '1s|#!.*perl|#!$(call shq,$(PERL_PATH))|' \
3ff8cbed
JH
405 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
406 $@.perl >$@
bc6146d2
JH
407 chmod +x $@
408
720d150c
JH
409$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
410 rm -f $@
4769948a
JH
411 sed -e '1s|#!.*python|#!$(call shq,$(PYTHON_PATH))|' \
412 -e 's|@@GIT_PYTHON_PATH@@|$(call shq,$(GIT_PYTHON_DIR))|g' \
3ff8cbed
JH
413 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
414 $@.py >$@
720d150c
JH
415 chmod +x $@
416
4eba0f37
JS
417git-cherry-pick: git-revert
418 cp $< $@
419
9b88fcef
JH
420# These can record GIT_VERSION
421git$X git.spec \
422 $(patsubst %.sh,%,$(SCRIPT_SH)) \
423 $(patsubst %.perl,%,$(SCRIPT_PERL)) \
424 $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
425 : GIT-VERSION-FILE
e99fcf96 426
b05701c5
PR
427%.o: %.c
428 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
429%.o: %.S
430 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
a310d434 431
77cb17e9
MO
432exec_cmd.o: ALL_CFLAGS += -DGIT_EXEC_PATH=\"$(gitexecdir)\"
433
2f29dd52 434git-%$X: %.o $(LIB_FILE)
94d23317 435 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
623c8a14 436
2f29dd52 437git-mailinfo$X : SIMPLE_LIB += $(LIB_4_ICONV)
597c9cc5 438$(SIMPLE_PROGRAMS) : $(LIB_FILE)
2f29dd52 439$(SIMPLE_PROGRAMS) : git-%$X : %.o
94d23317
JH
440 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
441 $(LIB_FILE) $(SIMPLE_LIB)
597c9cc5 442
29508e1e
NH
443git-http-fetch$X: fetch.o http.o
444git-http-push$X: http.o
2f29dd52
PA
445git-local-fetch$X: fetch.o
446git-ssh-fetch$X: rsh.o fetch.o
447git-ssh-upload$X: rsh.o
448git-ssh-pull$X: rsh.o fetch.o
449git-ssh-push$X: rsh.o
a3df1801 450
2f29dd52 451git-http-fetch$X: LIBS += $(CURL_LIBCURL)
58e60dd2 452git-http-push$X: LIBS += $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
2f29dd52 453git-rev-list$X: LIBS += $(OPENSSL_LIBSSL)
a3df1801 454
d3af621b 455init-db.o: init-db.c
b05701c5 456 $(CC) -c $(ALL_CFLAGS) \
4769948a 457 -DDEFAULT_GIT_TEMPLATE_DIR=$(call shellquote,"$(template_dir)") $*.c
d3af621b 458
e468305a 459$(LIB_OBJS): $(LIB_H)
2f29dd52 460$(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H)
e468305a 461$(DIFF_OBJS): diffcore.h
e83c5163 462
28818ffa
PB
463$(LIB_FILE): $(LIB_OBJS)
464 $(AR) rcs $@ $(LIB_OBJS)
465
466doc:
467 $(MAKE) -C Documentation all
468
469
28818ffa
PB
470### Testing rules
471
472test: all
473 $(MAKE) -C t/ all
474
4ccafd7a 475test-date$X: test-date.c date.o ctype.o
94d23317 476 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o
28818ffa 477
2f29dd52 478test-delta$X: test-delta.c diff-delta.o patch-delta.o
94d23317 479 $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^
28818ffa
PB
480
481check:
773b6339 482 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
28818ffa
PB
483
484
485
486### Installation rules
487
d6ebd259 488install: all
4769948a 489 $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
77cb17e9 490 $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(gitexecdir))
b42934d6
JH
491 $(INSTALL) $(ALL_PROGRAMS) $(call shellquote,$(DESTDIR)$(gitexecdir))
492 $(INSTALL) git$X gitk $(call shellquote,$(DESTDIR)$(bindir))
8d5afef0 493 $(MAKE) -C templates install
4769948a
JH
494 $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
495 $(INSTALL) $(PYMODULES) $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
28818ffa
PB
496
497install-doc:
498 $(MAKE) -C Documentation install
499
500
501
502
503### Maintainer's dist rules
504
9b88fcef 505git.spec: git.spec.in
a9db2974
CW
506 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
507
27dedf0c
JH
508GIT_TARNAME=git-$(GIT_VERSION)
509dist: git.spec git-tar-tree
b1de9de2 510 ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
a9db2974 511 @mkdir -p $(GIT_TARNAME)
27dedf0c 512 @cp git.spec $(GIT_TARNAME)
181129d2
PA
513 @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
514 $(TAR) rf $(GIT_TARNAME).tar \
515 $(GIT_TARNAME)/git.spec $(GIT_TARNAME)/version
a9db2974 516 @rm -rf $(GIT_TARNAME)
9dce3c06 517 gzip -f -9 $(GIT_TARNAME).tar
a9db2974
CW
518
519rpm: dist
27dedf0c 520 $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
a9db2974 521
28818ffa 522### Cleaning rules
87a81c83 523
e83c5163 524clean:
9ce392f4 525 rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o $(LIB_FILE)
b42934d6 526 rm -f $(ALL_PROGRAMS) git$X
d89056c2 527 rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo
f29eaed1 528 rm -rf $(GIT_TARNAME)
5a571cdd 529 rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
ca67f002 530 $(MAKE) -C Documentation/ clean
229a7ed7 531 $(MAKE) -C templates clean
4b7581f0 532 $(MAKE) -C t/ clean
9b88fcef
JH
533 rm -f GIT-VERSION-FILE
534
4dc00021 535.PHONY: all install clean strip
9b88fcef 536.PHONY: .FORCE-GIT-VERSION-FILE
d89056c2 537