GIT 0.99.6
[alt-git.git] / Makefile
blob6dbffc23e22895993a6846d7469ed2302f7aa81e
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).
16 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
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.
22 # DEFINES += -DCOLLISION_CHECK
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).
30 # DEFINES += -DUSE_NSEC
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.
35 # DEFINES += -DUSE_STDEV
37 GIT_VERSION = 0.99.6
39 CFLAGS = -g -O2 -Wall
40 ALL_CFLAGS = $(CFLAGS) $(DEFINES)
42 prefix = $(HOME)
43 bindir = $(prefix)/bin
44 template_dir = $(prefix)/share/git-core/templates/
45 # DESTDIR=
47 CC = gcc
48 AR = ar
49 INSTALL = install
50 RPMBUILD = rpmbuild
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..
54 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
58 ### --- END CONFIGURATION SECTION ---
62 SCRIPTS=git git-merge-one-file-script git-prune-script \
63 git-pull-script git-tag-script git-resolve-script git-whatchanged \
64 git-fetch-script git-status-script git-commit-script \
65 git-log-script git-shortlog git-cvsimport-script git-diff-script \
66 git-reset-script git-add-script git-checkout-script git-clone-script \
67 gitk git-cherry git-rebase-script git-relink-script git-repack-script \
68 git-format-patch-script git-sh-setup-script git-push-script \
69 git-branch-script git-parse-remote-script git-verify-tag-script \
70 git-ls-remote-script git-rename-script \
71 git-request-pull-script git-bisect-script \
72 git-applymbox git-applypatch
74 SCRIPTS += git-count-objects-script
75 SCRIPTS += git-revert-script
76 SCRIPTS += git-octopus-script
77 SCRIPTS += git-archimport-script
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
84 # ... and all the rest
85 PROG= 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 \
87 git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
88 git-ls-tree git-merge-base git-merge-cache \
89 git-unpack-file git-export git-diff-cache git-convert-cache \
90 git-ssh-push git-ssh-pull git-rev-list git-mktag \
91 git-diff-helper git-tar-tree git-local-pull git-hash-object \
92 git-apply \
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 \
95 git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
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)
100 ifdef WITH_SEND_EMAIL
101 SCRIPTS += git-send-email-script
102 endif
104 ifndef NO_CURL
105 PROG+= git-http-pull
106 endif
108 LIB_FILE=libgit.a
109 LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \
110 pack.h pkt-line.h refs.h
111 LIB_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 \
113 refs.o csum-file.o pack-check.o pkt-line.o connect.o ident.o \
114 sha1_name.o setup.o
116 LIB_H += rev-cache.h
117 LIB_OBJS += rev-cache.o
119 LIB_H += run-command.h
120 LIB_OBJS += run-command.o
122 LIB_H += strbuf.h
123 LIB_OBJS += strbuf.o
125 LIB_H += quote.h
126 LIB_OBJS += quote.o
128 LIB_H += diff.h count-delta.h
129 DIFF_OBJS = diff.o diffcore-rename.o diffcore-pickaxe.o diffcore-pathspec.o \
130 diffcore-break.o diffcore-order.o
131 LIB_OBJS += $(DIFF_OBJS) count-delta.o
133 LIB_OBJS += gitenv.o
134 LIB_OBJS += server-info.o
136 LIBS = $(LIB_FILE)
137 LIBS += -lz
139 ifeq ($(shell uname -s),Darwin)
140 NEEDS_SSL_WITH_CRYPTO = YesPlease
141 NEEDS_LIBICONV = YesPlease
142 endif
144 ifndef NO_OPENSSL
145 LIB_OBJS += epoch.o
146 OPENSSL_LIBSSL=-lssl
147 else
148 DEFINES += '-DNO_OPENSSL'
149 MOZILLA_SHA1=1
150 OPENSSL_LIBSSL=
151 endif
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
162 ifdef MOZILLA_SHA1
163 SHA1_HEADER="mozilla-sha1/sha1.h"
164 LIB_OBJS += mozilla-sha1/sha1.o
165 else
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>
171 LIBS += $(LIB_4_CRYPTO)
172 endif
173 endif
175 DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
179 ### Build rules
181 all: $(PROG)
183 all:
184 $(MAKE) -C templates
186 %.o: %.c
187 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
188 %.o: %.S
189 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
191 git-%: %.o $(LIB_FILE)
192 $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
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)
199 git-http-pull: pull.o
200 git-local-pull: pull.o
201 git-ssh-pull: rsh.o pull.o
202 git-ssh-push: rsh.o
204 git-http-pull: LIBS += -lcurl
205 git-rev-list: LIBS += $(OPENSSL_LIBSSL)
207 init-db.o: init-db.c
208 $(CC) -c $(ALL_CFLAGS) \
209 -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
211 $(LIB_OBJS): $(LIB_H)
212 $(patsubst git-%,%.o,$(PROG)): $(LIB_H)
213 $(DIFF_OBJS): diffcore.h
215 $(LIB_FILE): $(LIB_OBJS)
216 $(AR) rcs $@ $(LIB_OBJS)
218 doc:
219 $(MAKE) -C Documentation all
223 ### Testing rules
225 test: all
226 $(MAKE) -C t/ all
228 test-date: test-date.c date.o
229 $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o
231 test-delta: test-delta.c diff-delta.o patch-delta.o
232 $(CC) $(ALL_CFLAGS) -o $@ $^
234 check:
235 for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
239 ### Installation rules
241 install: $(PROG) $(SCRIPTS)
242 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
243 $(INSTALL) $(PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
244 $(INSTALL) git-revert-script $(DESTDIR)$(bindir)/git-cherry-pick-script
245 $(MAKE) -C templates install
247 install-doc:
248 $(MAKE) -C Documentation install
253 ### Maintainer's dist rules
255 git-core.spec: git-core.spec.in Makefile
256 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
258 GIT_TARNAME=git-core-$(GIT_VERSION)
259 dist: git-core.spec git-tar-tree
260 ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
261 @mkdir -p $(GIT_TARNAME)
262 @cp git-core.spec $(GIT_TARNAME)
263 tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
264 @rm -rf $(GIT_TARNAME)
265 gzip -f -9 $(GIT_TARNAME).tar
267 rpm: dist
268 $(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz
270 deb: dist
271 rm -rf $(GIT_TARNAME)
272 tar zxf $(GIT_TARNAME).tar.gz
273 dpkg-source -b $(GIT_TARNAME)
274 cd $(GIT_TARNAME) && fakeroot debian/rules binary
276 ### Cleaning rules
278 clean:
279 rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
280 rm -f git-core.spec
281 rm -rf $(GIT_TARNAME)
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
285 $(MAKE) -C Documentation/ clean
286 $(MAKE) -C templates/ clean
287 $(MAKE) -C t/ clean