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