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 NO_STRCASESTR if you don't have strcasestr.
14 # Define PPC_SHA1 environment variable when running make to make use of
15 # a bundled SHA1 routine optimized for PowerPC.
17 # Define ARM_SHA1 environment variable when running make to make use of
18 # a bundled SHA1 routine optimized for ARM.
20 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
22 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
24 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
27 # Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
29 # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
31 # Define COLLISION_CHECK below if you believe that SHA1's
32 # 1461501637330902918203684832716283019655932542976 hashes do not give you
33 # sufficient guarantee that no collisions between objects will ever happen.
35 # DEFINES += -DCOLLISION_CHECK
37 # Define USE_NSEC below if you want git to care about sub-second file mtimes
38 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
39 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
40 # randomly break unless your underlying filesystem supports those sub-second
41 # times (my ext3 doesn't).
43 # DEFINES += -DUSE_NSEC
45 # Define USE_STDEV below if you want git to care about the underlying device
46 # change being considered an inode change from the update-cache perspective.
48 # DEFINES += -DUSE_STDEV
53 ALL_CFLAGS
= $(CFLAGS
) $(PLATFORM_DEFINES
) $(DEFINES
)
56 bindir = $(prefix)/bin
57 template_dir
= $(prefix)/share
/git-core
/templates
/
58 GIT_PYTHON_DIR
= $(prefix)/share
/git-core
/python
66 # sparse is architecture-neutral, which means that we need to tell it
67 # explicitly what architecture to check for. Fix this up for yours..
68 SPARSE_FLAGS
= -D__BIG_ENDIAN__
-D__powerpc__
72 ### --- END CONFIGURATION SECTION ---
75 git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \
76 git-cherry.sh git-clone.sh git-commit.sh \
77 git-count-objects.sh git-diff.sh git-fetch.sh \
78 git-format-patch.sh git-log.sh git-ls-remote.sh \
79 git-merge-one-file.sh git-octopus.sh git-parse-remote.sh \
80 git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
81 git-repack.sh git-request-pull.sh git-reset.sh \
82 git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \
83 git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
84 git-applymbox.sh git-applypatch.sh \
85 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
86 git-merge-resolve.sh git-grep.sh
89 git-archimport.perl git-cvsimport.perl git-relink.perl \
90 git-rename.perl git-shortlog.perl git-fmt-merge-msg.perl
93 git-merge-recursive.py
95 # The ones that do not have to link with lcrypto nor lz.
97 git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
100 # ... and all the rest
102 git-apply git-cat-file \
103 git-checkout-index git-clone-pack git-commit-tree \
104 git-convert-objects git-diff-files \
105 git-diff-index git-diff-stages \
106 git-diff-tree git-fetch-pack git-fsck-objects \
107 git-hash-object git-init-db \
108 git-local-fetch git-ls-files git-ls-tree git-merge-base \
109 git-merge-index git-mktag git-pack-objects git-patch-id \
110 git-peek-remote git-prune-packed git-read-tree \
111 git-receive-pack git-rev-list git-rev-parse \
112 git-send-pack git-show-branch \
113 git-show-index git-ssh-fetch \
114 git-ssh-upload git-tar-tree git-unpack-file \
115 git-unpack-objects git-update-index git-update-server-info \
116 git-upload-pack git-verify-pack git-write-tree \
119 # Backward compatibility -- to be removed in 0.99.8
120 PROGRAMS
+= git-ssh-pull git-ssh-push
125 ifdef WITH_OWN_SUBPROCESS_PY
126 PYMODULES
+= compat
/subprocess.py
129 ifdef WITH_SEND_EMAIL
130 SCRIPT_PERL
+= git-send-email.perl
134 PROGRAMS
+= git-http-fetch
140 blob.h cache.h commit.h count-delta.h csum-file.h delta.h \
141 diff.h epoch.h object.h pack.h pkt-line.h quote.h refs.h \
142 run-command.h strbuf.h tag.h tree.h
145 diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
146 diffcore-pickaxe.o diffcore-rename.o
149 blob.o commit.o connect.o count-delta.o csum-file.o \
150 date.o diff-delta.o entry.o ident.o index.o \
151 object.o pack-check.o patch-delta.o path.o pkt-line.o \
152 quote.o read-cache.o refs.o run-command.o \
153 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
154 tag.o tree.o usage.o
$(DIFF_OBJS
)
159 ifeq ($(shell uname
-s
),Darwin
)
160 NEEDS_SSL_WITH_CRYPTO
= YesPlease
161 NEEDS_LIBICONV
= YesPlease
163 ifeq ($(shell uname
-s
),SunOS
)
164 NEEDS_SOCKET
= YesPlease
165 NEEDS_NSL
= YesPlease
166 PLATFORM_DEFINES
+= -D__EXTENSIONS__
168 ifneq (,$(findstring arm
,$(shell uname
-m
)))
176 PERL_PATH
= /usr
/bin
/perl
179 PYTHON_PATH
= /usr
/bin
/python
184 OPENSSL_LIBSSL
= -lssl
186 DEFINES
+= '-DNO_OPENSSL'
190 ifdef NEEDS_SSL_WITH_CRYPTO
191 LIB_4_CRYPTO
= -lcrypto
-lssl
193 LIB_4_CRYPTO
= -lcrypto
196 LIB_4_ICONV
= -liconv
202 SIMPLE_LIB
+= -lsocket
209 DEFINES
+= -Dstrcasestr
=gitstrcasestr
210 LIB_OBJS
+= compat
/strcasestr.o
214 SHA1_HEADER
= "ppc/sha1.h"
215 LIB_OBJS
+= ppc
/sha1.o ppc
/sha1ppc.o
218 SHA1_HEADER
= "arm/sha1.h"
219 LIB_OBJS
+= arm
/sha1.o arm
/sha1_arm.o
222 SHA1_HEADER
= "mozilla-sha1/sha1.h"
223 LIB_OBJS
+= mozilla-sha1
/sha1.o
225 SHA1_HEADER
= <openssl
/sha.h
>
226 LIBS
+= $(LIB_4_CRYPTO
)
231 DEFINES
+= '-DSHA1_HEADER=$(SHA1_HEADER)'
233 SCRIPTS
= $(patsubst %.sh
,%,$(SCRIPT_SH
)) \
234 $(patsubst %.perl
,%,$(SCRIPT_PERL
)) \
235 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) \
240 all: $(PROGRAMS
) $(SCRIPTS
)
247 sed
-e
's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh
>$@
+
251 $(filter-out git
,$(patsubst %.sh
,%,$(SCRIPT_SH
))) : % : %.sh
253 sed
-e
'1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh
>$@
256 $(patsubst %.perl
,%,$(SCRIPT_PERL
)) : % : %.perl
258 sed
-e
'1s|#!.*perl|#!$(PERL_PATH)|' $@.perl
>$@
261 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) : % : %.py
263 sed
-e
'1s|#!.*python|#!$(PYTHON_PATH)|' \
264 -e
's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \
269 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) $<
271 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) $<
273 git-
%: %.o
$(LIB_FILE
)
274 $(CC
) $(ALL_CFLAGS
) -o
$@
$(filter %.o
,$^
) $(LIBS
)
276 git-mailinfo
: SIMPLE_LIB
+= $(LIB_4_ICONV
)
277 $(SIMPLE_PROGRAMS
) : $(LIB_FILE
)
278 $(SIMPLE_PROGRAMS
) : git-
% : %.o
279 $(CC
) $(ALL_CFLAGS
) -o
$@
$(filter %.o
,$^
) $(LIB_FILE
) $(SIMPLE_LIB
)
281 git-http-fetch
: fetch.o
282 git-local-fetch
: fetch.o
283 git-ssh-fetch
: rsh.o fetch.o
284 git-ssh-upload
: rsh.o
285 git-ssh-pull
: rsh.o fetch.o
288 git-http-fetch
: LIBS
+= -lcurl
289 git-rev-list
: LIBS
+= $(OPENSSL_LIBSSL
)
292 $(CC
) -c
$(ALL_CFLAGS
) \
293 -DDEFAULT_GIT_TEMPLATE_DIR
='"$(template_dir)"' $*.c
295 $(LIB_OBJS
): $(LIB_H
)
296 $(patsubst git-
%,%.o
,$(PROGRAMS
)): $(LIB_H
)
297 $(DIFF_OBJS
): diffcore.h
299 $(LIB_FILE
): $(LIB_OBJS
)
300 $(AR
) rcs
$@
$(LIB_OBJS
)
303 $(MAKE
) -C Documentation
all
311 test-date
: test-date.c date.o
312 $(CC
) $(ALL_CFLAGS
) -o
$@ test-date.c date.o
314 test-delta
: test-delta.c diff-delta.o patch-delta.o
315 $(CC
) $(ALL_CFLAGS
) -o
$@
$^
318 for i in
*.c
; do sparse
$(ALL_CFLAGS
) $(SPARSE_FLAGS
) $$i; done
322 ### Installation rules
324 install: $(PROGRAMS
) $(SCRIPTS
)
325 $(INSTALL
) -d
-m755
$(DESTDIR
)$(bindir)
326 $(INSTALL
) $(PROGRAMS
) $(SCRIPTS
) $(DESTDIR
)$(bindir)
327 $(INSTALL
) git-revert
$(DESTDIR
)$(bindir)/git-cherry-pick
328 sh .
/cmd-rename.sh
$(DESTDIR
)$(bindir)
329 $(MAKE
) -C templates
install
330 $(INSTALL
) -d
-m755
$(DESTDIR
)$(GIT_PYTHON_DIR
)
331 $(INSTALL
) $(PYMODULES
) $(DESTDIR
)$(GIT_PYTHON_DIR
)
334 $(MAKE
) -C Documentation
install
339 ### Maintainer's dist rules
341 git-core.spec
: git-core.spec.in Makefile
342 sed
-e
's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
344 GIT_TARNAME
=git-core-
$(GIT_VERSION
)
345 dist: git-core.spec git-tar-tree
346 .
/git-tar-tree HEAD
$(GIT_TARNAME
) > $(GIT_TARNAME
).
tar
347 @mkdir
-p
$(GIT_TARNAME
)
348 @cp git-core.spec
$(GIT_TARNAME
)
349 tar rf
$(GIT_TARNAME
).
tar $(GIT_TARNAME
)/git-core.spec
350 @
rm -rf
$(GIT_TARNAME
)
351 gzip
-f
-9 $(GIT_TARNAME
).
tar
354 $(RPMBUILD
) -ta git-core-
$(GIT_VERSION
).
tar.gz
357 rm -rf
$(GIT_TARNAME
)
358 tar zxf
$(GIT_TARNAME
).
tar.gz
359 dpkg-source
-b
$(GIT_TARNAME
)
360 cd
$(GIT_TARNAME
) && fakeroot debian
/rules binary
365 rm -f
*.o mozilla-sha1
/*.o ppc
/*.o
$(PROGRAMS
) $(LIB_FILE
)
366 rm -f
$(filter-out gitk
,$(SCRIPTS
))
368 rm -rf
$(GIT_TARNAME
)
369 rm -f
$(GIT_TARNAME
).
tar.gz git-core_
$(GIT_VERSION
)-*.
tar.gz
370 rm -f git-core_
$(GIT_VERSION
)-*.deb git-core_
$(GIT_VERSION
)-*.dsc
371 rm -f git-tk_
$(GIT_VERSION
)-*.deb
372 $(MAKE
) -C Documentation
/ clean
373 $(MAKE
) -C templates
/ clean