Multi-backend merge driver.
[git/gitweb.git] / Makefile
blob7ef9861a7d6828f1622cb375f0b81e88306e91c3
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.
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.
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.
12 # Define PPC_SHA1 environment variable when running make to make use of
13 # a bundled SHA1 routine optimized for PowerPC.
15 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
17 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
19 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
20 # Patrick Mauritz).
22 # Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
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.
28 # DEFINES += -DCOLLISION_CHECK
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).
36 # DEFINES += -DUSE_NSEC
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.
41 # DEFINES += -DUSE_STDEV
43 GIT_VERSION = 0.99.6
45 CFLAGS = -g -O2 -Wall
46 ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES)
48 prefix = $(HOME)
49 bindir = $(prefix)/bin
50 template_dir = $(prefix)/share/git-core/templates/
51 # DESTDIR=
53 CC = gcc
54 AR = ar
55 INSTALL = install
56 RPMBUILD = rpmbuild
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..
60 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
64 ### --- END CONFIGURATION SECTION ---
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 git-merge.sh git-merge-resolve.sh git-merge-octopus.sh
79 SCRIPT_PERL = \
80 git-archimport.perl git-cvsimport.perl git-relink.perl \
81 git-rename.perl git-shortlog.perl
83 # The ones that do not have to link with lcrypto nor lz.
84 SIMPLE_PROGRAMS = \
85 git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
86 git-daemon git-var
88 # ... and all the rest
89 PROGRAMS = \
90 git-apply git-build-rev-cache git-cat-file \
91 git-checkout-index git-clone-pack git-commit-tree \
92 git-convert-objects git-diff-files \
93 git-diff-helper git-diff-index git-diff-stages \
94 git-diff-tree git-export git-fetch-pack git-fsck-objects \
95 git-hash-object git-init-db \
96 git-local-fetch git-ls-files git-ls-tree git-merge-base \
97 git-merge-index git-mktag git-pack-objects git-patch-id \
98 git-peek-remote git-prune-packed git-read-tree \
99 git-receive-pack git-rev-list git-rev-parse \
100 git-rev-tree git-send-pack git-show-branch \
101 git-show-index git-show-rev-cache git-ssh-fetch \
102 git-ssh-upload git-tar-tree git-unpack-file \
103 git-unpack-objects git-update-index git-update-server-info \
104 git-upload-pack git-verify-pack git-write-tree \
105 $(SIMPLE_PROGRAMS)
107 ifdef WITH_SEND_EMAIL
108 SCRIPT_PERL += git-send-email.perl
109 endif
111 ifndef NO_CURL
112 PROGRAMS += git-http-fetch
113 endif
115 LIB_FILE=libgit.a
117 LIB_H = \
118 blob.h cache.h commit.h count-delta.h csum-file.h delta.h \
119 diff.h epoch.h object.h pack.h pkt-line.h quote.h refs.h \
120 rev-cache.h run-command.h strbuf.h tag.h tree.h
122 DIFF_OBJS = \
123 diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
124 diffcore-pickaxe.o diffcore-rename.o
126 LIB_OBJS = \
127 blob.o commit.o connect.o count-delta.o csum-file.o \
128 date.o diff-delta.o entry.o ident.o index.o \
129 object.o pack-check.o patch-delta.o path.o pkt-line.o \
130 quote.o read-cache.o refs.o rev-cache.o run-command.o \
131 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
132 tag.o tree.o usage.o $(DIFF_OBJS)
134 LIBS = $(LIB_FILE)
135 LIBS += -lz
137 ifeq ($(shell uname -s),Darwin)
138 NEEDS_SSL_WITH_CRYPTO = YesPlease
139 NEEDS_LIBICONV = YesPlease
140 endif
141 ifeq ($(shell uname -s),SunOS)
142 NEEDS_SOCKET = YesPlease
143 PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
144 endif
146 ifndef SHELL_PATH
147 SHELL_PATH = /bin/sh
148 endif
149 ifndef PERL_PATH
150 PERL_PATH = /usr/bin/perl
151 endif
153 ifndef NO_OPENSSL
154 LIB_OBJS += epoch.o
155 OPENSSL_LIBSSL = -lssl
156 else
157 DEFINES += '-DNO_OPENSSL'
158 MOZILLA_SHA1 = 1
159 OPENSSL_LIBSSL =
160 endif
161 ifdef NEEDS_SSL_WITH_CRYPTO
162 LIB_4_CRYPTO = -lcrypto -lssl
163 else
164 LIB_4_CRYPTO = -lcrypto
165 endif
166 ifdef NEEDS_LIBICONV
167 LIB_4_ICONV = -liconv
168 else
169 LIB_4_ICONV =
170 endif
171 ifdef MOZILLA_SHA1
172 SHA1_HEADER = "mozilla-sha1/sha1.h"
173 LIB_OBJS += mozilla-sha1/sha1.o
174 else
175 ifdef PPC_SHA1
176 SHA1_HEADER = "ppc/sha1.h"
177 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
178 else
179 SHA1_HEADER = <openssl/sha.h>
180 LIBS += $(LIB_4_CRYPTO)
181 endif
182 endif
183 ifdef NEEDS_SOCKET
184 LIBS += -lsocket
185 SIMPLE_LIB += -lsocket
186 endif
188 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
190 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
191 $(patsubst %.perl,%,$(SCRIPT_PERL)) gitk
193 ### Build rules
195 all: $(PROGRAMS) $(SCRIPTS)
197 all:
198 $(MAKE) -C templates
200 git: git.sh Makefile
201 rm -f $@+ $@
202 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
203 chmod +x $@+
204 mv $@+ $@
206 $(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
207 rm -f $@
208 sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@
209 chmod +x $@
211 $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
212 rm -f $@
213 sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
214 chmod +x $@
216 %.o: %.c
217 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
218 %.o: %.S
219 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
221 git-%: %.o $(LIB_FILE)
222 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
224 git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV)
225 $(SIMPLE_PROGRAMS) : $(LIB_FILE)
226 $(SIMPLE_PROGRAMS) : git-% : %.o
227 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB)
229 git-http-fetch: fetch.o
230 git-local-fetch: fetch.o
231 git-ssh-fetch: rsh.o fetch.o
232 git-ssh-upload: rsh.o
234 git-http-fetch: LIBS += -lcurl
235 git-rev-list: LIBS += $(OPENSSL_LIBSSL)
237 init-db.o: init-db.c
238 $(CC) -c $(ALL_CFLAGS) \
239 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
241 $(LIB_OBJS): $(LIB_H)
242 $(patsubst git-%,%.o,$(PROGRAMS)): $(LIB_H)
243 $(DIFF_OBJS): diffcore.h
245 $(LIB_FILE): $(LIB_OBJS)
246 $(AR) rcs $@ $(LIB_OBJS)
248 doc:
249 $(MAKE) -C Documentation all
252 ### Testing rules
254 test: all
255 $(MAKE) -C t/ all
257 test-date: test-date.c date.o
258 $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o
260 test-delta: test-delta.c diff-delta.o patch-delta.o
261 $(CC) $(ALL_CFLAGS) -o $@ $^
263 check:
264 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
268 ### Installation rules
270 install: $(PROGRAMS) $(SCRIPTS)
271 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
272 $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
273 $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
274 sh ./cmd-rename.sh $(DESTDIR)$(bindir)
275 $(MAKE) -C templates install
277 install-doc:
278 $(MAKE) -C Documentation install
283 ### Maintainer's dist rules
285 git-core.spec: git-core.spec.in Makefile
286 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
288 GIT_TARNAME=git-core-$(GIT_VERSION)
289 dist: git-core.spec git-tar-tree
290 ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
291 @mkdir -p $(GIT_TARNAME)
292 @cp git-core.spec $(GIT_TARNAME)
293 tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
294 @rm -rf $(GIT_TARNAME)
295 gzip -f -9 $(GIT_TARNAME).tar
297 rpm: dist
298 $(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz
300 deb: dist
301 rm -rf $(GIT_TARNAME)
302 tar zxf $(GIT_TARNAME).tar.gz
303 dpkg-source -b $(GIT_TARNAME)
304 cd $(GIT_TARNAME) && fakeroot debian/rules binary
306 ### Cleaning rules
308 clean:
309 rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
310 rm -f $(filter-out gitk,$(SCRIPTS))
311 rm -f git-core.spec
312 rm -rf $(GIT_TARNAME)
313 rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
314 rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
315 rm -f git-tk_$(GIT_VERSION)-*.deb
316 $(MAKE) -C Documentation/ clean
317 $(MAKE) -C templates/ clean
318 $(MAKE) -C t/ clean