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.
4#
5# -DNSEC if you want git to care about sub-second file mtimes and ctimes.
6# Note that you need some new glibc (at least >2.2.4) for this, and it will
7# BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
8# break unless your underlying filesystem supports those sub-second times
9# (my ext3 doesn't).
10CFLAGS=-g -O2 -Wall
11
12CC=gcc
13AR=ar
14
15SCRIPTS=git-merge-one-file-script git-prune-script git-pull-script git-tag-script
16
17PROG= update-cache show-diff init-db write-tree read-tree commit-tree \
18 cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \
19 check-files ls-tree merge-base merge-cache unpack-file git-export \
20 diff-cache convert-cache http-pull rpush rpull rev-list git-mktag \
21 diff-tree-helper
22
23all: $(PROG)
24
25install: $(PROG) $(SCRIPTS)
26 install $(PROG) $(SCRIPTS) $(HOME)/bin/
27
28LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o
29LIB_FILE=libgit.a
30LIB_H=cache.h object.h
31
32LIB_H += strbuf.h
33LIB_OBJS += strbuf.o
34
35LIB_H += diff.h
36LIB_OBJS += diff.o
37
38LIBS = $(LIB_FILE)
39LIBS += -lz
40
41ifdef MOZILLA_SHA1
42 SHA1_HEADER="mozilla-sha1/sha1.h"
43 LIB_OBJS += mozilla-sha1/sha1.o
44else
45ifdef PPC_SHA1
46 SHA1_HEADER="ppc/sha1.h"
47 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
48else
49 SHA1_HEADER=<openssl/sha.h>
50 LIBS += -lssl
51endif
52endif
53
54CFLAGS += '-DSHA1_HEADER=$(SHA1_HEADER)'
55
56$(LIB_FILE): $(LIB_OBJS)
57 $(AR) rcs $@ $(LIB_OBJS)
58
59init-db: init-db.o
60
61%: %.c $(LIB_FILE)
62 $(CC) $(CFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
63
64rpush: rsh.c
65
66rpull: rsh.c
67
68http-pull: LIBS += -lcurl
69
70blob.o: $(LIB_H)
71cat-file.o: $(LIB_H)
72check-files.o: $(LIB_H)
73checkout-cache.o: $(LIB_H)
74commit.o: $(LIB_H)
75commit-tree.o: $(LIB_H)
76convert-cache.o: $(LIB_H)
77diff.o: $(LIB_H)
78diff-cache.o: $(LIB_H)
79diff-tree.o: $(LIB_H)
80fsck-cache.o: $(LIB_H)
81git-export.o: $(LIB_H)
82init-db.o: $(LIB_H)
83ls-tree.o: $(LIB_H)
84merge-base.o: $(LIB_H)
85merge-cache.o: $(LIB_H)
86object.o: $(LIB_H)
87read-cache.o: $(LIB_H)
88read-tree.o: $(LIB_H)
89rev-tree.o: $(LIB_H)
90sha1_file.o: $(LIB_H)
91show-diff.o: $(LIB_H)
92show-files.o: $(LIB_H)
93tree.o: $(LIB_H)
94update-cache.o: $(LIB_H)
95usage.o: $(LIB_H)
96unpack-file.o: $(LIB_H)
97write-tree.o: $(LIB_H)
98http-pull.o: $(LIB_H)
99rpull.o: $(LIB_H)
100rpush.o: $(LIB_H)
101
102clean:
103 rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
104
105backup: clean
106 cd .. ; tar czvf dircache.tar.gz dir-cache