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 NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
19 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
21 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
24 # Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
26 # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
28 # Define COLLISION_CHECK below if you believe that SHA1's
29 # 1461501637330902918203684832716283019655932542976 hashes do not give you
30 # sufficient guarantee that no collisions between objects will ever happen.
32 # DEFINES += -DCOLLISION_CHECK
34 # Define USE_NSEC below if you want git to care about sub-second file mtimes
35 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
36 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
37 # randomly break unless your underlying filesystem supports those sub-second
38 # times (my ext3 doesn't).
40 # DEFINES += -DUSE_NSEC
42 # Define USE_STDEV below if you want git to care about the underlying device
43 # change being considered an inode change from the update-cache perspective.
45 # DEFINES += -DUSE_STDEV
50 ALL_CFLAGS
= $(CFLAGS
) $(PLATFORM_DEFINES
) $(DEFINES
)
53 bindir = $(prefix)/bin
54 template_dir
= $(prefix)/share
/git-core
/templates
/
55 GIT_PYTHON_DIR
= $(prefix)/share
/git-core
/python
63 # sparse is architecture-neutral, which means that we need to tell it
64 # explicitly what architecture to check for. Fix this up for yours..
65 SPARSE_FLAGS
= -D__BIG_ENDIAN__
-D__powerpc__
69 ### --- END CONFIGURATION SECTION ---
72 git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \
73 git-cherry.sh git-clone.sh git-commit.sh \
74 git-count-objects.sh git-diff.sh git-fetch.sh \
75 git-format-patch.sh git-log.sh git-ls-remote.sh \
76 git-merge-one-file.sh git-octopus.sh git-parse-remote.sh \
77 git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
78 git-repack.sh git-request-pull.sh git-reset.sh \
79 git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \
80 git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
81 git-applymbox.sh git-applypatch.sh \
82 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
83 git-merge-resolve.sh git-grep.sh
86 git-archimport.perl git-cvsimport.perl git-relink.perl \
87 git-rename.perl git-shortlog.perl
90 git-merge-recursive.py
92 # The ones that do not have to link with lcrypto nor lz.
94 git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
97 # ... and all the rest
99 git-apply git-cat-file \
100 git-checkout-index git-clone-pack git-commit-tree \
101 git-convert-objects git-diff-files \
102 git-diff-helper git-diff-index git-diff-stages \
103 git-diff-tree git-export git-fetch-pack git-fsck-objects \
104 git-hash-object git-init-db \
105 git-local-fetch git-ls-files git-ls-tree git-merge-base \
106 git-merge-index git-mktag git-pack-objects git-patch-id \
107 git-peek-remote git-prune-packed git-read-tree \
108 git-receive-pack git-rev-list git-rev-parse \
109 git-rev-tree git-send-pack git-show-branch \
110 git-show-index git-ssh-fetch \
111 git-ssh-upload git-tar-tree git-unpack-file \
112 git-unpack-objects git-update-index git-update-server-info \
113 git-upload-pack git-verify-pack git-write-tree \
116 # Backward compatibility -- to be removed in 0.99.8
117 PROGRAMS
+= git-ssh-pull git-ssh-push
122 ifdef WITH_OWN_SUBPROCESS_PY
123 PYMODULES
+= compat
/subprocess.py
126 ifdef WITH_SEND_EMAIL
127 SCRIPT_PERL
+= git-send-email.perl
131 PROGRAMS
+= git-http-fetch
137 blob.h cache.h commit.h count-delta.h csum-file.h delta.h \
138 diff.h epoch.h object.h pack.h pkt-line.h quote.h refs.h \
139 run-command.h strbuf.h tag.h tree.h
142 diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
143 diffcore-pickaxe.o diffcore-rename.o
146 blob.o commit.o connect.o count-delta.o csum-file.o \
147 date.o diff-delta.o entry.o ident.o index.o \
148 object.o pack-check.o patch-delta.o path.o pkt-line.o \
149 quote.o read-cache.o refs.o run-command.o \
150 server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
151 tag.o tree.o usage.o
$(DIFF_OBJS
)
156 ifeq ($(shell uname
-s
),Darwin
)
157 NEEDS_SSL_WITH_CRYPTO
= YesPlease
158 NEEDS_LIBICONV
= YesPlease
160 ifeq ($(shell uname
-s
),SunOS
)
161 NEEDS_SOCKET
= YesPlease
162 NEEDS_NSL
= YesPlease
163 PLATFORM_DEFINES
+= -D__EXTENSIONS__
170 PERL_PATH
= /usr
/bin
/perl
173 PYTHON_PATH
= /usr
/bin
/python
178 OPENSSL_LIBSSL
= -lssl
180 DEFINES
+= '-DNO_OPENSSL'
184 ifdef NEEDS_SSL_WITH_CRYPTO
185 LIB_4_CRYPTO
= -lcrypto
-lssl
187 LIB_4_CRYPTO
= -lcrypto
190 LIB_4_ICONV
= -liconv
195 SHA1_HEADER
= "mozilla-sha1/sha1.h"
196 LIB_OBJS
+= mozilla-sha1
/sha1.o
199 SHA1_HEADER
= "ppc/sha1.h"
200 LIB_OBJS
+= ppc
/sha1.o ppc
/sha1ppc.o
202 SHA1_HEADER
= <openssl
/sha.h
>
203 LIBS
+= $(LIB_4_CRYPTO
)
208 SIMPLE_LIB
+= -lsocket
215 DEFINES
+= -Dstrcasestr
=gitstrcasestr
216 LIB_OBJS
+= compat
/strcasestr.o
219 DEFINES
+= '-DSHA1_HEADER=$(SHA1_HEADER)'
221 SCRIPTS
= $(patsubst %.sh
,%,$(SCRIPT_SH
)) \
222 $(patsubst %.perl
,%,$(SCRIPT_PERL
)) \
223 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) \
228 all: $(PROGRAMS
) $(SCRIPTS
)
235 sed
-e
's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh
>$@
+
239 $(filter-out git
,$(patsubst %.sh
,%,$(SCRIPT_SH
))) : % : %.sh
241 sed
-e
'1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh
>$@
244 $(patsubst %.perl
,%,$(SCRIPT_PERL
)) : % : %.perl
246 sed
-e
'1s|#!.*perl|#!$(PERL_PATH)|' $@.perl
>$@
249 $(patsubst %.py
,%,$(SCRIPT_PYTHON
)) : % : %.py
251 sed
-e
'1s|#!.*python|#!$(PYTHON_PATH)|' \
252 -e
's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \
257 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) $<
259 $(CC
) -o
$*.o
-c
$(ALL_CFLAGS
) $<
261 git-
%: %.o
$(LIB_FILE
)
262 $(CC
) $(ALL_CFLAGS
) -o
$@
$(filter %.o
,$^
) $(LIBS
)
264 git-mailinfo
: SIMPLE_LIB
+= $(LIB_4_ICONV
)
265 $(SIMPLE_PROGRAMS
) : $(LIB_FILE
)
266 $(SIMPLE_PROGRAMS
) : git-
% : %.o
267 $(CC
) $(ALL_CFLAGS
) -o
$@
$(filter %.o
,$^
) $(LIB_FILE
) $(SIMPLE_LIB
)
269 git-http-fetch
: fetch.o
270 git-local-fetch
: fetch.o
271 git-ssh-fetch
: rsh.o fetch.o
272 git-ssh-upload
: rsh.o
273 git-ssh-pull
: rsh.o fetch.o
276 git-http-fetch
: LIBS
+= -lcurl
277 git-rev-list
: LIBS
+= $(OPENSSL_LIBSSL
)
280 $(CC
) -c
$(ALL_CFLAGS
) \
281 -DDEFAULT_GIT_TEMPLATE_DIR
='"$(template_dir)"' $*.c
283 $(LIB_OBJS
): $(LIB_H
)
284 $(patsubst git-
%,%.o
,$(PROGRAMS
)): $(LIB_H
)
285 $(DIFF_OBJS
): diffcore.h
287 $(LIB_FILE
): $(LIB_OBJS
)
288 $(AR
) rcs
$@
$(LIB_OBJS
)
291 $(MAKE
) -C Documentation
all
299 test-date
: test-date.c date.o
300 $(CC
) $(ALL_CFLAGS
) -o
$@ test-date.c date.o
302 test-delta
: test-delta.c diff-delta.o patch-delta.o
303 $(CC
) $(ALL_CFLAGS
) -o
$@
$^
306 for i in
*.c
; do sparse
$(ALL_CFLAGS
) $(SPARSE_FLAGS
) $$i; done
310 ### Installation rules
312 install: $(PROGRAMS
) $(SCRIPTS
)
313 $(INSTALL
) -d
-m755
$(DESTDIR
)$(bindir)
314 $(INSTALL
) $(PROGRAMS
) $(SCRIPTS
) $(DESTDIR
)$(bindir)
315 $(INSTALL
) git-revert
$(DESTDIR
)$(bindir)/git-cherry-pick
316 sh .
/cmd-rename.sh
$(DESTDIR
)$(bindir)
317 $(MAKE
) -C templates
install
318 $(INSTALL
) -d
-m755
$(DESTDIR
)$(GIT_PYTHON_DIR
)
319 $(INSTALL
) $(PYMODULES
) $(DESTDIR
)$(GIT_PYTHON_DIR
)
322 $(MAKE
) -C Documentation
install
327 ### Maintainer's dist rules
329 git-core.spec
: git-core.spec.in Makefile
330 sed
-e
's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
332 GIT_TARNAME
=git-core-
$(GIT_VERSION
)
333 dist: git-core.spec git-tar-tree
334 .
/git-tar-tree HEAD
$(GIT_TARNAME
) > $(GIT_TARNAME
).
tar
335 @mkdir
-p
$(GIT_TARNAME
)
336 @cp git-core.spec
$(GIT_TARNAME
)
337 tar rf
$(GIT_TARNAME
).
tar $(GIT_TARNAME
)/git-core.spec
338 @
rm -rf
$(GIT_TARNAME
)
339 gzip
-f
-9 $(GIT_TARNAME
).
tar
342 $(RPMBUILD
) -ta git-core-
$(GIT_VERSION
).
tar.gz
345 rm -rf
$(GIT_TARNAME
)
346 tar zxf
$(GIT_TARNAME
).
tar.gz
347 dpkg-source
-b
$(GIT_TARNAME
)
348 cd
$(GIT_TARNAME
) && fakeroot debian
/rules binary
353 rm -f
*.o mozilla-sha1
/*.o ppc
/*.o
$(PROGRAMS
) $(LIB_FILE
)
354 rm -f
$(filter-out gitk
,$(SCRIPTS
))
356 rm -rf
$(GIT_TARNAME
)
357 rm -f
$(GIT_TARNAME
).
tar.gz git-core_
$(GIT_VERSION
)-*.
tar.gz
358 rm -f git-core_
$(GIT_VERSION
)-*.deb git-core_
$(GIT_VERSION
)-*.dsc
359 rm -f git-tk_
$(GIT_VERSION
)-*.deb
360 $(MAKE
) -C Documentation
/ clean
361 $(MAKE
) -C templates
/ clean