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
22all: $(PROG)
23
24install: $(PROG) $(SCRIPTS)
25 install $(PROG) $(SCRIPTS) $(HOME)/bin/
26
27LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o
28LIB_FILE=libgit.a
29LIB_H=cache.h object.h
30
31LIBS = $(LIB_FILE)
32LIBS += -lz
33
34ifdef MOZILLA_SHA1
35 SHA1_HEADER="mozilla-sha1/sha1.h"
36 LIB_OBJS += mozilla-sha1/sha1.o
37else
38ifdef PPC_SHA1
39 SHA1_HEADER="ppc/sha1.h"
40 LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
41else
42 SHA1_HEADER=<openssl/sha.h>
43 LIBS += -lssl
44endif
45endif
46
47CFLAGS += '-DSHA1_HEADER=$(SHA1_HEADER)'
48
49$(LIB_FILE): $(LIB_OBJS)
50 $(AR) rcs $@ $(LIB_OBJS)
51
52init-db: init-db.o
53
54%: %.c $(LIB_FILE)
55 $(CC) $(CFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
56
57rpush: rsh.c
58
59rpull: rsh.c
60
61http-pull: LIBS += -lcurl
62
63blob.o: $(LIB_H)
64cat-file.o: $(LIB_H)
65check-files.o: $(LIB_H)
66checkout-cache.o: $(LIB_H)
67commit.o: $(LIB_H)
68commit-tree.o: $(LIB_H)
69convert-cache.o: $(LIB_H)
70diff-cache.o: $(LIB_H)
71diff-tree.o: $(LIB_H)
72fsck-cache.o: $(LIB_H)
73git-export.o: $(LIB_H)
74init-db.o: $(LIB_H)
75ls-tree.o: $(LIB_H)
76merge-base.o: $(LIB_H)
77merge-cache.o: $(LIB_H)
78object.o: $(LIB_H)
79read-cache.o: $(LIB_H)
80read-tree.o: $(LIB_H)
81rev-tree.o: $(LIB_H)
82sha1_file.o: $(LIB_H)
83show-diff.o: $(LIB_H)
84show-files.o: $(LIB_H)
85tree.o: $(LIB_H)
86update-cache.o: $(LIB_H)
87usage.o: $(LIB_H)
88unpack-file.o: $(LIB_H)
89write-tree.o: $(LIB_H)
90http-pull.o: $(LIB_H)
91rpull.o: $(LIB_H)
92rpush.o: $(LIB_H)
93
94clean:
95 rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
96
97backup: clean
98 cd .. ; tar czvf dircache.tar.gz dir-cache