Split up Makefile library list handling with separate entries for
[git.git] / Makefile
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).
10 CFLAGS=-g -O2 -Wall
11
12 CC=gcc
13 AR=ar
14
15
16 PROG=   update-cache show-diff init-db write-tree read-tree commit-tree \
17         cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \
18         check-files ls-tree merge-base merge-cache unpack-file git-export \
19         diff-cache convert-cache
20
21 all: $(PROG)
22
23 install: $(PROG)
24         install $(PROG) $(HOME)/bin/
25
26 LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o
27 LIB_FILE=libgit.a
28 LIB_H=cache.h object.h
29
30 LIBS = $(LIB_FILE)
31 LIBS += -lz
32 LIBS += -lssl
33
34 $(LIB_FILE): $(LIB_OBJS)
35         $(AR) rcs $@ $(LIB_OBJS)
36
37 init-db: init-db.o
38
39 fsck-cache: fsck-cache.o $(LIB_FILE) object.o commit.o tree.o blob.o
40         $(CC) $(CFLAGS) -o fsck-cache fsck-cache.o $(LIBS)
41
42 rev-tree: rev-tree.o $(LIB_FILE) object.o commit.o tree.o blob.o
43         $(CC) $(CFLAGS) -o rev-tree rev-tree.o $(LIBS)
44
45 merge-base: merge-base.o $(LIB_FILE) object.o commit.o tree.o blob.o
46         $(CC) $(CFLAGS) -o merge-base merge-base.o $(LIBS)
47
48 %: %.o $(LIB_FILE)
49         $(CC) $(CFLAGS) -o $@ $< $(LIBS)
50
51 blob.o: $(LIB_H)
52 cat-file.o: $(LIB_H)
53 check-files.o: $(LIB_H)
54 checkout-cache.o: $(LIB_H)
55 commit.o: $(LIB_H)
56 commit-tree.o: $(LIB_H)
57 convert-cache.o: $(LIB_H)
58 diff-cache.o: $(LIB_H)
59 diff-tree.o: $(LIB_H)
60 fsck-cache.o: $(LIB_H)
61 git-export.o: $(LIB_H)
62 init-db.o: $(LIB_H)
63 ls-tree.o: $(LIB_H)
64 merge-base.o: $(LIB_H)
65 merge-cache.o: $(LIB_H)
66 object.o: $(LIB_H)
67 read-cache.o: $(LIB_H)
68 read-tree.o: $(LIB_H)
69 rev-tree.o: $(LIB_H)
70 sha1_file.o: $(LIB_H)
71 show-diff.o: $(LIB_H)
72 show-files.o: $(LIB_H)
73 tree.o: $(LIB_H)
74 update-cache.o: $(LIB_H)
75 usage.o: $(LIB_H)
76 unpack-file.o: $(LIB_H)
77 write-tree.o: $(LIB_H)
78
79 clean:
80         rm -f *.o $(PROG) $(LIB_FILE)
81
82 backup: clean
83         cd .. ; tar czvf dircache.tar.gz dir-cache