1111#
1212# Define PPC_SHA1 environment variable when running make to make use of
1313# a bundled SHA1 routine optimized for PowerPC.
14-
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).
1517
1618# Define COLLISION_CHECK below if you believe that SHA1's
1719# 1461501637330902918203684832716283019655932542976 hashes do not give you
@@ -66,26 +68,34 @@ SCRIPTS=git git-merge-one-file-script git-prune-script \
6668 git-format-patch-script git-sh-setup-script git-push-script \
6769 git-branch-script git-parse-remote-script git-verify-tag-script \
6870 git-ls-remote-script git-rename-script \
69- git-request-pull-script git-bisect-script
71+ git-request-pull-script git-bisect-script \
72+ git-applymbox git-applypatch
7073
7174SCRIPTS += git-count-objects-script
7275SCRIPTS += git-revert-script
7376SCRIPTS += git-octopus-script
7477SCRIPTS += git-archimport-script
7578
79+ # The ones that do not have to link with lcrypto nor lz.
80+ SIMPLE_PROGRAMS = \
81+ git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
82+ git-daemon git-var
83+
84+ # ... and all the rest
7685PROG = git-update-cache git-diff-files git-init-db git-write-tree \
7786 git-read-tree git-commit-tree git-cat-file git-fsck-cache \
7887 git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
7988 git-ls-tree git-merge-base git-merge-cache \
8089 git-unpack-file git-export git-diff-cache git-convert-cache \
8190 git-ssh-push git-ssh-pull git-rev-list git-mktag \
8291 git-diff-helper git-tar-tree git-local-pull git-hash-object \
83- git-get-tar-commit-id git- apply git-stripspace \
92+ git-apply \
8493 git-diff-stages git-rev-parse git-patch-id git-pack-objects \
8594 git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
8695 git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
87- git-show-index git-daemon git-var git-peek-remote git-show-branch \
88- git-update-server-info git-show-rev-cache git-build-rev-cache
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 )
8999
90100ifdef WITH_SEND_EMAIL
91101SCRIPTS += git-send-email-script
@@ -126,6 +136,11 @@ LIB_OBJS += server-info.o
126136LIBS = $(LIB_FILE )
127137LIBS += -lz
128138
139+ ifeq ($(shell uname -s) ,Darwin)
140+ NEEDS_SSL_WITH_CRYPTO = YesPlease
141+ NEEDS_LIBICONV = YesPlease
142+ endif
143+
129144ifndef NO_OPENSSL
130145 LIB_OBJS += epoch.o
131146 OPENSSL_LIBSSL=-lssl
@@ -134,6 +149,16 @@ else
134149 MOZILLA_SHA1=1
135150 OPENSSL_LIBSSL=
136151endif
152+ ifdef NEEDS_SSL_WITH_CRYPTO
153+ LIB_4_CRYPTO = -lcrypto -lssl
154+ else
155+ LIB_4_CRYPTO = -lcrypto
156+ endif
157+ ifdef NEEDS_LIBICONV
158+ LIB_4_ICONV = -liconv
159+ else
160+ LIB_4_ICONV =
161+ endif
137162ifdef MOZILLA_SHA1
138163 SHA1_HEADER="mozilla-sha1/sha1.h"
139164 LIB_OBJS += mozilla-sha1/sha1.o
@@ -143,11 +168,7 @@ else
143168 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
144169 else
145170 SHA1_HEADER=<openssl/sha.h>
146- ifeq ($(shell uname -s),Darwin)
147- LIBS += -lcrypto -lssl
148- else
149- LIBS += -lcrypto
150- endif
171+ LIBS += $(LIB_4_CRYPTO)
151172 endif
152173endif
153174
@@ -161,7 +182,6 @@ all: $(PROG)
161182
162183all :
163184 $(MAKE ) -C templates
164- $(MAKE ) -C tools
165185
166186% .o : % .c
167187 $(CC ) -o $* .o -c $(ALL_CFLAGS ) $<
@@ -171,6 +191,11 @@ all:
171191git-% : % .o $(LIB_FILE )
172192 $(CC ) $(ALL_CFLAGS ) -o $@ $(filter % .o,$^ ) $(LIBS )
173193
194+ git-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+
174199git-http-pull : pull.o
175200git-local-pull : pull.o
176201git-ssh-pull : rsh.o pull.o
@@ -218,7 +243,6 @@ install: $(PROG) $(SCRIPTS)
218243 $(INSTALL ) $(PROG ) $(SCRIPTS ) $(DESTDIR )$(bindir )
219244 $(INSTALL ) git-revert-script $(DESTDIR )$(bindir ) /git-cherry-pick-script
220245 $(MAKE ) -C templates install
221- $(MAKE ) -C tools install
222246
223247install-doc :
224248 $(MAKE ) -C Documentation install
@@ -258,7 +282,6 @@ clean:
258282 rm -f $(GIT_TARNAME ) .tar.gz git-core_$(GIT_VERSION ) -* .tar.gz
259283 rm -f git-core_$(GIT_VERSION ) -* .deb git-core_$(GIT_VERSION ) -* .dsc
260284 rm -f git-tk_$(GIT_VERSION ) -* .deb
261- $(MAKE ) -C tools/ clean
262285 $(MAKE ) -C Documentation/ clean
263286 $(MAKE ) -C templates/ clean
264287 $(MAKE ) -C t/ clean
0 commit comments