]>
Commit | Line | Data |
---|---|---|
5bdac8b3 PB |
1 | # Define MOZILLA_SHA1 environment variable when running make to make use of |
2 | # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast | |
3 | # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default | |
4 | # choice) has very fast version optimized for i586. | |
bdd4da59 | 5 | # |
5bdac8b3 PB |
6 | # Define NO_OPENSSL environment variable if you do not have OpenSSL. You will |
7 | # miss out git-rev-list --merge-order. This also implies MOZILLA_SHA1. | |
2cb45e95 | 8 | # |
b2c0bd65 JS |
9 | # Define NO_CURL if you do not have curl installed. git-http-pull is not |
10 | # built, and you cannot use http:// and https:// transports. | |
11 | # | |
6d9bbc50 PM |
12 | # Define CURLDIR=/foo/bar if your curl header and library files are in |
13 | # /foo/bar/include and /foo/bar/lib directories. | |
14 | # | |
ef34af24 LT |
15 | # Define NO_STRCASESTR if you don't have strcasestr. |
16 | # | |
5bdac8b3 PB |
17 | # Define PPC_SHA1 environment variable when running make to make use of |
18 | # a bundled SHA1 routine optimized for PowerPC. | |
597c9cc5 | 19 | # |
7c6ef2f2 NP |
20 | # Define ARM_SHA1 environment variable when running make to make use of |
21 | # a bundled SHA1 routine optimized for ARM. | |
22 | # | |
597c9cc5 | 23 | # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin). |
f0ebff0d | 24 | # |
597c9cc5 | 25 | # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin). |
f0ebff0d PM |
26 | # |
27 | # Define NEEDS_SOCKET if linking with libc is not enough (SunOS, | |
28 | # Patrick Mauritz). | |
29 | # | |
30 | # Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz). | |
31 | # | |
343d35c9 JH |
32 | # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3. |
33 | # | |
5bdac8b3 PB |
34 | # Define COLLISION_CHECK below if you believe that SHA1's |
35 | # 1461501637330902918203684832716283019655932542976 hashes do not give you | |
36 | # sufficient guarantee that no collisions between objects will ever happen. | |
37 | ||
38 | # DEFINES += -DCOLLISION_CHECK | |
39 | ||
40 | # Define USE_NSEC below if you want git to care about sub-second file mtimes | |
41 | # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and | |
42 | # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely | |
43 | # randomly break unless your underlying filesystem supports those sub-second | |
44 | # times (my ext3 doesn't). | |
45 | ||
46 | # DEFINES += -DUSE_NSEC | |
47 | ||
48 | # Define USE_STDEV below if you want git to care about the underlying device | |
49 | # change being considered an inode change from the update-cache perspective. | |
50 | ||
51 | # DEFINES += -DUSE_STDEV | |
52 | ||
53e2cc9b | 53 | GIT_VERSION = 0.99.7 |
a9db2974 | 54 | |
b05701c5 | 55 | CFLAGS = -g -O2 -Wall |
f0ebff0d | 56 | ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES) |
29c2cce4 | 57 | |
b05701c5 PR |
58 | prefix = $(HOME) |
59 | bindir = $(prefix)/bin | |
60 | template_dir = $(prefix)/share/git-core/templates/ | |
720d150c | 61 | GIT_PYTHON_DIR = $(prefix)/share/git-core/python |
a682ef9f | 62 | # DESTDIR= |
5c2a7fbc | 63 | |
b05701c5 PR |
64 | CC = gcc |
65 | AR = ar | |
66 | INSTALL = install | |
67 | RPMBUILD = rpmbuild | |
e83c5163 | 68 | |
44c9e859 LT |
69 | # sparse is architecture-neutral, which means that we need to tell it |
70 | # explicitly what architecture to check for. Fix this up for yours.. | |
b05701c5 | 71 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
44c9e859 | 72 | |
28818ffa PB |
73 | |
74 | ||
75 | ### --- END CONFIGURATION SECTION --- | |
76 | ||
215a7ad1 JH |
77 | SCRIPT_SH = \ |
78 | git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \ | |
79 | git-cherry.sh git-clone.sh git-commit.sh \ | |
80 | git-count-objects.sh git-diff.sh git-fetch.sh \ | |
81 | git-format-patch.sh git-log.sh git-ls-remote.sh \ | |
82 | git-merge-one-file.sh git-octopus.sh git-parse-remote.sh \ | |
83 | git-prune.sh git-pull.sh git-push.sh git-rebase.sh \ | |
84 | git-repack.sh git-request-pull.sh git-reset.sh \ | |
85 | git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \ | |
86 | git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \ | |
91063bbc | 87 | git-applymbox.sh git-applypatch.sh \ |
2276aa6c | 88 | git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ |
f22cc3fc | 89 | git-merge-resolve.sh git-grep.sh |
215a7ad1 JH |
90 | |
91 | SCRIPT_PERL = \ | |
92 | git-archimport.perl git-cvsimport.perl git-relink.perl \ | |
c8b48ba4 | 93 | git-rename.perl git-shortlog.perl git-fmt-merge-msg.perl |
60036a41 | 94 | |
720d150c | 95 | SCRIPT_PYTHON = \ |
e4cf17ce | 96 | git-merge-recursive.py |
720d150c | 97 | |
597c9cc5 JH |
98 | # The ones that do not have to link with lcrypto nor lz. |
99 | SIMPLE_PROGRAMS = \ | |
100 | git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \ | |
101 | git-daemon git-var | |
102 | ||
103 | # ... and all the rest | |
215a7ad1 | 104 | PROGRAMS = \ |
0f56479d | 105 | git-apply git-cat-file \ |
215a7ad1 JH |
106 | git-checkout-index git-clone-pack git-commit-tree \ |
107 | git-convert-objects git-diff-files \ | |
5cfcd07c | 108 | git-diff-index git-diff-stages \ |
0fe51391 | 109 | git-diff-tree git-fetch-pack git-fsck-objects \ |
215a7ad1 JH |
110 | git-hash-object git-init-db \ |
111 | git-local-fetch git-ls-files git-ls-tree git-merge-base \ | |
112 | git-merge-index git-mktag git-pack-objects git-patch-id \ | |
113 | git-peek-remote git-prune-packed git-read-tree \ | |
114 | git-receive-pack git-rev-list git-rev-parse \ | |
9dcc829f | 115 | git-send-pack git-show-branch \ |
0f56479d | 116 | git-show-index git-ssh-fetch \ |
215a7ad1 JH |
117 | git-ssh-upload git-tar-tree git-unpack-file \ |
118 | git-unpack-objects git-update-index git-update-server-info \ | |
119 | git-upload-pack git-verify-pack git-write-tree \ | |
597c9cc5 | 120 | $(SIMPLE_PROGRAMS) |
e83c5163 | 121 | |
f71a69ab JH |
122 | # Backward compatibility -- to be removed in 0.99.8 |
123 | PROGRAMS += git-ssh-pull git-ssh-push | |
124 | ||
720d150c JH |
125 | PYMODULES = \ |
126 | gitMergeCommon.py | |
127 | ||
343d35c9 JH |
128 | ifdef WITH_OWN_SUBPROCESS_PY |
129 | PYMODULES += compat/subprocess.py | |
130 | endif | |
131 | ||
90bc118f | 132 | ifdef WITH_SEND_EMAIL |
215a7ad1 | 133 | SCRIPT_PERL += git-send-email.perl |
90bc118f JH |
134 | endif |
135 | ||
b2c0bd65 | 136 | ifndef NO_CURL |
6d9bbc50 PM |
137 | ifdef CURLDIR |
138 | # This is still problematic -- gcc does not want -R. | |
139 | CFLAGS += -I$(CURLDIR)/include | |
140 | CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl | |
141 | else | |
142 | CURL_LIBCURL = -lcurl | |
143 | endif | |
215a7ad1 | 144 | PROGRAMS += git-http-fetch |
b2c0bd65 JS |
145 | endif |
146 | ||
0a02ce72 | 147 | LIB_FILE=libgit.a |
8f3f9b09 | 148 | |
215a7ad1 JH |
149 | LIB_H = \ |
150 | blob.h cache.h commit.h count-delta.h csum-file.h delta.h \ | |
151 | diff.h epoch.h object.h pack.h pkt-line.h quote.h refs.h \ | |
0f56479d | 152 | run-command.h strbuf.h tag.h tree.h |
b1bf95bb | 153 | |
215a7ad1 JH |
154 | DIFF_OBJS = \ |
155 | diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \ | |
156 | diffcore-pickaxe.o diffcore-rename.o | |
d1df5743 | 157 | |
215a7ad1 JH |
158 | LIB_OBJS = \ |
159 | blob.o commit.o connect.o count-delta.o csum-file.o \ | |
a9ab586a | 160 | date.o diff-delta.o entry.o ident.o index.o \ |
215a7ad1 | 161 | object.o pack-check.o patch-delta.o path.o pkt-line.o \ |
0f56479d | 162 | quote.o read-cache.o refs.o run-command.o \ |
215a7ad1 JH |
163 | server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \ |
164 | tag.o tree.o usage.o $(DIFF_OBJS) | |
d19938ab | 165 | |
cc1ad5c8 LT |
166 | LIBS = $(LIB_FILE) |
167 | LIBS += -lz | |
cef661fc | 168 | |
597c9cc5 JH |
169 | ifeq ($(shell uname -s),Darwin) |
170 | NEEDS_SSL_WITH_CRYPTO = YesPlease | |
171 | NEEDS_LIBICONV = YesPlease | |
172 | endif | |
f0ebff0d PM |
173 | ifeq ($(shell uname -s),SunOS) |
174 | NEEDS_SOCKET = YesPlease | |
5a90d4ac JH |
175 | NEEDS_NSL = YesPlease |
176 | PLATFORM_DEFINES += -D__EXTENSIONS__ | |
f0ebff0d | 177 | endif |
7c6ef2f2 NP |
178 | ifneq (,$(findstring arm,$(shell uname -m))) |
179 | ARM_SHA1 = YesPlease | |
180 | endif | |
597c9cc5 | 181 | |
bc6146d2 JH |
182 | ifndef SHELL_PATH |
183 | SHELL_PATH = /bin/sh | |
184 | endif | |
185 | ifndef PERL_PATH | |
186 | PERL_PATH = /usr/bin/perl | |
187 | endif | |
720d150c JH |
188 | ifndef PYTHON_PATH |
189 | PYTHON_PATH = /usr/bin/python | |
190 | endif | |
bc6146d2 | 191 | |
dd53c7ab PB |
192 | ifndef NO_OPENSSL |
193 | LIB_OBJS += epoch.o | |
215a7ad1 | 194 | OPENSSL_LIBSSL = -lssl |
dd53c7ab | 195 | else |
b05701c5 | 196 | DEFINES += '-DNO_OPENSSL' |
215a7ad1 JH |
197 | MOZILLA_SHA1 = 1 |
198 | OPENSSL_LIBSSL = | |
dd53c7ab | 199 | endif |
597c9cc5 JH |
200 | ifdef NEEDS_SSL_WITH_CRYPTO |
201 | LIB_4_CRYPTO = -lcrypto -lssl | |
202 | else | |
203 | LIB_4_CRYPTO = -lcrypto | |
204 | endif | |
205 | ifdef NEEDS_LIBICONV | |
206 | LIB_4_ICONV = -liconv | |
207 | else | |
208 | LIB_4_ICONV = | |
209 | endif | |
f0ebff0d PM |
210 | ifdef NEEDS_SOCKET |
211 | LIBS += -lsocket | |
212 | SIMPLE_LIB += -lsocket | |
213 | endif | |
5a90d4ac JH |
214 | ifdef NEEDS_NSL |
215 | LIBS += -lnsl | |
216 | SIMPLE_LIB += -lnsl | |
217 | endif | |
ef34af24 LT |
218 | ifdef NO_STRCASESTR |
219 | DEFINES += -Dstrcasestr=gitstrcasestr | |
220 | LIB_OBJS += compat/strcasestr.o | |
221 | endif | |
cef661fc | 222 | |
7c6ef2f2 NP |
223 | ifdef PPC_SHA1 |
224 | SHA1_HEADER = "ppc/sha1.h" | |
225 | LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o | |
226 | else | |
227 | ifdef ARM_SHA1 | |
228 | SHA1_HEADER = "arm/sha1.h" | |
229 | LIB_OBJS += arm/sha1.o arm/sha1_arm.o | |
230 | else | |
231 | ifdef MOZILLA_SHA1 | |
232 | SHA1_HEADER = "mozilla-sha1/sha1.h" | |
233 | LIB_OBJS += mozilla-sha1/sha1.o | |
234 | else | |
235 | SHA1_HEADER = <openssl/sha.h> | |
236 | LIBS += $(LIB_4_CRYPTO) | |
237 | endif | |
238 | endif | |
239 | endif | |
240 | ||
b05701c5 | 241 | DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)' |
cc1ad5c8 | 242 | |
bc6146d2 | 243 | SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ |
720d150c JH |
244 | $(patsubst %.perl,%,$(SCRIPT_PERL)) \ |
245 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ | |
246 | gitk | |
44c9e859 | 247 | |
28818ffa PB |
248 | ### Build rules |
249 | ||
bc6146d2 | 250 | all: $(PROGRAMS) $(SCRIPTS) |
89967023 | 251 | |
d3af621b JH |
252 | all: |
253 | $(MAKE) -C templates | |
b05701c5 | 254 | |
bc6146d2 | 255 | git: git.sh Makefile |
6a2e50f9 | 256 | rm -f $@+ $@ |
bc6146d2 | 257 | sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+ |
6a2e50f9 JH |
258 | chmod +x $@+ |
259 | mv $@+ $@ | |
260 | ||
bc6146d2 JH |
261 | $(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh |
262 | rm -f $@ | |
263 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@ | |
264 | chmod +x $@ | |
265 | ||
266 | $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl | |
267 | rm -f $@ | |
268 | sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@ | |
269 | chmod +x $@ | |
270 | ||
720d150c JH |
271 | $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py |
272 | rm -f $@ | |
273 | sed -e '1s|#!.*python|#!$(PYTHON_PATH)|' \ | |
274 | -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \ | |
275 | $@.py >$@ | |
276 | chmod +x $@ | |
277 | ||
b05701c5 PR |
278 | %.o: %.c |
279 | $(CC) -o $*.o -c $(ALL_CFLAGS) $< | |
280 | %.o: %.S | |
281 | $(CC) -o $*.o -c $(ALL_CFLAGS) $< | |
a310d434 | 282 | |
623c8a14 | 283 | git-%: %.o $(LIB_FILE) |
b05701c5 | 284 | $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) |
623c8a14 | 285 | |
597c9cc5 JH |
286 | git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV) |
287 | $(SIMPLE_PROGRAMS) : $(LIB_FILE) | |
288 | $(SIMPLE_PROGRAMS) : git-% : %.o | |
289 | $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB) | |
290 | ||
215a7ad1 JH |
291 | git-http-fetch: fetch.o |
292 | git-local-fetch: fetch.o | |
293 | git-ssh-fetch: rsh.o fetch.o | |
294 | git-ssh-upload: rsh.o | |
f71a69ab JH |
295 | git-ssh-pull: rsh.o fetch.o |
296 | git-ssh-push: rsh.o | |
a3df1801 | 297 | |
6d9bbc50 | 298 | git-http-fetch: LIBS += $(CURL_LIBCURL) |
9e95049b | 299 | git-rev-list: LIBS += $(OPENSSL_LIBSSL) |
a3df1801 | 300 | |
d3af621b | 301 | init-db.o: init-db.c |
b05701c5 PR |
302 | $(CC) -c $(ALL_CFLAGS) \ |
303 | -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c | |
d3af621b | 304 | |
e468305a | 305 | $(LIB_OBJS): $(LIB_H) |
215a7ad1 | 306 | $(patsubst git-%,%.o,$(PROGRAMS)): $(LIB_H) |
e468305a | 307 | $(DIFF_OBJS): diffcore.h |
e83c5163 | 308 | |
28818ffa PB |
309 | $(LIB_FILE): $(LIB_OBJS) |
310 | $(AR) rcs $@ $(LIB_OBJS) | |
311 | ||
312 | doc: | |
313 | $(MAKE) -C Documentation all | |
314 | ||
315 | ||
28818ffa PB |
316 | ### Testing rules |
317 | ||
318 | test: all | |
319 | $(MAKE) -C t/ all | |
320 | ||
321 | test-date: test-date.c date.o | |
b05701c5 | 322 | $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o |
28818ffa PB |
323 | |
324 | test-delta: test-delta.c diff-delta.o patch-delta.o | |
b05701c5 | 325 | $(CC) $(ALL_CFLAGS) -o $@ $^ |
28818ffa PB |
326 | |
327 | check: | |
b05701c5 | 328 | for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done |
28818ffa PB |
329 | |
330 | ||
331 | ||
332 | ### Installation rules | |
333 | ||
215a7ad1 | 334 | install: $(PROGRAMS) $(SCRIPTS) |
53764ee4 | 335 | $(INSTALL) -d -m755 $(DESTDIR)$(bindir) |
bc6146d2 JH |
336 | $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir) |
337 | $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick | |
215a7ad1 | 338 | sh ./cmd-rename.sh $(DESTDIR)$(bindir) |
8d5afef0 | 339 | $(MAKE) -C templates install |
53764ee4 | 340 | $(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR) |
720d150c | 341 | $(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR) |
28818ffa PB |
342 | |
343 | install-doc: | |
344 | $(MAKE) -C Documentation install | |
345 | ||
346 | ||
347 | ||
348 | ||
349 | ### Maintainer's dist rules | |
350 | ||
78d9d414 | 351 | git-core.spec: git-core.spec.in Makefile |
a9db2974 CW |
352 | sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@ |
353 | ||
f85639c3 LT |
354 | GIT_TARNAME=git-core-$(GIT_VERSION) |
355 | dist: git-core.spec git-tar-tree | |
b1de9de2 | 356 | ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar |
a9db2974 | 357 | @mkdir -p $(GIT_TARNAME) |
f85639c3 LT |
358 | @cp git-core.spec $(GIT_TARNAME) |
359 | tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec | |
a9db2974 | 360 | @rm -rf $(GIT_TARNAME) |
9dce3c06 | 361 | gzip -f -9 $(GIT_TARNAME).tar |
a9db2974 CW |
362 | |
363 | rpm: dist | |
d7b8a164 | 364 | $(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz |
a9db2974 | 365 | |
7a590132 | 366 | deb: dist |
f29eaed1 JH |
367 | rm -rf $(GIT_TARNAME) |
368 | tar zxf $(GIT_TARNAME).tar.gz | |
5a571cdd | 369 | dpkg-source -b $(GIT_TARNAME) |
f29eaed1 | 370 | cd $(GIT_TARNAME) && fakeroot debian/rules binary |
28818ffa PB |
371 | |
372 | ### Cleaning rules | |
87a81c83 | 373 | |
e83c5163 | 374 | clean: |
215a7ad1 | 375 | rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE) |
bc6146d2 JH |
376 | rm -f $(filter-out gitk,$(SCRIPTS)) |
377 | rm -f git-core.spec | |
f29eaed1 | 378 | rm -rf $(GIT_TARNAME) |
5a571cdd JH |
379 | rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz |
380 | rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc | |
381 | rm -f git-tk_$(GIT_VERSION)-*.deb | |
ca67f002 | 382 | $(MAKE) -C Documentation/ clean |
8d5afef0 | 383 | $(MAKE) -C templates/ clean |
4b7581f0 | 384 | $(MAKE) -C t/ clean |