Makefileon commit [PATCH] Update git-core.spec.in (0e60471)
   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#
  17# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
  18#
  19# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
  20# Patrick Mauritz).
  21#
  22# Define NO_GETDOMAINNAME if your library lack it (SunOS, Patrick Mauritz).
  23#
  24# Define COLLISION_CHECK below if you believe that SHA1's
  25# 1461501637330902918203684832716283019655932542976 hashes do not give you
  26# sufficient guarantee that no collisions between objects will ever happen.
  27
  28# DEFINES += -DCOLLISION_CHECK
  29
  30# Define USE_NSEC below if you want git to care about sub-second file mtimes
  31# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
  32# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
  33# randomly break unless your underlying filesystem supports those sub-second
  34# times (my ext3 doesn't).
  35
  36# DEFINES += -DUSE_NSEC
  37
  38# Define USE_STDEV below if you want git to care about the underlying device
  39# change being considered an inode change from the update-cache perspective.
  40
  41# DEFINES += -DUSE_STDEV
  42
  43GIT_VERSION = 0.99.6
  44
  45CFLAGS = -g -O2 -Wall
  46ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES)
  47
  48prefix = $(HOME)
  49bindir = $(prefix)/bin
  50template_dir = $(prefix)/share/git-core/templates/
  51GIT_PYTHON_DIR = $(prefix)/share/git-core/python
  52# DESTDIR=
  53
  54CC = gcc
  55AR = ar
  56INSTALL = install
  57RPMBUILD = rpmbuild
  58
  59# sparse is architecture-neutral, which means that we need to tell it
  60# explicitly what architecture to check for. Fix this up for yours..
  61SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
  62
  63
  64
  65### --- END CONFIGURATION SECTION ---
  66
  67SCRIPT_SH = \
  68        git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \
  69        git-cherry.sh git-clone.sh git-commit.sh \
  70        git-count-objects.sh git-diff.sh git-fetch.sh \
  71        git-format-patch.sh git-log.sh git-ls-remote.sh \
  72        git-merge-one-file.sh git-octopus.sh git-parse-remote.sh \
  73        git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
  74        git-repack.sh git-request-pull.sh git-reset.sh \
  75        git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \
  76        git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
  77        git-applymbox.sh git-applypatch.sh \
  78        git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
  79        git-merge-resolve.sh git-grep.sh
  80
  81SCRIPT_PERL = \
  82        git-archimport.perl git-cvsimport.perl git-relink.perl \
  83        git-rename.perl git-shortlog.perl
  84
  85SCRIPT_PYTHON = \
  86        git-merge-recursive.py
  87
  88# The ones that do not have to link with lcrypto nor lz.
  89SIMPLE_PROGRAMS = \
  90        git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \
  91        git-daemon git-var
  92
  93# ... and all the rest
  94PROGRAMS = \
  95        git-apply git-cat-file \
  96        git-checkout-index git-clone-pack git-commit-tree \
  97        git-convert-objects git-diff-files \
  98        git-diff-helper git-diff-index git-diff-stages \
  99        git-diff-tree git-export git-fetch-pack git-fsck-objects \
 100        git-hash-object git-init-db \
 101        git-local-fetch git-ls-files git-ls-tree git-merge-base \
 102        git-merge-index git-mktag git-pack-objects git-patch-id \
 103        git-peek-remote git-prune-packed git-read-tree \
 104        git-receive-pack git-rev-list git-rev-parse \
 105        git-rev-tree git-send-pack git-show-branch \
 106        git-show-index git-ssh-fetch \
 107        git-ssh-upload git-tar-tree git-unpack-file \
 108        git-unpack-objects git-update-index git-update-server-info \
 109        git-upload-pack git-verify-pack git-write-tree \
 110        $(SIMPLE_PROGRAMS)
 111
 112# Backward compatibility -- to be removed in 0.99.8
 113PROGRAMS += git-ssh-pull git-ssh-push
 114
 115PYMODULES = \
 116        gitMergeCommon.py
 117
 118ifdef WITH_SEND_EMAIL
 119        SCRIPT_PERL += git-send-email.perl
 120endif
 121
 122ifndef NO_CURL
 123        PROGRAMS += git-http-fetch
 124endif
 125
 126LIB_FILE=libgit.a
 127
 128LIB_H = \
 129        blob.h cache.h commit.h count-delta.h csum-file.h delta.h \
 130        diff.h epoch.h object.h pack.h pkt-line.h quote.h refs.h \
 131        run-command.h strbuf.h tag.h tree.h
 132
 133DIFF_OBJS = \
 134        diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
 135        diffcore-pickaxe.o diffcore-rename.o
 136
 137LIB_OBJS = \
 138        blob.o commit.o connect.o count-delta.o csum-file.o \
 139        date.o diff-delta.o entry.o ident.o index.o \
 140        object.o pack-check.o patch-delta.o path.o pkt-line.o \
 141        quote.o read-cache.o refs.o run-command.o \
 142        server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
 143        tag.o tree.o usage.o $(DIFF_OBJS)
 144
 145LIBS = $(LIB_FILE)
 146LIBS += -lz
 147
 148ifeq ($(shell uname -s),Darwin)
 149        NEEDS_SSL_WITH_CRYPTO = YesPlease
 150        NEEDS_LIBICONV = YesPlease
 151endif
 152ifeq ($(shell uname -s),SunOS)
 153        NEEDS_SOCKET = YesPlease
 154        PLATFORM_DEFINES += -DNO_GETDOMAINNAME=1
 155endif
 156
 157ifndef SHELL_PATH
 158        SHELL_PATH = /bin/sh
 159endif
 160ifndef PERL_PATH
 161        PERL_PATH = /usr/bin/perl
 162endif
 163ifndef PYTHON_PATH
 164        PYTHON_PATH = /usr/bin/python
 165endif
 166
 167ifndef NO_OPENSSL
 168        LIB_OBJS += epoch.o
 169        OPENSSL_LIBSSL = -lssl
 170else
 171        DEFINES += '-DNO_OPENSSL'
 172        MOZILLA_SHA1 = 1
 173        OPENSSL_LIBSSL =
 174endif
 175ifdef NEEDS_SSL_WITH_CRYPTO
 176        LIB_4_CRYPTO = -lcrypto -lssl
 177else
 178        LIB_4_CRYPTO = -lcrypto
 179endif
 180ifdef NEEDS_LIBICONV
 181        LIB_4_ICONV = -liconv
 182else
 183        LIB_4_ICONV =
 184endif
 185ifdef MOZILLA_SHA1
 186        SHA1_HEADER = "mozilla-sha1/sha1.h"
 187        LIB_OBJS += mozilla-sha1/sha1.o
 188else
 189        ifdef PPC_SHA1
 190                SHA1_HEADER = "ppc/sha1.h"
 191                LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
 192        else
 193                SHA1_HEADER = <openssl/sha.h>
 194                LIBS += $(LIB_4_CRYPTO)
 195        endif
 196endif
 197ifdef NEEDS_SOCKET
 198        LIBS += -lsocket
 199        SIMPLE_LIB += -lsocket
 200endif
 201
 202DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)'
 203
 204SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
 205          $(patsubst %.perl,%,$(SCRIPT_PERL)) \
 206          $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
 207          gitk
 208
 209### Build rules
 210
 211all: $(PROGRAMS) $(SCRIPTS)
 212
 213all:
 214        $(MAKE) -C templates
 215
 216git: git.sh Makefile
 217        rm -f $@+ $@
 218        sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
 219        chmod +x $@+
 220        mv $@+ $@
 221
 222$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
 223        rm -f $@
 224        sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@
 225        chmod +x $@
 226
 227$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
 228        rm -f $@
 229        sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@
 230        chmod +x $@
 231
 232$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
 233        rm -f $@
 234        sed -e '1s|#!.*python|#!$(PYTHON_PATH)|' \
 235            -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \
 236                $@.py >$@
 237        chmod +x $@
 238
 239%.o: %.c
 240        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 241%.o: %.S
 242        $(CC) -o $*.o -c $(ALL_CFLAGS) $<
 243
 244git-%: %.o $(LIB_FILE)
 245        $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
 246
 247git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV)
 248$(SIMPLE_PROGRAMS) : $(LIB_FILE)
 249$(SIMPLE_PROGRAMS) : git-% : %.o
 250        $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB)
 251
 252git-http-fetch: fetch.o
 253git-local-fetch: fetch.o
 254git-ssh-fetch: rsh.o fetch.o
 255git-ssh-upload: rsh.o
 256git-ssh-pull: rsh.o fetch.o
 257git-ssh-push: rsh.o
 258
 259git-http-fetch: LIBS += -lcurl
 260git-rev-list: LIBS += $(OPENSSL_LIBSSL)
 261
 262init-db.o: init-db.c
 263        $(CC) -c $(ALL_CFLAGS) \
 264                -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c
 265
 266$(LIB_OBJS): $(LIB_H)
 267$(patsubst git-%,%.o,$(PROGRAMS)): $(LIB_H)
 268$(DIFF_OBJS): diffcore.h
 269
 270$(LIB_FILE): $(LIB_OBJS)
 271        $(AR) rcs $@ $(LIB_OBJS)
 272
 273doc:
 274        $(MAKE) -C Documentation all
 275
 276
 277### Testing rules
 278
 279test: all
 280        $(MAKE) -C t/ all
 281
 282test-date: test-date.c date.o
 283        $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o
 284
 285test-delta: test-delta.c diff-delta.o patch-delta.o
 286        $(CC) $(ALL_CFLAGS) -o $@ $^
 287
 288check:
 289        for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i; done
 290
 291
 292
 293### Installation rules
 294
 295install: $(PROGRAMS) $(SCRIPTS)
 296        $(INSTALL) -d -m755 $(DESTDIR)$(bindir)
 297        $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
 298        $(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick
 299        sh ./cmd-rename.sh $(DESTDIR)$(bindir)
 300        $(MAKE) -C templates install
 301        $(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR)
 302        $(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR)
 303
 304install-doc:
 305        $(MAKE) -C Documentation install
 306
 307
 308
 309
 310### Maintainer's dist rules
 311
 312git-core.spec: git-core.spec.in Makefile
 313        sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
 314
 315GIT_TARNAME=git-core-$(GIT_VERSION)
 316dist: git-core.spec git-tar-tree
 317        ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
 318        @mkdir -p $(GIT_TARNAME)
 319        @cp git-core.spec $(GIT_TARNAME)
 320        tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git-core.spec
 321        @rm -rf $(GIT_TARNAME)
 322        gzip -f -9 $(GIT_TARNAME).tar
 323
 324rpm: dist
 325        $(RPMBUILD) -ta git-core-$(GIT_VERSION).tar.gz
 326
 327deb: dist
 328        rm -rf $(GIT_TARNAME)
 329        tar zxf $(GIT_TARNAME).tar.gz
 330        dpkg-source -b $(GIT_TARNAME)
 331        cd $(GIT_TARNAME) && fakeroot debian/rules binary
 332
 333### Cleaning rules
 334
 335clean:
 336        rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROGRAMS) $(LIB_FILE)
 337        rm -f $(filter-out gitk,$(SCRIPTS))
 338        rm -f git-core.spec
 339        rm -rf $(GIT_TARNAME)
 340        rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
 341        rm -f git-core_$(GIT_VERSION)-*.deb git-core_$(GIT_VERSION)-*.dsc
 342        rm -f git-tk_$(GIT_VERSION)-*.deb
 343        $(MAKE) -C Documentation/ clean
 344        $(MAKE) -C templates/ clean
 345        $(MAKE) -C t/ clean