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