Makefileon commit Add support for alternate SHA1 library implementations. (cef661f)
   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
  15
  16PROG=   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
  21all: $(PROG)
  22
  23install: $(PROG)
  24        install $(PROG) $(HOME)/bin/
  25
  26LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o
  27LIB_FILE=libgit.a
  28LIB_H=cache.h object.h
  29
  30LIBS = $(LIB_FILE)
  31LIBS += -lz
  32
  33ifdef MOZILLA_SHA1
  34  SHA1_HEADER="mozilla-sha1/sha1.h"
  35  LIB_OBJS += mozilla-sha1/sha1.o
  36else
  37  SHA1_HEADER=<openssl/sha.h>
  38  LIBS += -lssl
  39endif
  40
  41CFLAGS += '-DSHA1_HEADER=$(SHA1_HEADER)'
  42
  43$(LIB_FILE): $(LIB_OBJS)
  44        $(AR) rcs $@ $(LIB_OBJS)
  45
  46init-db: init-db.o
  47
  48%: %.o $(LIB_FILE)
  49        $(CC) $(CFLAGS) -o $@ $< $(LIBS)
  50
  51blob.o: $(LIB_H)
  52cat-file.o: $(LIB_H)
  53check-files.o: $(LIB_H)
  54checkout-cache.o: $(LIB_H)
  55commit.o: $(LIB_H)
  56commit-tree.o: $(LIB_H)
  57convert-cache.o: $(LIB_H)
  58diff-cache.o: $(LIB_H)
  59diff-tree.o: $(LIB_H)
  60fsck-cache.o: $(LIB_H)
  61git-export.o: $(LIB_H)
  62init-db.o: $(LIB_H)
  63ls-tree.o: $(LIB_H)
  64merge-base.o: $(LIB_H)
  65merge-cache.o: $(LIB_H)
  66object.o: $(LIB_H)
  67read-cache.o: $(LIB_H)
  68read-tree.o: $(LIB_H)
  69rev-tree.o: $(LIB_H)
  70sha1_file.o: $(LIB_H)
  71show-diff.o: $(LIB_H)
  72show-files.o: $(LIB_H)
  73tree.o: $(LIB_H)
  74update-cache.o: $(LIB_H)
  75usage.o: $(LIB_H)
  76unpack-file.o: $(LIB_H)
  77write-tree.o: $(LIB_H)
  78
  79clean:
  80        rm -f *.o mozilla-sha1/*.o $(PROG) $(LIB_FILE)
  81
  82backup: clean
  83        cd .. ; tar czvf dircache.tar.gz dir-cache