Makefile 6.4 KB
Newer Older
1 2 3
# -DCOLLISION_CHECK if you believe that SHA1's
# 1461501637330902918203684832716283019655932542976 hashes do not give you
# enough guarantees about no collisions between objects ever hapenning.
4
#
5 6 7
# -DUSE_NSEC if you want git to care about sub-second file mtimes and ctimes.
# -DUSE_STDEV if you want git to care about st_dev changing
#
8 9 10 11
# Note that you need some new glibc (at least >2.2.4) for this, and it will
# BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
# break unless your underlying filesystem supports those sub-second times
# (my ext3 doesn't).
J
Junio C Hamano 已提交
12
GIT_VERSION=0.99.2
13

L
Linus Torvalds 已提交
14
COPTS=-O2
15 16 17 18 19
CFLAGS=-g $(COPTS) -Wall

prefix=$(HOME)
bin=$(prefix)/bin
# dest=
20

21
CC=gcc
L
Linus Torvalds 已提交
22
AR=ar
23
INSTALL=install
24
RPMBUILD=rpmbuild
25

26 27 28 29 30 31
#
# sparse is architecture-neutral, which means that we need to tell it
# explicitly what architecture to check for. Fix this up for yours..
#
SPARSE_FLAGS=-D__BIG_ENDIAN__ -D__powerpc__

32
SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \
N
Nicolas Pitre 已提交
33
	git-pull-script git-tag-script git-resolve-script git-whatchanged \
34
	git-fetch-script git-status-script git-commit-script \
L
Linus Torvalds 已提交
35
	git-log-script git-shortlog git-cvsimport-script git-diff-script \
L
Linus Torvalds 已提交
36
	git-reset-script git-add-script git-checkout-script git-clone-script \
37
	gitk git-cherry git-rebase-script git-relink-script git-repack-script \
L
Linus Torvalds 已提交
38
	git-format-patch-script git-sh-setup-script git-push-script \
39
	git-branch-script git-parse-remote git-verify-tag-script \
40 41
	git-ls-remote-script git-clone-dumb-http git-rename-script \
	git-request-pull-script
42

43 44
PROG=   git-update-cache git-diff-files git-init-db git-write-tree \
	git-read-tree git-commit-tree git-cat-file git-fsck-cache \
45
	git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
46 47
	git-check-files git-ls-tree git-merge-base git-merge-cache \
	git-unpack-file git-export git-diff-cache git-convert-cache \
48
	git-http-pull git-ssh-push git-ssh-pull git-rev-list git-mktag \
49
	git-diff-helper git-tar-tree git-local-pull git-hash-object \
50
	git-get-tar-commit-id git-apply git-stripspace \
51 52
	git-diff-stages git-rev-parse git-patch-id git-pack-objects \
	git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
53
	git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
J
Junio C Hamano 已提交
54 55
	git-show-index git-daemon git-var git-peek-remote \
	git-update-server-info git-show-rev-cache git-build-rev-cache
56 57 58

all: $(PROG)

59
install: $(PROG) $(SCRIPTS)
60
	$(INSTALL) -m755 -d $(dest)$(bin)
61
	$(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)
62

63
LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
L
Linus Torvalds 已提交
64
	 tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
65
	 epoch.o refs.o csum-file.o pack-check.o pkt-line.o connect.o ident.o
L
Linus Torvalds 已提交
66
LIB_FILE=libgit.a
67
LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \
68
	pack.h pkt-line.h refs.h
L
Linus Torvalds 已提交
69

J
Junio C Hamano 已提交
70 71 72
LIB_H += rev-cache.h
LIB_OBJS += rev-cache.o

73 74 75
LIB_H += strbuf.h
LIB_OBJS += strbuf.o

76 77 78
LIB_H += quote.h
LIB_OBJS += quote.o 

79 80
LIB_H += diff.h count-delta.h
LIB_OBJS += diff.o diffcore-rename.o diffcore-pickaxe.o diffcore-pathspec.o \
81
	count-delta.o diffcore-break.o diffcore-order.o
82

J
Junio C Hamano 已提交
83
LIB_OBJS += gitenv.o
J
Junio C Hamano 已提交
84
LIB_OBJS += server-info.o
J
Junio C Hamano 已提交
85

86 87
LIBS = $(LIB_FILE)
LIBS += -lz
88 89 90 91

ifdef MOZILLA_SHA1
  SHA1_HEADER="mozilla-sha1/sha1.h"
  LIB_OBJS += mozilla-sha1/sha1.o
92 93 94 95
else
ifdef PPC_SHA1
  SHA1_HEADER="ppc/sha1.h"
  LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
96 97
else
  SHA1_HEADER=<openssl/sha.h>
98
  LIBS += -lcrypto
99
endif
100
endif
101 102

CFLAGS += '-DSHA1_HEADER=$(SHA1_HEADER)'
103

L
Linus Torvalds 已提交
104 105 106
$(LIB_FILE): $(LIB_OBJS)
	$(AR) rcs $@ $(LIB_OBJS)

107 108 109
check:
	for i in *.c; do sparse $(CFLAGS) $(SPARSE_FLAGS) $$i; done

110 111 112
test-date: test-date.c date.o
	$(CC) $(CFLAGS) -o $@ test-date.c date.o

113 114 115
test-delta: test-delta.c diff-delta.o patch-delta.o
	$(CC) $(CFLAGS) -o $@ $^

116
git-%: %.c $(LIB_FILE)
117 118
	$(CC) $(CFLAGS) -o $@ $(filter %.c,$^) $(LIBS)

119 120 121 122 123 124 125 126 127 128 129
git-update-cache: update-cache.c
git-diff-files: diff-files.c
git-init-db: init-db.c
git-write-tree: write-tree.c
git-read-tree: read-tree.c
git-commit-tree: commit-tree.c
git-cat-file: cat-file.c
git-fsck-cache: fsck-cache.c
git-checkout-cache: checkout-cache.c
git-diff-tree: diff-tree.c
git-rev-tree: rev-tree.c
130
git-ls-files: ls-files.c
131 132 133 134 135 136 137 138
git-check-files: check-files.c
git-ls-tree: ls-tree.c
git-merge-base: merge-base.c
git-merge-cache: merge-cache.c
git-unpack-file: unpack-file.c
git-export: export.c
git-diff-cache: diff-cache.c
git-convert-cache: convert-cache.c
139
git-http-pull: http-pull.c pull.c
J
Junio C Hamano 已提交
140
git-local-pull: local-pull.c pull.c
141 142
git-ssh-push: rsh.c
git-ssh-pull: rsh.c pull.c
143 144
git-rev-list: rev-list.c
git-mktag: mktag.c
145
git-diff-helper: diff-helper.c
146
git-tar-tree: tar-tree.c
147
git-hash-object: hash-object.c
L
Linus Torvalds 已提交
148
git-stripspace: stripspace.c
149
git-diff-stages: diff-stages.c
150
git-rev-parse: rev-parse.c
151
git-patch-id: patch-id.c
152
git-pack-objects: pack-objects.c
L
Linus Torvalds 已提交
153
git-unpack-objects: unpack-objects.c
154
git-verify-pack: verify-pack.c
155
git-receive-pack: receive-pack.c
156
git-send-pack: send-pack.c
157
git-prune-packed: prune-packed.c
158
git-fetch-pack: fetch-pack.c
159
git-var: var.c
160
git-peek-remote: peek-remote.c
J
Junio C Hamano 已提交
161 162 163
git-update-server-info: update-server-info.c
git-build-rev-cache: build-rev-cache.c
git-show-rev-cache: show-rev-cache.c
164 165

git-http-pull: LIBS += -lcurl
166
git-rev-list: LIBS += -lssl
167 168

# Library objects..
L
Linus Torvalds 已提交
169
blob.o: $(LIB_H)
170
tree.o: $(LIB_H)
L
Linus Torvalds 已提交
171
commit.o: $(LIB_H)
172
tag.o: $(LIB_H)
L
Linus Torvalds 已提交
173 174 175 176
object.o: $(LIB_H)
read-cache.o: $(LIB_H)
sha1_file.o: $(LIB_H)
usage.o: $(LIB_H)
J
Junio C Hamano 已提交
177
rev-cache.o: $(LIB_H)
178
strbuf.o: $(LIB_H)
J
Junio C Hamano 已提交
179
gitenv.o: $(LIB_H)
180
entry.o: $(LIB_H)
J
Junio C Hamano 已提交
181 182 183 184
diff.o: $(LIB_H) diffcore.h
diffcore-rename.o : $(LIB_H) diffcore.h
diffcore-pathspec.o : $(LIB_H) diffcore.h
diffcore-pickaxe.o : $(LIB_H) diffcore.h
185
diffcore-break.o : $(LIB_H) diffcore.h
186
diffcore-order.o : $(LIB_H) diffcore.h
187
epoch.o: $(LIB_H)
188

189
git-core.spec: git-core.spec.in Makefile
190 191
	sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@

192 193
GIT_TARNAME=git-core-$(GIT_VERSION)
dist: git-core.spec git-tar-tree
C
Chris Wright 已提交
194
	./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
195
	@mkdir -p $(GIT_TARNAME)
196 197
	@cp git-core.spec $(GIT_TARNAME)
	tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
198
	@rm -rf $(GIT_TARNAME)
199
	gzip -f -9 $(GIT_TARNAME).tar
200 201

rpm: dist
202
	$(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz
203

204
test: all
205
	$(MAKE) -C t/ all
P
Petr Baudis 已提交
206

207 208 209
doc:
	$(MAKE) -C Documentation all

210 211 212
install-tools:
	$(MAKE) -C tools install

213 214 215
install-doc:
	$(MAKE) -C Documentation install

216
clean:
217
	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
218
	rm -f git-core-*.tar.gz git-core.spec
219
	$(MAKE) -C tools/ clean
220
	$(MAKE) -C Documentation/ clean
221 222 223

backup: clean
	cd .. ; tar czvf dircache.tar.gz dir-cache