]>
Commit | Line | Data |
---|---|---|
2731d048 JH |
1 | # The default target of this Makefile is... |
2 | all: | |
3 | ||
765ac8ec LT |
4 | # Define NO_OPENSSL environment variable if you do not have OpenSSL. |
5 | # This also implies MOZILLA_SHA1. | |
2cb45e95 | 6 | # |
58e60dd2 NH |
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:// | |
9 | # transports. | |
b2c0bd65 | 10 | # |
6d9bbc50 PM |
11 | # Define CURLDIR=/foo/bar if your curl header and library files are in |
12 | # /foo/bar/include and /foo/bar/lib directories. | |
13 | # | |
58e60dd2 NH |
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. | |
16 | # | |
35a730f0 JH |
17 | # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. |
18 | # | |
63be37b0 JH |
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). | |
21 | # | |
579d1fbf RJ |
22 | # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) |
23 | # do not support the 'size specifiers' introduced by C99, namely ll, hh, | |
24 | # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t). | |
465e649d | 25 | # some C compilers supported these specifiers prior to C99 as an extension. |
579d1fbf | 26 | # |
ef34af24 LT |
27 | # Define NO_STRCASESTR if you don't have strcasestr. |
28 | # | |
817151e6 PE |
29 | # Define NO_STRLCPY if you don't have strlcpy. |
30 | # | |
e40b61fb JR |
31 | # Define NO_SETENV if you don't have setenv in the C library. |
32 | # | |
9f0bb90d JH |
33 | # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. |
34 | # Enable it on Windows. By default, symrefs are still used. | |
2fabd217 | 35 | # |
02853588 | 36 | # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability |
60d02ccc EW |
37 | # tests. These tests take up a significant amount of the total test time |
38 | # but are not needed unless you plan to talk to SVN repos. | |
39 | # | |
8eb38cad SP |
40 | # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink |
41 | # installed in /sw, but don't want GIT to link against any libraries | |
42 | # installed there. If defined you may specify your own (or Fink's) | |
43 | # include directories and library directories by defining CFLAGS | |
44 | # and LDFLAGS appropriately. | |
45 | # | |
46 | # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X, | |
47 | # have DarwinPorts installed in /opt/local, but don't want GIT to | |
48 | # link against any libraries installed there. If defined you may | |
49 | # specify your own (or DarwinPort's) include directories and | |
50 | # library directories by defining CFLAGS and LDFLAGS appropriately. | |
51 | # | |
5bdac8b3 PB |
52 | # Define PPC_SHA1 environment variable when running make to make use of |
53 | # a bundled SHA1 routine optimized for PowerPC. | |
597c9cc5 | 54 | # |
7c6ef2f2 NP |
55 | # Define ARM_SHA1 environment variable when running make to make use of |
56 | # a bundled SHA1 routine optimized for ARM. | |
57 | # | |
f6af75d2 JH |
58 | # Define MOZILLA_SHA1 environment variable when running make to make use of |
59 | # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast | |
60 | # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default | |
61 | # choice) has very fast version optimized for i586. | |
62 | # | |
597c9cc5 | 63 | # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin). |
f0ebff0d | 64 | # |
597c9cc5 | 65 | # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin). |
f0ebff0d PM |
66 | # |
67 | # Define NEEDS_SOCKET if linking with libc is not enough (SunOS, | |
68 | # Patrick Mauritz). | |
69 | # | |
730d48a2 JS |
70 | # Define NO_MMAP if you want to avoid mmap. |
71 | # | |
343d35c9 JH |
72 | # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3. |
73 | # | |
49744d63 PA |
74 | # Define NO_IPV6 if you lack IPv6 support and getaddrinfo(). |
75 | # | |
bdc37f5a JH |
76 | # Define NO_SOCKADDR_STORAGE if your platform does not have struct |
77 | # sockaddr_storage. | |
78 | # | |
b6e56eca FP |
79 | # Define NO_ICONV if your libc does not properly support iconv. |
80 | # | |
5b5d4d9e JS |
81 | # Define NO_ACCURATE_DIFF if your diff program at least sometimes misses |
82 | # a missing newline at the end of the file. | |
83 | # | |
5bdac8b3 PB |
84 | # Define COLLISION_CHECK below if you believe that SHA1's |
85 | # 1461501637330902918203684832716283019655932542976 hashes do not give you | |
86 | # sufficient guarantee that no collisions between objects will ever happen. | |
f6af75d2 | 87 | # |
5bdac8b3 PB |
88 | # Define USE_NSEC below if you want git to care about sub-second file mtimes |
89 | # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and | |
90 | # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely | |
91 | # randomly break unless your underlying filesystem supports those sub-second | |
92 | # times (my ext3 doesn't). | |
f6af75d2 | 93 | # |
5bdac8b3 PB |
94 | # Define USE_STDEV below if you want git to care about the underlying device |
95 | # change being considered an inode change from the update-cache perspective. | |
96 | ||
9b88fcef | 97 | GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE |
36546385 | 98 | @$(SHELL_PATH) ./GIT-VERSION-GEN |
9b88fcef | 99 | -include GIT-VERSION-FILE |
a9db2974 | 100 | |
e15f5451 PJ |
101 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
102 | uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') | |
103 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') | |
104 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') | |
105 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | |
106 | ||
94d23317 | 107 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
12aa7456 | 108 | |
b05701c5 | 109 | CFLAGS = -g -O2 -Wall |
94d23317 | 110 | LDFLAGS = |
12aa7456 | 111 | ALL_CFLAGS = $(CFLAGS) |
94d23317 | 112 | ALL_LDFLAGS = $(LDFLAGS) |
4dc00021 | 113 | STRIP ?= strip |
29c2cce4 | 114 | |
b05701c5 PR |
115 | prefix = $(HOME) |
116 | bindir = $(prefix)/bin | |
e15f5451 | 117 | gitexecdir = $(bindir) |
b05701c5 | 118 | template_dir = $(prefix)/share/git-core/templates/ |
720d150c | 119 | GIT_PYTHON_DIR = $(prefix)/share/git-core/python |
a682ef9f | 120 | # DESTDIR= |
5c2a7fbc | 121 | |
5d043a3d | 122 | # default configuration for gitweb |
c8d138a8 | 123 | GITWEB_CONFIG = gitweb_config.perl |
2de21fac | 124 | GITWEB_HOME_LINK_STR = projects |
5d043a3d MW |
125 | GITWEB_SITENAME = |
126 | GITWEB_PROJECTROOT = /pub/git | |
32f4aacc ML |
127 | GITWEB_EXPORT_OK = |
128 | GITWEB_STRICT_EXPORT = | |
19a8721e | 129 | GITWEB_BASE_URL = |
5d043a3d MW |
130 | GITWEB_LIST = |
131 | GITWEB_HOMETEXT = indextext.html | |
132 | GITWEB_CSS = gitweb.css | |
281f2f6b | 133 | GITWEB_LOGO = git-logo.png |
0b5deba1 | 134 | GITWEB_FAVICON = git-favicon.png |
b2d3476e AC |
135 | GITWEB_SITE_HEADER = |
136 | GITWEB_SITE_FOOTER = | |
5d043a3d | 137 | |
e14421b9 JN |
138 | export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR |
139 | ||
b05701c5 PR |
140 | CC = gcc |
141 | AR = ar | |
229a7ed7 | 142 | TAR = tar |
b05701c5 PR |
143 | INSTALL = install |
144 | RPMBUILD = rpmbuild | |
e83c5163 | 145 | |
44c9e859 LT |
146 | # sparse is architecture-neutral, which means that we need to tell it |
147 | # explicitly what architecture to check for. Fix this up for yours.. | |
b05701c5 | 148 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
44c9e859 | 149 | |
28818ffa PB |
150 | |
151 | ||
152 | ### --- END CONFIGURATION SECTION --- | |
153 | ||
8d7f586f | 154 | # Those must not be GNU-specific; they are shared with perl/ which may |
18b0fc1c PB |
155 | # be built by a different compiler. (Note that this is an artifact now |
156 | # but it still might be nice to keep that distinction.) | |
157 | BASIC_CFLAGS = | |
158 | BASIC_LDFLAGS = | |
8d7f586f | 159 | |
215a7ad1 | 160 | SCRIPT_SH = \ |
c31820c2 | 161 | git-bisect.sh git-checkout.sh \ |
e827633a | 162 | git-clean.sh git-clone.sh git-commit.sh \ |
230f544e | 163 | git-fetch.sh \ |
68563738 | 164 | git-ls-remote.sh \ |
e32faa8a | 165 | git-merge-one-file.sh git-parse-remote.sh \ |
ba84a797 | 166 | git-pull.sh git-rebase.sh \ |
215a7ad1 | 167 | git-repack.sh git-request-pull.sh git-reset.sh \ |
d9b814cc | 168 | git-resolve.sh git-revert.sh git-sh-setup.sh \ |
7b763f7c | 169 | git-tag.sh git-verify-tag.sh \ |
d1c5f2a4 | 170 | git-applymbox.sh git-applypatch.sh git-am.sh \ |
2276aa6c | 171 | git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ |
63dffdf0 | 172 | git-merge-resolve.sh git-merge-ours.sh \ |
d3d8f361 | 173 | git-lost-found.sh git-quiltimport.sh |
215a7ad1 JH |
174 | |
175 | SCRIPT_PERL = \ | |
176 | git-archimport.perl git-cvsimport.perl git-relink.perl \ | |
00449f99 | 177 | git-shortlog.perl git-rerere.perl \ |
f789e347 | 178 | git-cvsserver.perl \ |
11be42a4 | 179 | git-svnimport.perl git-cvsexportcommit.perl \ |
60d02ccc | 180 | git-send-email.perl git-svn.perl |
60036a41 | 181 | |
720d150c | 182 | SCRIPT_PYTHON = \ |
a06f678e | 183 | git-merge-recursive-old.py |
720d150c | 184 | |
d6ebd259 AE |
185 | SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ |
186 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ | |
187 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ | |
a51d37c1 | 188 | git-cherry-pick git-status git-instaweb |
d6ebd259 | 189 | |
b42934d6 | 190 | # ... and all the rest that could be moved out of bindir to gitexecdir |
215a7ad1 | 191 | PROGRAMS = \ |
e8cc9cd9 | 192 | git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \ |
c3c8835f | 193 | git-hash-object$X git-index-pack$X git-local-fetch$X \ |
34488e3c | 194 | git-merge-base$X \ |
af8ffbed | 195 | git-daemon$X \ |
5d4a6003 | 196 | git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \ |
53bb2c00 | 197 | git-peek-remote$X git-receive-pack$X \ |
51ce34b9 | 198 | git-send-pack$X git-shell$X \ |
79a9d8ea | 199 | git-show-index$X git-ssh-fetch$X \ |
56d1398a | 200 | git-ssh-upload$X git-unpack-file$X \ |
64413630 | 201 | git-update-server-info$X \ |
8ed05fb5 | 202 | git-upload-pack$X git-verify-pack$X \ |
d6b64ed0 | 203 | git-pack-redundant$X git-var$X \ |
42f77406 | 204 | git-describe$X git-merge-tree$X git-blame$X git-imap-send$X \ |
a06f678e | 205 | git-merge-recursive$X \ |
42f77406 JH |
206 | $(EXTRA_PROGRAMS) |
207 | ||
208 | # Empty... | |
209 | EXTRA_PROGRAMS = | |
d6ebd259 | 210 | |
e414156a | 211 | BUILT_INS = \ |
e827633a | 212 | git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \ |
f754fa9c JH |
213 | git-get-tar-commit-id$X \ |
214 | $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS)) | |
91730800 | 215 | |
b42934d6 | 216 | # what 'all' will build and 'install' will install, in gitexecdir |
af8ffbed | 217 | ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) \ |
7c2738ce | 218 | git-merge-recur$X |
e83c5163 | 219 | |
894a8a8b | 220 | # Backward compatibility -- to be removed after 1.0 |
2f29dd52 | 221 | PROGRAMS += git-ssh-pull$X git-ssh-push$X |
f71a69ab | 222 | |
3d32051f RA |
223 | # Set paths to tools early so that they can be used for version tests. |
224 | ifndef SHELL_PATH | |
225 | SHELL_PATH = /bin/sh | |
226 | endif | |
227 | ifndef PERL_PATH | |
228 | PERL_PATH = /usr/bin/perl | |
229 | endif | |
230 | ifndef PYTHON_PATH | |
231 | PYTHON_PATH = /usr/bin/python | |
232 | endif | |
233 | ||
720d150c JH |
234 | PYMODULES = \ |
235 | gitMergeCommon.py | |
236 | ||
0a02ce72 | 237 | LIB_FILE=libgit.a |
3443546f | 238 | XDIFF_LIB=xdiff/lib.a |
8f3f9b09 | 239 | |
215a7ad1 | 240 | LIB_H = \ |
83b5d2f5 | 241 | archive.h blob.h cache.h commit.h csum-file.h delta.h grep.h \ |
4405fb77 | 242 | diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \ |
1b0c7174 | 243 | run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \ |
eb454156 | 244 | tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h |
b1bf95bb | 245 | |
215a7ad1 | 246 | DIFF_OBJS = \ |
6973dcae | 247 | diff.o diff-lib.o diffcore-break.o diffcore-order.o \ |
65416758 | 248 | diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \ |
5f1c3f07 | 249 | diffcore-delta.o log-tree.o |
d1df5743 | 250 | |
215a7ad1 | 251 | LIB_OBJS = \ |
283c8eef | 252 | blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \ |
49ba83fb JL |
253 | date.o diff-delta.o entry.o exec_cmd.o ident.o \ |
254 | interpolate.o \ | |
255 | lockfile.o \ | |
49a52b1d | 256 | object.o pack-check.o patch-delta.o path.o pkt-line.o sideband.o \ |
3e4339e6 | 257 | quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \ |
215a7ad1 | 258 | server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \ |
f3123c4a | 259 | tag.o tree.o usage.o config.o environment.o ctype.o copy.o \ |
d9ea73e0 | 260 | fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \ |
83b5d2f5 | 261 | write_or_die.o trace.o list-objects.o grep.o \ |
7c92fe0e | 262 | alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \ |
3d74982f | 263 | color.o wt-status.o archive-zip.o archive-tar.o |
d19938ab | 264 | |
70827b15 | 265 | BUILTIN_OBJS = \ |
f754fa9c | 266 | builtin-add.o \ |
f789e347 | 267 | builtin-annotate.o \ |
f754fa9c | 268 | builtin-apply.o \ |
4df096a5 | 269 | builtin-archive.o \ |
c31820c2 | 270 | builtin-branch.o \ |
f754fa9c | 271 | builtin-cat-file.o \ |
e414156a | 272 | builtin-checkout-index.o \ |
f754fa9c JH |
273 | builtin-check-ref-format.o \ |
274 | builtin-commit-tree.o \ | |
275 | builtin-count-objects.o \ | |
276 | builtin-diff.o \ | |
277 | builtin-diff-files.o \ | |
278 | builtin-diff-index.o \ | |
279 | builtin-diff-stages.o \ | |
280 | builtin-diff-tree.o \ | |
281 | builtin-fmt-merge-msg.o \ | |
9f613ddd | 282 | builtin-for-each-ref.o \ |
f754fa9c JH |
283 | builtin-grep.o \ |
284 | builtin-init-db.o \ | |
285 | builtin-log.o \ | |
286 | builtin-ls-files.o \ | |
287 | builtin-ls-tree.o \ | |
288 | builtin-mailinfo.o \ | |
289 | builtin-mailsplit.o \ | |
290 | builtin-mv.o \ | |
291 | builtin-name-rev.o \ | |
292 | builtin-pack-objects.o \ | |
293 | builtin-prune.o \ | |
294 | builtin-prune-packed.o \ | |
295 | builtin-push.o \ | |
296 | builtin-read-tree.o \ | |
297 | builtin-repo-config.o \ | |
298 | builtin-rev-list.o \ | |
299 | builtin-rev-parse.o \ | |
300 | builtin-rm.o \ | |
c91f0d92 | 301 | builtin-runstatus.o \ |
f754fa9c JH |
302 | builtin-show-branch.o \ |
303 | builtin-stripspace.o \ | |
304 | builtin-symbolic-ref.o \ | |
305 | builtin-tar-tree.o \ | |
306 | builtin-unpack-objects.o \ | |
307 | builtin-update-index.o \ | |
308 | builtin-update-ref.o \ | |
39345a21 | 309 | builtin-upload-archive.o \ |
2e3ed670 | 310 | builtin-verify-pack.o \ |
e4fbbfe9 | 311 | builtin-write-tree.o \ |
eaf12a8c | 312 | builtin-show-ref.o \ |
e1e22e37 | 313 | builtin-pack-refs.o |
70827b15 | 314 | |
54c261f9 | 315 | GITLIBS = $(LIB_FILE) $(XDIFF_LIB) |
d595a473 | 316 | EXTLIBS = -lz |
cef661fc | 317 | |
229a7ed7 JH |
318 | # |
319 | # Platform specific tweaks | |
320 | # | |
f7c15343 JH |
321 | |
322 | # We choose to avoid "if .. else if .. else .. endif endif" | |
323 | # because maintaining the nesting to match is a pain. If | |
324 | # we had "elif" things would have been much nicer... | |
f7c15343 | 325 | |
817151e6 PE |
326 | ifeq ($(uname_S),Linux) |
327 | NO_STRLCPY = YesPlease | |
328 | endif | |
ca7a7416 GP |
329 | ifeq ($(uname_S),GNU/kFreeBSD) |
330 | NO_STRLCPY = YesPlease | |
331 | endif | |
f7c15343 | 332 | ifeq ($(uname_S),Darwin) |
597c9cc5 JH |
333 | NEEDS_SSL_WITH_CRYPTO = YesPlease |
334 | NEEDS_LIBICONV = YesPlease | |
817151e6 | 335 | NO_STRLCPY = YesPlease |
8eb38cad SP |
336 | ifndef NO_FINK |
337 | ifeq ($(shell test -d /sw/lib && echo y),y) | |
9673198e JH |
338 | BASIC_CFLAGS += -I/sw/include |
339 | BASIC_LDFLAGS += -L/sw/lib | |
8eb38cad | 340 | endif |
e3601e8b | 341 | endif |
8eb38cad SP |
342 | ifndef NO_DARWIN_PORTS |
343 | ifeq ($(shell test -d /opt/local/lib && echo y),y) | |
9673198e JH |
344 | BASIC_CFLAGS += -I/opt/local/include |
345 | BASIC_LDFLAGS += -L/opt/local/lib | |
8eb38cad | 346 | endif |
e3601e8b | 347 | endif |
597c9cc5 | 348 | endif |
f7c15343 | 349 | ifeq ($(uname_S),SunOS) |
f0ebff0d | 350 | NEEDS_SOCKET = YesPlease |
5a90d4ac | 351 | NEEDS_NSL = YesPlease |
229a7ed7 JH |
352 | SHELL_PATH = /bin/bash |
353 | NO_STRCASESTR = YesPlease | |
e40b61fb | 354 | ifeq ($(uname_R),5.8) |
e15f5451 | 355 | NEEDS_LIBICONV = YesPlease |
731043fd | 356 | NO_UNSETENV = YesPlease |
e40b61fb | 357 | NO_SETENV = YesPlease |
66c4509b | 358 | NO_C99_FORMAT = YesPlease |
e40b61fb | 359 | endif |
40d88d4f DS |
360 | ifeq ($(uname_R),5.9) |
361 | NO_UNSETENV = YesPlease | |
362 | NO_SETENV = YesPlease | |
66c4509b | 363 | NO_C99_FORMAT = YesPlease |
40d88d4f | 364 | endif |
229a7ed7 JH |
365 | INSTALL = ginstall |
366 | TAR = gtar | |
8d7f586f | 367 | BASIC_CFLAGS += -D__EXTENSIONS__ |
f0ebff0d | 368 | endif |
f7c15343 | 369 | ifeq ($(uname_O),Cygwin) |
63be37b0 | 370 | NO_D_TYPE_IN_DIRENT = YesPlease |
35a730f0 | 371 | NO_D_INO_IN_DIRENT = YesPlease |
17754517 | 372 | NO_STRCASESTR = YesPlease |
9f0bb90d | 373 | NO_SYMLINK_HEAD = YesPlease |
17754517 | 374 | NEEDS_LIBICONV = YesPlease |
70b9c596 | 375 | NO_C99_FORMAT = YesPlease |
2e67a5f4 JH |
376 | # There are conflicting reports about this. |
377 | # On some boxes NO_MMAP is needed, and not so elsewhere. | |
378 | # Try uncommenting this if you see things break -- YMMV. | |
379 | # NO_MMAP = YesPlease | |
49744d63 | 380 | NO_IPV6 = YesPlease |
a23cd8ec | 381 | X = .exe |
7c6ef2f2 | 382 | endif |
b3bf974c AK |
383 | ifeq ($(uname_S),FreeBSD) |
384 | NEEDS_LIBICONV = YesPlease | |
8d7f586f PB |
385 | BASIC_CFLAGS += -I/usr/local/include |
386 | BASIC_LDFLAGS += -L/usr/local/lib | |
b3bf974c | 387 | endif |
f7c15343 | 388 | ifeq ($(uname_S),OpenBSD) |
5fb41e8a | 389 | NO_STRCASESTR = YesPlease |
18c5a525 | 390 | NEEDS_LIBICONV = YesPlease |
8d7f586f PB |
391 | BASIC_CFLAGS += -I/usr/local/include |
392 | BASIC_LDFLAGS += -L/usr/local/lib | |
94d23317 JH |
393 | endif |
394 | ifeq ($(uname_S),NetBSD) | |
e88856b4 DS |
395 | ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) |
396 | NEEDS_LIBICONV = YesPlease | |
397 | endif | |
8d7f586f PB |
398 | BASIC_CFLAGS += -I/usr/pkg/include |
399 | BASIC_LDFLAGS += -L/usr/pkg/lib | |
400 | ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib | |
18c5a525 | 401 | endif |
a6da9395 JR |
402 | ifeq ($(uname_S),AIX) |
403 | NO_STRCASESTR=YesPlease | |
817151e6 | 404 | NO_STRLCPY = YesPlease |
a6da9395 JR |
405 | NEEDS_LIBICONV=YesPlease |
406 | endif | |
289c4b36 JS |
407 | ifeq ($(uname_S),IRIX64) |
408 | NO_IPV6=YesPlease | |
409 | NO_SETENV=YesPlease | |
410 | NO_STRCASESTR=YesPlease | |
817151e6 | 411 | NO_STRLCPY = YesPlease |
289c4b36 JS |
412 | NO_SOCKADDR_STORAGE=YesPlease |
413 | SHELL_PATH=/usr/gnu/bin/bash | |
8d7f586f | 414 | BASIC_CFLAGS += -DPATH_MAX=1024 |
289c4b36 | 415 | # for now, build 32-bit version |
8d7f586f | 416 | BASIC_LDFLAGS += -L/usr/lib32 |
289c4b36 | 417 | endif |
f7c15343 JH |
418 | ifneq (,$(findstring arm,$(uname_M))) |
419 | ARM_SHA1 = YesPlease | |
420 | endif | |
597c9cc5 | 421 | |
55667714 | 422 | -include config.mak.autogen |
f2d6a256 | 423 | -include config.mak |
597c9cc5 | 424 | |
b34403aa TH |
425 | ifdef WITH_OWN_SUBPROCESS_PY |
426 | PYMODULES += compat/subprocess.py | |
427 | else | |
a348ab70 JS |
428 | ifeq ($(NO_PYTHON),) |
429 | ifneq ($(shell $(PYTHON_PATH) -c 'import subprocess;print"OK"' 2>/dev/null),OK) | |
430 | PYMODULES += compat/subprocess.py | |
431 | endif | |
b34403aa TH |
432 | endif |
433 | endif | |
434 | ||
229a7ed7 JH |
435 | ifndef NO_CURL |
436 | ifdef CURLDIR | |
94d23317 | 437 | # This is still problematic -- gcc does not always want -R. |
8d7f586f | 438 | BASIC_CFLAGS += -I$(CURLDIR)/include |
229a7ed7 JH |
439 | CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl |
440 | else | |
441 | CURL_LIBCURL = -lcurl | |
442 | endif | |
2f29dd52 | 443 | PROGRAMS += git-http-fetch$X |
08900987 NH |
444 | curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p) |
445 | ifeq "$(curl_check)" "070908" | |
446 | ifndef NO_EXPAT | |
08900987 NH |
447 | PROGRAMS += git-http-push$X |
448 | endif | |
58e60dd2 | 449 | endif |
459a21bd JS |
450 | ifndef NO_EXPAT |
451 | EXPAT_LIBEXPAT = -lexpat | |
452 | endif | |
229a7ed7 JH |
453 | endif |
454 | ||
dd53c7ab | 455 | ifndef NO_OPENSSL |
215a7ad1 | 456 | OPENSSL_LIBSSL = -lssl |
455a7f32 JH |
457 | ifdef OPENSSLDIR |
458 | # Again this may be problematic -- gcc does not always want -R. | |
8d7f586f | 459 | BASIC_CFLAGS += -I$(OPENSSLDIR)/include |
455a7f32 JH |
460 | OPENSSL_LINK = -L$(OPENSSLDIR)/lib -R$(OPENSSLDIR)/lib |
461 | else | |
462 | OPENSSL_LINK = | |
463 | endif | |
dd53c7ab | 464 | else |
8d7f586f | 465 | BASIC_CFLAGS += -DNO_OPENSSL |
215a7ad1 JH |
466 | MOZILLA_SHA1 = 1 |
467 | OPENSSL_LIBSSL = | |
dd53c7ab | 468 | endif |
597c9cc5 | 469 | ifdef NEEDS_SSL_WITH_CRYPTO |
455a7f32 | 470 | LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl |
597c9cc5 | 471 | else |
455a7f32 | 472 | LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto |
597c9cc5 JH |
473 | endif |
474 | ifdef NEEDS_LIBICONV | |
455a7f32 JH |
475 | ifdef ICONVDIR |
476 | # Again this may be problematic -- gcc does not always want -R. | |
8d7f586f | 477 | BASIC_CFLAGS += -I$(ICONVDIR)/include |
455a7f32 JH |
478 | ICONV_LINK = -L$(ICONVDIR)/lib -R$(ICONVDIR)/lib |
479 | else | |
480 | ICONV_LINK = | |
481 | endif | |
d595a473 | 482 | EXTLIBS += $(ICONV_LINK) -liconv |
597c9cc5 | 483 | endif |
f0ebff0d | 484 | ifdef NEEDS_SOCKET |
d595a473 | 485 | EXTLIBS += -lsocket |
f0ebff0d | 486 | endif |
5a90d4ac | 487 | ifdef NEEDS_NSL |
d595a473 | 488 | EXTLIBS += -lnsl |
5a90d4ac | 489 | endif |
63be37b0 | 490 | ifdef NO_D_TYPE_IN_DIRENT |
8d7f586f | 491 | BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT |
63be37b0 | 492 | endif |
35a730f0 | 493 | ifdef NO_D_INO_IN_DIRENT |
8d7f586f | 494 | BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT |
35a730f0 | 495 | endif |
579d1fbf RJ |
496 | ifdef NO_C99_FORMAT |
497 | ALL_CFLAGS += -DNO_C99_FORMAT | |
498 | endif | |
9f0bb90d | 499 | ifdef NO_SYMLINK_HEAD |
8d7f586f | 500 | BASIC_CFLAGS += -DNO_SYMLINK_HEAD |
9f0bb90d | 501 | endif |
ef34af24 | 502 | ifdef NO_STRCASESTR |
4050c0df | 503 | COMPAT_CFLAGS += -DNO_STRCASESTR |
e40b61fb JR |
504 | COMPAT_OBJS += compat/strcasestr.o |
505 | endif | |
817151e6 PE |
506 | ifdef NO_STRLCPY |
507 | COMPAT_CFLAGS += -DNO_STRLCPY | |
508 | COMPAT_OBJS += compat/strlcpy.o | |
509 | endif | |
e40b61fb | 510 | ifdef NO_SETENV |
4050c0df | 511 | COMPAT_CFLAGS += -DNO_SETENV |
e40b61fb | 512 | COMPAT_OBJS += compat/setenv.o |
ef34af24 | 513 | endif |
104ff34a | 514 | ifdef NO_UNSETENV |
731043fd JR |
515 | COMPAT_CFLAGS += -DNO_UNSETENV |
516 | COMPAT_OBJS += compat/unsetenv.o | |
517 | endif | |
730d48a2 | 518 | ifdef NO_MMAP |
4050c0df | 519 | COMPAT_CFLAGS += -DNO_MMAP |
e40b61fb | 520 | COMPAT_OBJS += compat/mmap.o |
730d48a2 | 521 | endif |
49744d63 | 522 | ifdef NO_IPV6 |
8d7f586f | 523 | BASIC_CFLAGS += -DNO_IPV6 |
bdc37f5a JH |
524 | endif |
525 | ifdef NO_SOCKADDR_STORAGE | |
526 | ifdef NO_IPV6 | |
8d7f586f | 527 | BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in |
bdc37f5a | 528 | else |
8d7f586f | 529 | BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6 |
bdc37f5a | 530 | endif |
49744d63 | 531 | endif |
6ba68ab2 YL |
532 | ifdef NO_INET_NTOP |
533 | LIB_OBJS += compat/inet_ntop.o | |
534 | endif | |
dd467629 JL |
535 | ifdef NO_INET_PTON |
536 | LIB_OBJS += compat/inet_pton.o | |
537 | endif | |
cef661fc | 538 | |
b6e56eca | 539 | ifdef NO_ICONV |
8d7f586f | 540 | BASIC_CFLAGS += -DNO_ICONV |
b6e56eca FP |
541 | endif |
542 | ||
7c6ef2f2 NP |
543 | ifdef PPC_SHA1 |
544 | SHA1_HEADER = "ppc/sha1.h" | |
545 | LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o | |
546 | else | |
547 | ifdef ARM_SHA1 | |
548 | SHA1_HEADER = "arm/sha1.h" | |
549 | LIB_OBJS += arm/sha1.o arm/sha1_arm.o | |
550 | else | |
551 | ifdef MOZILLA_SHA1 | |
552 | SHA1_HEADER = "mozilla-sha1/sha1.h" | |
553 | LIB_OBJS += mozilla-sha1/sha1.o | |
554 | else | |
555 | SHA1_HEADER = <openssl/sha.h> | |
d595a473 | 556 | EXTLIBS += $(LIB_4_CRYPTO) |
7c6ef2f2 NP |
557 | endif |
558 | endif | |
559 | endif | |
5b5d4d9e | 560 | ifdef NO_ACCURATE_DIFF |
8d7f586f | 561 | BASIC_CFLAGS += -DNO_ACCURATE_DIFF |
5b5d4d9e | 562 | endif |
7c6ef2f2 | 563 | |
addf88e4 | 564 | # Shell quote (do not use $(call) to accommodate ancient setups); |
39c015c5 JS |
565 | |
566 | SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) | |
567 | ||
568 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) | |
569 | bindir_SQ = $(subst ','\'',$(bindir)) | |
570 | gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) | |
571 | template_dir_SQ = $(subst ','\'',$(template_dir)) | |
ca3bcabf | 572 | prefix_SQ = $(subst ','\'',$(prefix)) |
39c015c5 JS |
573 | |
574 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) | |
575 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) | |
576 | PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH)) | |
577 | GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR)) | |
578 | ||
d595a473 PB |
579 | LIBS = $(GITLIBS) $(EXTLIBS) |
580 | ||
8d7f586f | 581 | BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS) |
e40b61fb | 582 | LIB_OBJS += $(COMPAT_OBJS) |
8d7f586f PB |
583 | |
584 | ALL_CFLAGS += $(BASIC_CFLAGS) | |
585 | ALL_LDFLAGS += $(BASIC_LDFLAGS) | |
586 | ||
ec2d1511 | 587 | export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir |
d595a473 PB |
588 | |
589 | ||
28818ffa PB |
590 | ### Build rules |
591 | ||
7c2738ce | 592 | all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi |
89967023 | 593 | |
b1edc53d PB |
594 | all: perl/Makefile |
595 | $(MAKE) -C perl | |
d3af621b | 596 | $(MAKE) -C templates |
b05701c5 | 597 | |
4dc00021 JH |
598 | strip: $(PROGRAMS) git$X |
599 | $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X | |
600 | ||
ca3bcabf | 601 | git$X: git.c common-cmds.h $(BUILTIN_OBJS) $(GITLIBS) GIT-CFLAGS |
77cb17e9 | 602 | $(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \ |
8eef8e09 | 603 | $(ALL_CFLAGS) -o $@ $(filter %.c,$^) \ |
70827b15 | 604 | $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS) |
6a2e50f9 | 605 | |
f754fa9c | 606 | help.o: common-cmds.h |
08df6171 | 607 | |
a06f678e JH |
608 | git-merge-recur$X: git-merge-recursive$X |
609 | rm -f $@ && ln git-merge-recursive$X $@ | |
610 | ||
91730800 JH |
611 | $(BUILT_INS): git$X |
612 | rm -f $@ && ln git$X $@ | |
613 | ||
a87cd02c | 614 | common-cmds.h: Documentation/git-*.txt |
fc36f6a6 JM |
615 | ./generate-cmdlist.sh > $@+ |
616 | mv $@+ $@ | |
a87cd02c | 617 | |
d6ebd259 | 618 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
fc36f6a6 | 619 | rm -f $@ $@+ |
39c015c5 | 620 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ |
d9bffc08 | 621 | -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ |
3ff8cbed | 622 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ |
6c5c62f3 | 623 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ |
abb7c7b3 | 624 | -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \ |
fc36f6a6 JM |
625 | $@.sh >$@+ |
626 | chmod +x $@+ | |
627 | mv $@+ $@ | |
bc6146d2 | 628 | |
f6276fe1 JH |
629 | $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile |
630 | $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl | |
fc36f6a6 | 631 | rm -f $@ $@+ |
893973a6 | 632 | INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \ |
998c4daa JH |
633 | sed -e '1{' \ |
634 | -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ | |
635 | -e ' h' \ | |
636 | -e ' s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \ | |
637 | -e ' H' \ | |
638 | -e ' x' \ | |
639 | -e '}' \ | |
f6276fe1 | 640 | -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \ |
3ff8cbed | 641 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ |
fc36f6a6 JM |
642 | $@.perl >$@+ |
643 | chmod +x $@+ | |
644 | mv $@+ $@ | |
bc6146d2 | 645 | |
ca3bcabf | 646 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py GIT-CFLAGS |
fc36f6a6 | 647 | rm -f $@ $@+ |
39c015c5 JS |
648 | sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \ |
649 | -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR_SQ)|g' \ | |
3ff8cbed | 650 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ |
fc36f6a6 JM |
651 | $@.py >$@+ |
652 | chmod +x $@+ | |
653 | mv $@+ $@ | |
720d150c | 654 | |
4eba0f37 | 655 | git-cherry-pick: git-revert |
fc36f6a6 JM |
656 | cp $< $@+ |
657 | mv $@+ $@ | |
4eba0f37 | 658 | |
cf7bb589 | 659 | git-status: git-commit |
fc36f6a6 JM |
660 | cp $< $@+ |
661 | mv $@+ $@ | |
cf7bb589 | 662 | |
5d043a3d MW |
663 | gitweb/gitweb.cgi: gitweb/gitweb.perl |
664 | rm -f $@ $@+ | |
665 | sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ | |
06c084d2 JH |
666 | -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ |
667 | -e 's|++GIT_BINDIR++|$(bindir)|g' \ | |
668 | -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ | |
2de21fac | 669 | -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ |
06c084d2 JH |
670 | -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ |
671 | -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ | |
32f4aacc ML |
672 | -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ |
673 | -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ | |
19a8721e | 674 | -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ |
06c084d2 JH |
675 | -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \ |
676 | -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \ | |
677 | -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \ | |
678 | -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \ | |
0b5deba1 | 679 | -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ |
b2d3476e AC |
680 | -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ |
681 | -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ | |
5d043a3d MW |
682 | $< >$@+ |
683 | chmod +x $@+ | |
684 | mv $@+ $@ | |
685 | ||
a51d37c1 EW |
686 | git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css |
687 | rm -f $@ $@+ | |
688 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ | |
689 | -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ | |
690 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ | |
691 | -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \ | |
6e959ab0 | 692 | -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \ |
07002287 | 693 | -e '/@@GITWEB_CGI@@/d' \ |
6e959ab0 | 694 | -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \ |
07002287 | 695 | -e '/@@GITWEB_CSS@@/d' \ |
5d043a3d | 696 | $@.sh > $@+ |
a51d37c1 EW |
697 | chmod +x $@+ |
698 | mv $@+ $@ | |
699 | ||
3900145e JN |
700 | configure: configure.ac |
701 | rm -f $@ $<+ | |
702 | sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ | |
703 | $< > $<+ | |
704 | autoconf -o $@ $<+ | |
705 | rm -f $<+ | |
706 | ||
9b88fcef JH |
707 | # These can record GIT_VERSION |
708 | git$X git.spec \ | |
709 | $(patsubst %.sh,%,$(SCRIPT_SH)) \ | |
710 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ | |
711 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ | |
712 | : GIT-VERSION-FILE | |
e99fcf96 | 713 | |
ca3bcabf | 714 | %.o: %.c GIT-CFLAGS |
b05701c5 PR |
715 | $(CC) -o $*.o -c $(ALL_CFLAGS) $< |
716 | %.o: %.S | |
717 | $(CC) -o $*.o -c $(ALL_CFLAGS) $< | |
a310d434 | 718 | |
ca3bcabf | 719 | exec_cmd.o: exec_cmd.c GIT-CFLAGS |
39c015c5 | 720 | $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $< |
c1f8064b YL |
721 | builtin-init-db.o: builtin-init-db.c GIT-CFLAGS |
722 | $(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $< | |
77cb17e9 | 723 | |
ca3bcabf | 724 | http.o: http.c GIT-CFLAGS |
20fc9bc5 NH |
725 | $(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $< |
726 | ||
8d9fbe57 | 727 | ifdef NO_EXPAT |
ca3bcabf | 728 | http-fetch.o: http-fetch.c http.h GIT-CFLAGS |
8d9fbe57 NH |
729 | $(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $< |
730 | endif | |
731 | ||
8eef8e09 | 732 | git-%$X: %.o $(GITLIBS) |
94d23317 | 733 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) |
623c8a14 | 734 | |
2941cab9 JS |
735 | ssh-pull.o: ssh-fetch.c |
736 | ssh-push.o: ssh-upload.c | |
2f29dd52 PA |
737 | git-local-fetch$X: fetch.o |
738 | git-ssh-fetch$X: rsh.o fetch.o | |
739 | git-ssh-upload$X: rsh.o | |
740 | git-ssh-pull$X: rsh.o fetch.o | |
741 | git-ssh-push$X: rsh.o | |
a3df1801 | 742 | |
f2561fda MM |
743 | git-imap-send$X: imap-send.o $(LIB_FILE) |
744 | ||
dd8239f9 | 745 | http.o http-fetch.o http-push.o: http.h |
8fced61c | 746 | git-http-fetch$X: fetch.o http.o http-fetch.o $(GITLIBS) |
39c015c5 | 747 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
8d9fbe57 | 748 | $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) |
39c015c5 | 749 | |
8fced61c | 750 | git-http-push$X: revision.o http.o http-push.o $(GITLIBS) |
39c015c5 JS |
751 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ |
752 | $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) | |
753 | ||
70827b15 | 754 | $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) |
1f330269 | 755 | $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) |
e468305a | 756 | $(DIFF_OBJS): diffcore.h |
e83c5163 | 757 | |
28818ffa | 758 | $(LIB_FILE): $(LIB_OBJS) |
71459c19 | 759 | rm -f $@ && $(AR) rcs $@ $(LIB_OBJS) |
28818ffa | 760 | |
3443546f | 761 | XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o |
17b96be2 AW |
762 | $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \ |
763 | xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h | |
3443546f LT |
764 | |
765 | $(XDIFF_LIB): $(XDIFF_OBJS) | |
2d86d2c6 | 766 | rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS) |
3443546f LT |
767 | |
768 | ||
d595a473 | 769 | perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS |
63df97ae | 770 | (cd perl && $(PERL_PATH) Makefile.PL \ |
18b0fc1c | 771 | PREFIX='$(prefix_SQ)') |
b1edc53d | 772 | |
28818ffa PB |
773 | doc: |
774 | $(MAKE) -C Documentation all | |
775 | ||
f81e7c62 FK |
776 | TAGS: |
777 | rm -f TAGS | |
778 | find . -name '*.[hcS]' -print | xargs etags -a | |
779 | ||
780 | tags: | |
781 | rm -f tags | |
782 | find . -name '*.[hcS]' -print | xargs ctags -a | |
28818ffa | 783 | |
ca3bcabf | 784 | ### Detect prefix changes |
bbc932c8 | 785 | TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):$(GIT_PYTHON_DIR_SQ):\ |
ca3bcabf YL |
786 | $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) |
787 | ||
788 | GIT-CFLAGS: .FORCE-GIT-CFLAGS | |
789 | @FLAGS='$(TRACK_CFLAGS)'; \ | |
790 | if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \ | |
791 | echo 1>&2 " * new build flags or prefix"; \ | |
792 | echo "$$FLAGS" >GIT-CFLAGS; \ | |
793 | fi | |
794 | ||
28818ffa PB |
795 | ### Testing rules |
796 | ||
abb7c7b3 JS |
797 | # GNU make supports exporting all variables by "export" without parameters. |
798 | # However, the environment gets quite big, and some programs have problems | |
799 | # with that. | |
800 | ||
801 | export NO_PYTHON | |
140245b3 | 802 | export NO_SVN_TESTS |
abb7c7b3 | 803 | |
28818ffa PB |
804 | test: all |
805 | $(MAKE) -C t/ all | |
806 | ||
4ccafd7a | 807 | test-date$X: test-date.c date.o ctype.o |
94d23317 | 808 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o |
28818ffa | 809 | |
2f29dd52 | 810 | test-delta$X: test-delta.c diff-delta.o patch-delta.o |
3dc5a9e4 | 811 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^ |
28818ffa | 812 | |
17448209 JH |
813 | test-dump-cache-tree$X: dump-cache-tree.o $(GITLIBS) |
814 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) | |
815 | ||
b65bc21e JH |
816 | test-sha1$X: test-sha1.o $(GITLIBS) |
817 | $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) | |
818 | ||
819 | check-sha1:: test-sha1$X | |
820 | ./test-sha1.sh | |
821 | ||
28818ffa | 822 | check: |
773b6339 | 823 | for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done |
28818ffa PB |
824 | |
825 | ||
826 | ||
827 | ### Installation rules | |
828 | ||
d6ebd259 | 829 | install: all |
39c015c5 JS |
830 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(bindir_SQ)' |
831 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)' | |
832 | $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)' | |
833 | $(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)' | |
7ffe7098 | 834 | $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install |
b1edc53d | 835 | $(MAKE) -C perl install |
39c015c5 JS |
836 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)' |
837 | $(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)' | |
7f7e6eac SE |
838 | if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \ |
839 | then \ | |
840 | ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \ | |
841 | '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \ | |
842 | cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \ | |
843 | '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \ | |
844 | fi | |
845 | $(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;) | |
28818ffa PB |
846 | |
847 | install-doc: | |
848 | $(MAKE) -C Documentation install | |
849 | ||
850 | ||
851 | ||
852 | ||
853 | ### Maintainer's dist rules | |
854 | ||
9b88fcef | 855 | git.spec: git.spec.in |
fc36f6a6 JM |
856 | sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+ |
857 | mv $@+ $@ | |
a9db2974 | 858 | |
27dedf0c | 859 | GIT_TARNAME=git-$(GIT_VERSION) |
9ccb64c8 JH |
860 | dist: git.spec git-archive |
861 | ./git-archive --format=tar \ | |
862 | --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar | |
a9db2974 | 863 | @mkdir -p $(GIT_TARNAME) |
27dedf0c | 864 | @cp git.spec $(GIT_TARNAME) |
181129d2 PA |
865 | @echo $(GIT_VERSION) > $(GIT_TARNAME)/version |
866 | $(TAR) rf $(GIT_TARNAME).tar \ | |
867 | $(GIT_TARNAME)/git.spec $(GIT_TARNAME)/version | |
a9db2974 | 868 | @rm -rf $(GIT_TARNAME) |
9dce3c06 | 869 | gzip -f -9 $(GIT_TARNAME).tar |
a9db2974 CW |
870 | |
871 | rpm: dist | |
27dedf0c | 872 | $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz |
a9db2974 | 873 | |
52db0495 TS |
874 | htmldocs = git-htmldocs-$(GIT_VERSION) |
875 | manpages = git-manpages-$(GIT_VERSION) | |
876 | dist-doc: | |
877 | rm -fr .doc-tmp-dir | |
878 | mkdir .doc-tmp-dir | |
879 | $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc | |
880 | cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar . | |
881 | gzip -n -9 -f $(htmldocs).tar | |
882 | : | |
883 | rm -fr .doc-tmp-dir | |
884 | mkdir .doc-tmp-dir .doc-tmp-dir/man1 .doc-tmp-dir/man7 | |
c5360324 | 885 | $(MAKE) -C Documentation DESTDIR=./ \ |
7b8cf0cf JN |
886 | man1dir=../.doc-tmp-dir/man1 \ |
887 | man7dir=../.doc-tmp-dir/man7 \ | |
52db0495 TS |
888 | install |
889 | cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar . | |
890 | gzip -n -9 -f $(manpages).tar | |
891 | rm -fr .doc-tmp-dir | |
892 | ||
28818ffa | 893 | ### Cleaning rules |
87a81c83 | 894 | |
e83c5163 | 895 | clean: |
3467fec5 JH |
896 | rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \ |
897 | $(LIB_FILE) $(XDIFF_LIB) | |
e6bfaf3e | 898 | rm -f $(ALL_PROGRAMS) $(BUILT_INS) git$X |
f81e7c62 | 899 | rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags |
92b878ad | 900 | rm -rf autom4te.cache |
1b1b678e | 901 | rm -f configure config.log config.mak.autogen config.mak.append config.status config.cache |
52db0495 | 902 | rm -rf $(GIT_TARNAME) .doc-tmp-dir |
5a571cdd | 903 | rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz |
9dc2164a | 904 | rm -f $(htmldocs).tar.gz $(manpages).tar.gz |
22987ae0 | 905 | rm -f gitweb/gitweb.cgi |
ca67f002 | 906 | $(MAKE) -C Documentation/ clean |
c2eeb4dc | 907 | [ ! -f perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean |
3553309f | 908 | rm -f perl/ppport.h perl/Makefile.old |
b1edc53d | 909 | $(MAKE) -C templates/ clean |
4b7581f0 | 910 | $(MAKE) -C t/ clean |
ca3bcabf | 911 | rm -f GIT-VERSION-FILE GIT-CFLAGS |
9b88fcef | 912 | |
4dc00021 | 913 | .PHONY: all install clean strip |
ca3bcabf | 914 | .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS |
d89056c2 | 915 | |
8c989ec5 JH |
916 | ### Check documentation |
917 | # | |
918 | check-docs:: | |
919 | @for v in $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk; \ | |
920 | do \ | |
921 | case "$$v" in \ | |
8c989ec5 | 922 | git-merge-octopus | git-merge-ours | git-merge-recursive | \ |
c8b87ef8 | 923 | git-merge-resolve | git-merge-stupid | git-merge-recur | \ |
a06f678e | 924 | git-merge-recursive-old | \ |
8c989ec5 JH |
925 | git-ssh-pull | git-ssh-push ) continue ;; \ |
926 | esac ; \ | |
927 | test -f "Documentation/$$v.txt" || \ | |
928 | echo "no doc: $$v"; \ | |
929 | grep -q "^gitlink:$$v\[[0-9]\]::" Documentation/git.txt || \ | |
930 | case "$$v" in \ | |
931 | git) ;; \ | |
932 | *) echo "no link: $$v";; \ | |
933 | esac ; \ | |
934 | done | sort | |
c74390e4 JH |
935 | |
936 | ### Make sure built-ins do not have dups and listed in git.c | |
937 | # | |
938 | check-builtins:: | |
939 | ./check-builtins.sh |