Add "mkpath()" helper function
[git/git.git] / Makefile
CommitLineData
5c2a7fbc
PB
1# -DCOLLISION_CHECK if you believe that SHA1's
2# 1461501637330902918203684832716283019655932542976 hashes do not give you
3# enough guarantees about no collisions between objects ever hapenning.
bdd4da59 4#
2cb45e95
LT
5# -DUSE_NSEC if you want git to care about sub-second file mtimes and ctimes.
6# -DUSE_STDEV if you want git to care about st_dev changing
7#
bdd4da59
PB
8# Note that you need some new glibc (at least >2.2.4) for this, and it will
9# BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
10# break unless your underlying filesystem supports those sub-second times
11# (my ext3 doesn't).
a9db2974
CW
12GIT_VERSION=0.99
13
1a3e7176 14COPTS=-O2
29c2cce4
TG
15CFLAGS=-g $(COPTS) -Wall
16
17prefix=$(HOME)
18bin=$(prefix)/bin
19# dest=
5c2a7fbc 20
e83c5163 21CC=gcc
0a02ce72 22AR=ar
29c2cce4 23INSTALL=install
e83c5163 24
44c9e859
LT
25#
26# sparse is architecture-neutral, which means that we need to tell it
27# explicitly what architecture to check for. Fix this up for yours..
28#
29SPARSE_FLAGS=-D__BIG_ENDIAN__ -D__powerpc__
30
e764b8e8 31SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \
e002a16b 32 git-pull-script git-tag-script git-resolve-script git-whatchanged \
c4584ae3 33 git-fetch-script git-status-script git-commit-script \
40d8cfe4 34 git-log-script git-shortlog git-cvsimport-script git-diff-script \
3f571e0b 35 git-reset-script git-add-script git-checkout-script git-clone-script \
0acfc972 36 gitk git-cherry git-rebase-script git-relink-script git-repack-script \
51cb06c3 37 git-format-patch-script git-sh-setup-script git-push-script
bdd4da59 38
a3df1801
LT
39PROG= git-update-cache git-diff-files git-init-db git-write-tree \
40 git-read-tree git-commit-tree git-cat-file git-fsck-cache \
9b23b4bc 41 git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
a3df1801
LT
42 git-check-files git-ls-tree git-merge-base git-merge-cache \
43 git-unpack-file git-export git-diff-cache git-convert-cache \
418aaf84 44 git-http-pull git-ssh-push git-ssh-pull git-rev-list git-mktag \
99665af5 45 git-diff-helper git-tar-tree git-local-pull git-write-blob \
c4584ae3 46 git-get-tar-commit-id git-apply git-stripspace \
def88e9a
LT
47 git-diff-stages git-rev-parse git-patch-id git-pack-objects \
48 git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
0271611e
LT
49 git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
50 git-show-index
e83c5163
LT
51
52all: $(PROG)
53
cd2fb81d 54install: $(PROG) $(SCRIPTS)
a9db2974 55 $(INSTALL) -m755 -d $(dest)$(bin)
29c2cce4 56 $(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)
e83c5163 57
ecee9d9e 58LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
26c8a533 59 tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
f7192598 60 epoch.o refs.o csum-file.o pack-check.o pkt-line.o connect.o
0a02ce72 61LIB_FILE=libgit.a
f3a3214e 62LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \
44c9e859 63 pack.h pkt-line.h refs.h
0a02ce72 64
d1df5743
JH
65LIB_H += strbuf.h
66LIB_OBJS += strbuf.o
67
6fb737be
JH
68LIB_H += quote.h
69LIB_OBJS += quote.o
70
85976974
JH
71LIB_H += diff.h count-delta.h
72LIB_OBJS += diff.o diffcore-rename.o diffcore-pickaxe.o diffcore-pathspec.o \
af5323e0 73 count-delta.o diffcore-break.o diffcore-order.o
86436c28 74
d19938ab
JH
75LIB_OBJS += gitenv.o
76
cc1ad5c8
LT
77LIBS = $(LIB_FILE)
78LIBS += -lz
cef661fc
LT
79
80ifdef MOZILLA_SHA1
81 SHA1_HEADER="mozilla-sha1/sha1.h"
82 LIB_OBJS += mozilla-sha1/sha1.o
a6ef3518
PM
83else
84ifdef PPC_SHA1
85 SHA1_HEADER="ppc/sha1.h"
86 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
cef661fc
LT
87else
88 SHA1_HEADER=<openssl/sha.h>
3be4b61a 89 LIBS += -lcrypto
cef661fc 90endif
a6ef3518 91endif
cef661fc
LT
92
93CFLAGS += '-DSHA1_HEADER=$(SHA1_HEADER)'
cc1ad5c8 94
0a02ce72
LT
95$(LIB_FILE): $(LIB_OBJS)
96 $(AR) rcs $@ $(LIB_OBJS)
97
44c9e859
LT
98check:
99 for i in *.c; do sparse $(CFLAGS) $(SPARSE_FLAGS) $$i; done
100
89967023
LT
101test-date: test-date.c date.o
102 $(CC) $(CFLAGS) -o $@ test-date.c date.o
103
a310d434
NP
104test-delta: test-delta.c diff-delta.o patch-delta.o
105 $(CC) $(CFLAGS) -o $@ $^
106
a3df1801 107git-%: %.c $(LIB_FILE)
6eb7ed54
DB
108 $(CC) $(CFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
109
a3df1801
LT
110git-update-cache: update-cache.c
111git-diff-files: diff-files.c
112git-init-db: init-db.c
113git-write-tree: write-tree.c
114git-read-tree: read-tree.c
115git-commit-tree: commit-tree.c
116git-cat-file: cat-file.c
117git-fsck-cache: fsck-cache.c
118git-checkout-cache: checkout-cache.c
119git-diff-tree: diff-tree.c
120git-rev-tree: rev-tree.c
9b23b4bc 121git-ls-files: ls-files.c
a3df1801
LT
122git-check-files: check-files.c
123git-ls-tree: ls-tree.c
124git-merge-base: merge-base.c
125git-merge-cache: merge-cache.c
126git-unpack-file: unpack-file.c
127git-export: export.c
128git-diff-cache: diff-cache.c
129git-convert-cache: convert-cache.c
4250a5e5 130git-http-pull: http-pull.c pull.c
dfcb4057 131git-local-pull: local-pull.c pull.c
418aaf84
JH
132git-ssh-push: rsh.c
133git-ssh-pull: rsh.c pull.c
a3df1801
LT
134git-rev-list: rev-list.c
135git-mktag: mktag.c
99665af5 136git-diff-helper: diff-helper.c
a3df1801 137git-tar-tree: tar-tree.c
74400e71 138git-write-blob: write-blob.c
a3e870f2 139git-stripspace: stripspace.c
22f77b77 140git-diff-stages: diff-stages.c
178cb243 141git-rev-parse: rev-parse.c
f9767222 142git-patch-id: patch-id.c
c323ac7d 143git-pack-objects: pack-objects.c
bad50dc8 144git-unpack-objects: unpack-objects.c
f9253394 145git-verify-pack: verify-pack.c
575f4974 146git-receive-pack: receive-pack.c
61221472 147git-send-pack: send-pack.c
2396ec85 148git-prune-packed: prune-packed.c
def88e9a 149git-fetch-pack: fetch-pack.c
a3df1801
LT
150
151git-http-pull: LIBS += -lcurl
64de3562 152git-rev-list: LIBS += -lssl
a3df1801
LT
153
154# Library objects..
e590d694 155blob.o: $(LIB_H)
a3df1801 156tree.o: $(LIB_H)
e590d694 157commit.o: $(LIB_H)
a3df1801 158tag.o: $(LIB_H)
e590d694
LT
159object.o: $(LIB_H)
160read-cache.o: $(LIB_H)
e590d694 161sha1_file.o: $(LIB_H)
e590d694 162usage.o: $(LIB_H)
e515f318 163strbuf.o: $(LIB_H)
d19938ab 164gitenv.o: $(LIB_H)
6ee67f26 165entry.o: $(LIB_H)
6b14d7fa
JH
166diff.o: $(LIB_H) diffcore.h
167diffcore-rename.o : $(LIB_H) diffcore.h
168diffcore-pathspec.o : $(LIB_H) diffcore.h
169diffcore-pickaxe.o : $(LIB_H) diffcore.h
f345b0a0 170diffcore-break.o : $(LIB_H) diffcore.h
af5323e0 171diffcore-order.o : $(LIB_H) diffcore.h
a3437b8c 172epoch.o: $(LIB_H)
e83c5163 173
a9db2974
CW
174git.spec: git.spec.in
175 sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
176
177GIT_TARNAME=git-$(GIT_VERSION)
178dist: git.spec
179 git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
180 @mkdir -p $(GIT_TARNAME)
181 @cp git.spec $(GIT_TARNAME)
182 tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git.spec
183 @rm -rf $(GIT_TARNAME)
184 gzip -9 $(GIT_TARNAME).tar
185
186rpm: dist
187 rpmbuild -ta git-$(GIT_VERSION).tar.gz
188
14cd1ff3 189test: all
ca67f002 190 $(MAKE) -C t/ all
dfe07051 191
e83c5163 192clean:
a6ef3518 193 rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
ca67f002 194 $(MAKE) -C Documentation/ clean
e83c5163
LT
195
196backup: clean
197 cd .. ; tar czvf dircache.tar.gz dir-cache