Makefileon commit GIT 0.99.6 (99977bd)
   1# Define MOZILLA_SHA1 environment variable when running make to make use of
   2# a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
   3# on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
   4# choice) has very fast version optimized for i586.
   5#
   6# Define NO_OPENSSL environment variable if you do not have OpenSSL. You will
   7# miss out git-rev-list --merge-order. This also implies MOZILLA_SHA1.
   8#
   9# Define NO_CURL if you do not have curl installed.  git-http-pull is not
  10# built, and you cannot use http:// and https:// transports.
  11#
  12# Define PPC_SHA1 environment variable when running make to make use of
  13# a bundled SHA1 routine optimized for PowerPC.
  14#
  15# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
  16# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
  17
  18# Define COLLISION_CHECK below if you believe that SHA1's
  19# 1461501637330902918203684832716283019655932542976 hashes do not give you
  20# sufficient guarantee that no collisions between objects will ever happen.
  21
  22# DEFINES += -DCOLLISION_CHECK
  23
  24# Define USE_NSEC below if you want git to care about sub-second file mtimes
  25# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
  26# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
  27# randomly break unless your underlying filesystem supports those sub-second
  28# times (my ext3 doesn't).
  29
  30# DEFINES += -DUSE_NSEC
  31
  32# Define USE_STDEV below if you want git to care about the underlying device
  33# change being considered an inode change from the update-cache perspective.
  34
  35# DEFINES += -DUSE_STDEV
  36
  37GIT_VERSION = 0.99.6
  38
  39CFLAGS = -g -O2 -Wall
  40ALL_CFLAGS = $(CFLAGS) $(DEFINES)
  41
  42prefix = $(HOME)
  43bindir = $(prefix)/bin
  44template_dir = $(prefix)/share/git-core/templates/
  45# DESTDIR=
  46
  47CC = gcc
  48AR = ar
  49INSTALL = install
  50RPMBUILD = rpmbuild
  51
  52# sparse is architecture-neutral, which means that we need to tell it
  53# explicitly what architecture to check for. Fix this up for yours..
  54SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
  55
  56
  57
  58### --- END CONFIGURATION SECTION ---
  59
  60
  61
  62SCRIPTS=git git-merge-one-file-script git-prune-script \
  63        git-pull-script git-tag-script git-resolve-script git-whatchanged \
  64        git-fetch-script git-status-script git-commit-script \
  65        git-log-script git-shortlog git-cvsimport-script git-diff-script \
  66        git-reset-script git-add-script git-checkout-script git-clone-script \
  67        gitk git-cherry git-rebase-script git-relink-script git-repack-script \
  68        git-format-patch-script git-sh-setup-script git-push-script \
  69        git-branch-script git-parse-remote-script git-verify-tag-script \
  70        git-ls-remote-script git-rename-script \
  71        git-request-pull-script git-bisect-script \
  72        git-applymbox git-applypatch
  73
  74SCRIPTS += git-count-objects-script
  75SCRIPTS += git-revert-script
  76SCRIPTS += git-octopus-script
  77SCRIPTS += git-archimport-script
  78
  79# The ones that do not have to link with lcrypto nor lz.
  80SIMPLE_PROGRAMS = \
  81        git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
  82        git-daemon git-var
  83
  84# ... and all the rest
  85PROG=   git-update-cache git-diff-files git-init-db git-write-tree \
  86        git-read-tree git-commit-tree git-cat-file git-fsck-cache \
  87        git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
  88        git-ls-tree git-merge-base git-merge-cache \
  89        git-unpack-file git-export git-diff-cache git-convert-cache \
  90        git-ssh-push git-ssh-pull git-rev-list git-mktag \
  91        git-diff-helper git-tar-tree git-local-pull git-hash-object \
  92        git-apply \
  93        git-diff-stages git-rev-parse git-patch-id git-pack-objects \
  94        git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
  95        git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
  96        git-show-index git-peek-remote git-show-branch \
  97        git-update-server-info git-show-rev-cache git-build-rev-cache \
  98        $(SIMPLE_PROGRAMS)
  99
 100ifdef WITH_SEND_EMAIL
 101SCRIPTS += git-send-email-script
 102endif
 103
 104ifndef NO_CURL
 105        PROG+= git-http-pull
 106endif
 107
 108LIB_FILE=libgit.a
 109LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h \
 110        pack.h pkt-line.h refs.h
 111LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
 112         tag.o date.o index.o diff-delta.o patch-delta.o entry.o path.o \
 113         refs.o csum-file.o pack-check.o pkt-line.o connect.o ident.o \
 114         sha1_name.o setup.o
 115
 116LIB_H += rev-cache.h
 117LIB_OBJS += rev-cache.o
 118
 119LIB_H += run-command.h
 120LIB_OBJS += run-command.o
 121
 122LIB_H += strbuf.h
 123LIB_OBJS += strbuf.o
 124
 125LIB_H += quote.h
 126LIB_OBJS += quote.o 
 127
 128LIB_H += diff.h count-delta.h
 129DIFF_OBJS = diff.o diffcore-rename.o diffcore-pickaxe.o diffcore-pathspec.o \
 130        diffcore-break.o diffcore-order.o
 131LIB_OBJS += $(DIFF_OBJS) count-delta.o
 132
 133LIB_OBJS += gitenv.o
 134LIB_OBJS += server-info.o
 135
 136LIBS = $(LIB_FILE)
 137LIBS += -lz
 138
 139ifeq ($(shell uname -s),Darwin)
 140        NEEDS_SSL_WITH_CRYPTO = YesPlease
 141        NEEDS_LIBICONV = YesPlease
 142endif
 143
 144ifndef NO_OPENSSL
 145        LIB_OBJS += epoch.o
 146        OPENSSL_LIBSSL=-lssl
 147else
 148        DEFINES += '-DNO_OPENSSL'
 149        MOZILLA_SHA1=1
 150        OPENSSL_LIBSSL=
 151endif
 152ifdef NEEDS_SSL_WITH_CRYPTO
 153        LIB_4_CRYPTO = -lcrypto -lssl
 154else
 155        LIB_4_CRYPTO = -lcrypto
 156endif
 157ifdef NEEDS_LIBICONV
 158        LIB_4_ICONV = -liconv
 159else
 160        LIB_4_ICONV =
 161endif
 162ifdef MOZILLA_SHA1
 163        SHA1_HEADER="mozilla-sha1/sha1.h"
 164        LIB_OBJS += mozilla-sha1/sha1.o
 165else
 166        ifdef PPC_SHA1
 167                SHA1_HEADER="ppc/sha1.h"
 168                LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
 169        else
 170                SHA1_HEADER=<openssl/sha.h>
 171                LIBS += $(LIB_4_CRYPTO)
 172        endif
 173endif
 174
 175DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 176
 177
 178
 179### Build rules
 180
 181all: $(PROG)
 182
 183all:
 184        $(MAKE) -C templates
 185
 186%.o: %.c
 187        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 188%.o: %.S
 189        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 190
 191git-%: %.o $(LIB_FILE)
 192        $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
 193
 194git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV)
 195$(SIMPLE_PROGRAMS) : $(LIB_FILE)
 196$(SIMPLE_PROGRAMS) : git-% : %.o
 197        $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB)
 198
 199git-http-pull: pull.o
 200git-local-pull: pull.o
 201git-ssh-pull: rsh.o pull.o
 202git-ssh-push: rsh.o
 203
 204git-http-pull: LIBS += -lcurl
 205git-rev-list: LIBS += $(OPENSSL_LIBSSL)
 206
 207init-db.o: init-db.c
 208        $(CC) -c $(ALL_CFLAGS) \
 209                -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
 210
 211$(LIB_OBJS): $(LIB_H)
 212$(patsubst git-%,%.o,$(PROG)): $(LIB_H)
 213$(DIFF_OBJS): diffcore.h
 214
 215$(LIB_FILE): $(LIB_OBJS)
 216        $(AR) rcs $@ $(LIB_OBJS)
 217
 218doc:
 219        $(MAKE) -C Documentation all
 220
 221
 222
 223### Testing rules
 224
 225test: all
 226        $(MAKE) -C t/ all
 227
 228test-date: test-date.c date.o
 229        $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o
 230
 231test-delta: test-delta.c diff-delta.o patch-delta.o
 232        $(CC) $(ALL_CFLAGS) -o $@ $^
 233
 234check:
 235        for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
 236
 237
 238
 239### Installation rules
 240
 241install: $(PROG) $(SCRIPTS)
 242        $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
 243        $(INSTALL) $(PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
 244        $(INSTALL) git-revert-script $(DESTDIR)$(bindir)/git-cherry-pick-script
 245        $(MAKE) -C templates install
 246
 247install-doc:
 248        $(MAKE) -C Documentation install
 249
 250
 251
 252
 253### Maintainer's dist rules
 254
 255git-core.spec: git-core.spec.in Makefile
 256        sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
 257
 258GIT_TARNAME=git-core-$(GIT_VERSION)
 259dist: git-core.spec git-tar-tree
 260        ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
 261        @mkdir -p $(GIT_TARNAME)
 262        @cp git-core.spec $(GIT_TARNAME)
 263        tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
 264        @rm -rf $(GIT_TARNAME)
 265        gzip -f -9 $(GIT_TARNAME).tar
 266
 267rpm: dist
 268        $(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz
 269
 270deb: dist
 271        rm -rf $(GIT_TARNAME)
 272        tar zxf $(GIT_TARNAME).tar.gz
 273        dpkg-source -b $(GIT_TARNAME)
 274        cd $(GIT_TARNAME) && fakeroot debian/rules binary
 275
 276### Cleaning rules
 277
 278clean:
 279        rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
 280        rm -f git-core.spec
 281        rm -rf $(GIT_TARNAME)
 282        rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 283        rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
 284        rm -f git-tk_$(GIT_VERSION)-*.deb
 285        $(MAKE) -C Documentation/ clean
 286        $(MAKE) -C templates/ clean
 287        $(MAKE) -C t/ clean