]> git.ipfire.org Git - thirdparty/git.git/blame - Makefile
GIT 0.99.6
[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
60
61
e47e35ac 62SCRIPTS=git git-merge-one-file-script git-prune-script \
e002a16b 63 git-pull-script git-tag-script git-resolve-script git-whatchanged \
c4584ae3 64 git-fetch-script git-status-script git-commit-script \
40d8cfe4 65 git-log-script git-shortlog git-cvsimport-script git-diff-script \
3f571e0b 66 git-reset-script git-add-script git-checkout-script git-clone-script \
0acfc972 67 gitk git-cherry git-rebase-script git-relink-script git-repack-script \
37f1a519 68 git-format-patch-script git-sh-setup-script git-push-script \
e0bfc81e 69 git-branch-script git-parse-remote-script git-verify-tag-script \
0516de30 70 git-ls-remote-script git-rename-script \
597c9cc5
JH
71 git-request-pull-script git-bisect-script \
72 git-applymbox git-applypatch
bdd4da59 73
60036a41 74SCRIPTS += git-count-objects-script
045f82cb 75SCRIPTS += git-revert-script
d9f3be7e 76SCRIPTS += git-octopus-script
8de8a292 77SCRIPTS += git-archimport-script
60036a41 78
597c9cc5
JH
79# The ones that do not have to link with lcrypto nor lz.
80SIMPLE_PROGRAMS = \
81 git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
82 git-daemon git-var
83
84# ... and all the rest
a3df1801
LT
85PROG= git-update-cache git-diff-files git-init-db git-write-tree \
86 git-read-tree git-commit-tree git-cat-file git-fsck-cache \
9b23b4bc 87 git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
20f66331 88 git-ls-tree git-merge-base git-merge-cache \
a3df1801 89 git-unpack-file git-export git-diff-cache git-convert-cache \
b2c0bd65 90 git-ssh-push git-ssh-pull git-rev-list git-mktag \
7672db20 91 git-diff-helper git-tar-tree git-local-pull git-hash-object \
597c9cc5 92 git-apply \
def88e9a
LT
93 git-diff-stages git-rev-parse git-patch-id git-pack-objects \
94 git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
0271611e 95 git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
597c9cc5
JH
96 git-show-index git-peek-remote git-show-branch \
97 git-update-server-info git-show-rev-cache git-build-rev-cache \
98 $(SIMPLE_PROGRAMS)
e83c5163 99
90bc118f
JH
100ifdef WITH_SEND_EMAIL
101SCRIPTS += git-send-email-script
102endif
103
b2c0bd65 104ifndef NO_CURL
3e386508 105 PROG+= git-http-pull
b2c0bd65
JS
106endif
107
0a02ce72 108LIB_FILE=libgit.a
f3a3214e 109LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \
44c9e859 110 pack.h pkt-line.h refs.h
28818ffa
PB
111LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
112 tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
9938af6a 113 refs.o csum-file.o pack-check.o pkt-line.o connect.o ident.o \
d288a700 114 sha1_name.o setup.o
0a02ce72 115
8f3f9b09
JH
116LIB_H += rev-cache.h
117LIB_OBJS += rev-cache.o
118
b1bf95bb
JW
119LIB_H += run-command.h
120LIB_OBJS += run-command.o
121
d1df5743
JH
122LIB_H += strbuf.h
123LIB_OBJS += strbuf.o
124
6fb737be
JH
125LIB_H += quote.h
126LIB_OBJS += quote.o
127
85976974 128LIB_H += diff.h count-delta.h
e468305a
PB
129DIFF_OBJS = diff.o diffcore-rename.o diffcore-pickaxe.o diffcore-pathspec.o \
130 diffcore-break.o diffcore-order.o
131LIB_OBJS += $(DIFF_OBJS) count-delta.o
86436c28 132
d19938ab 133LIB_OBJS += gitenv.o
8f3f9b09 134LIB_OBJS += server-info.o
d19938ab 135
cc1ad5c8
LT
136LIBS = $(LIB_FILE)
137LIBS += -lz
cef661fc 138
597c9cc5
JH
139ifeq ($(shell uname -s),Darwin)
140 NEEDS_SSL_WITH_CRYPTO = YesPlease
141 NEEDS_LIBICONV = YesPlease
142endif
143
dd53c7ab
PB
144ifndef NO_OPENSSL
145 LIB_OBJS += epoch.o
9e95049b 146 OPENSSL_LIBSSL=-lssl
dd53c7ab 147else
b05701c5 148 DEFINES += '-DNO_OPENSSL'
dd53c7ab 149 MOZILLA_SHA1=1
9e95049b 150 OPENSSL_LIBSSL=
dd53c7ab 151endif
597c9cc5
JH
152ifdef NEEDS_SSL_WITH_CRYPTO
153 LIB_4_CRYPTO = -lcrypto -lssl
154else
155 LIB_4_CRYPTO = -lcrypto
156endif
157ifdef NEEDS_LIBICONV
158 LIB_4_ICONV = -liconv
159else
160 LIB_4_ICONV =
161endif
cef661fc 162ifdef MOZILLA_SHA1
3e386508
PB
163 SHA1_HEADER="mozilla-sha1/sha1.h"
164 LIB_OBJS += mozilla-sha1/sha1.o
a6ef3518 165else
3e386508
PB
166 ifdef PPC_SHA1
167 SHA1_HEADER="ppc/sha1.h"
168 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
169 else
170 SHA1_HEADER=<openssl/sha.h>
597c9cc5 171 LIBS += $(LIB_4_CRYPTO)
3e386508 172 endif
bfb15365 173endif
cef661fc 174
b05701c5 175DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
cc1ad5c8 176
0a02ce72 177
44c9e859 178
28818ffa
PB
179### Build rules
180
181all: $(PROG)
89967023 182
d3af621b
JH
183all:
184 $(MAKE) -C templates
b05701c5
PR
185
186%.o: %.c
187 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
188%.o: %.S
189 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
a310d434 190
623c8a14 191git-%: %.o $(LIB_FILE)
b05701c5 192 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
623c8a14 193
597c9cc5
JH
194git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV)
195$(SIMPLE_PROGRAMS) : $(LIB_FILE)
196$(SIMPLE_PROGRAMS) : git-% : %.o
197 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB)
198
623c8a14
PB
199git-http-pull: pull.o
200git-local-pull: pull.o
201git-ssh-pull: rsh.o pull.o
202git-ssh-push: rsh.o
a3df1801
LT
203
204git-http-pull: LIBS += -lcurl
9e95049b 205git-rev-list: LIBS += $(OPENSSL_LIBSSL)
a3df1801 206
d3af621b 207init-db.o: init-db.c
b05701c5
PR
208 $(CC) -c $(ALL_CFLAGS) \
209 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
d3af621b 210
e468305a 211$(LIB_OBJS): $(LIB_H)
3c4e8a63 212$(patsubst git-%,%.o,$(PROG)): $(LIB_H)
e468305a 213$(DIFF_OBJS): diffcore.h
e83c5163 214
28818ffa
PB
215$(LIB_FILE): $(LIB_OBJS)
216 $(AR) rcs $@ $(LIB_OBJS)
217
218doc:
219 $(MAKE) -C Documentation all
220
221
222
223### Testing rules
224
225test: all
226 $(MAKE) -C t/ all
227
228test-date: test-date.c date.o
b05701c5 229 $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o
28818ffa
PB
230
231test-delta: test-delta.c diff-delta.o patch-delta.o
b05701c5 232 $(CC) $(ALL_CFLAGS) -o $@ $^
28818ffa
PB
233
234check:
b05701c5 235 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
28818ffa
PB
236
237
238
239### Installation rules
240
241install: $(PROG) $(SCRIPTS)
a682ef9f
PB
242 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
243 $(INSTALL) $(PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
48313592 244 $(INSTALL) git-revert-script $(DESTDIR)$(bindir)/git-cherry-pick-script
8d5afef0 245 $(MAKE) -C templates install
28818ffa
PB
246
247install-doc:
248 $(MAKE) -C Documentation install
249
250
251
252
253### Maintainer's dist rules
254
78d9d414 255git-core.spec: git-core.spec.in Makefile
a9db2974
CW
256 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
257
f85639c3
LT
258GIT_TARNAME=git-core-$(GIT_VERSION)
259dist: git-core.spec git-tar-tree
b1de9de2 260 ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
a9db2974 261 @mkdir -p $(GIT_TARNAME)
f85639c3
LT
262 @cp git-core.spec $(GIT_TARNAME)
263 tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
a9db2974 264 @rm -rf $(GIT_TARNAME)
9dce3c06 265 gzip -f -9 $(GIT_TARNAME).tar
a9db2974
CW
266
267rpm: dist
d7b8a164 268 $(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz
a9db2974 269
7a590132 270deb: dist
f29eaed1
JH
271 rm -rf $(GIT_TARNAME)
272 tar zxf $(GIT_TARNAME).tar.gz
5a571cdd 273 dpkg-source -b $(GIT_TARNAME)
f29eaed1 274 cd $(GIT_TARNAME) && fakeroot debian/rules binary
28818ffa
PB
275
276### Cleaning rules
87a81c83 277
e83c5163 278clean:
a6ef3518 279 rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
5a571cdd 280 rm -f git-core.spec
f29eaed1 281 rm -rf $(GIT_TARNAME)
5a571cdd
JH
282 rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
283 rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
284 rm -f git-tk_$(GIT_VERSION)-*.deb
ca67f002 285 $(MAKE) -C Documentation/ clean
8d5afef0 286 $(MAKE) -C templates/ clean
4b7581f0 287 $(MAKE) -C t/ clean