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