#!/usr/bin/make -f ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH) CC =gcc CFLAGS =-g -Wall STRIP =strip TEST =test OPTS =NO_OPENSSL=1 prefix=/usr gitexecdir=/usr/lib/git-core \ mandir=/usr/share/man INSTALLDIRS=vendor \ NO_PYTHON=1 \ THREADED_DELTA_SEARCH=1 NO_CROSS_DIRECTORY_HARDLINKS=1 \ DEFAULT_PAGER=pager DEFAULT_EDITOR=editor DOC_OPTS =prefix=/usr ASCIIDOC8=1 ASCIIDOC_NO_ROFF=1 ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) STRIP =: strip endif ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS +=-O0 else # workaround #427907 ifeq (hppa,$(ARCH)) CFLAGS +=-O0 else CFLAGS +=-O2 endif endif ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) TEST = endif TMP =$(shell pwd)/tmp GIT =$(shell pwd)/debian/git patch: deb-checkdir patch-stamp patch-stamp: for i in `ls -1 debian/diff/*.diff || :`; do \ patch -p1 <$$i || exit 1; \ done touch patch-stamp build: deb-checkdir build-arch-stamp build-indep-stamp build-arch-stamp: patch-stamp build-indep-stamp -$(CC) -v DESTDIR='$(GIT)' $(MAKE) all \ CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS) test -z '$(TEST)' || \ DESTDIR='$(GIT)' $(MAKE) $(TEST) \ CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS) || \ GIT_TEST_OPTS=--verbose DESTDIR='$(GIT)' \ $(MAKE) $(TEST) CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS) touch build-arch-stamp build-indep-stamp: $(MAKE) -CDocumentation man html $(DOC_OPTS) touch build-indep-stamp clean: deb-checkdir $(MAKE) clean $(OPTS) ! test -e patch-stamp || \ for i in `ls -1r debian/diff/*.diff || :`; do patch -p1 -R <$$i; done rm -rf '$(TMP)' rm -f patch-stamp build-arch-stamp build-indep-stamp rm -rf '$(GIT)' '$(GIT)'-doc '$(GIT)'-arch '$(GIT)'-cvs \ '$(GIT)'-svn '$(GIT)'-email '$(GIT)'-daemon-run '$(GIT)'-gui \ '$(GIT)'k '$(GIT)'web '$(GIT)'-all '$(GIT)'-core rm -f debian/files debian/substvars changelog install: install-arch install-indep install-arch: deb-checkdir deb-checkuid build-arch-stamp # git rm -rf '$(GIT)' install -d -m0755 '$(GIT)'/usr/bin DESTDIR='$(GIT)' $(MAKE) install install-doc \ CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS) install -d -m0755 '$(GIT)'/var/cache/git rm -f '$(GIT)'/usr/share/perl5/Error.pm rm -f '$(GIT)'/usr/share/man/man3/private-Error.3pm chmod 644 '$(GIT)'/usr/share/perl5/Git.pm # don't include arch, cvs, svn, email, gui tools, and gitk program for i in git-archimport git-cvs git-svn git-send-email \ git-gui git-citool; do \ rm -f '$(GIT)'/usr/lib/git-core/$$i*; \ done rm -f '$(GIT)'/usr/bin/git-cvsserver rm -f '$(GIT)'/usr/bin/gitk for i in '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/*; do \ test "`head -c2 $$i`" = '#!' || $(STRIP) -R .comment -R .note $$i; \ done # don't include git-gui's lib rm -rf '$(GIT)'/usr/share/git-gui/ # don't include gitk's lib rm -rf '$(GIT)'/usr/share/gitk/ # don't include arch, cvs, svn, email, gui, and gitk man pages for i in git-archimport git-cvs git-svn git-send-email gitk \ git-gui git-citool; do \ rm -f '$(GIT)'/usr/share/man/man1/$$i*; \ done chmod 0644 '$(GIT)'/usr/share/man/man?/*.[0-9]* gzip -9 '$(GIT)'/usr/share/man/man?/*.[0-9]* # emacs install -m0644 -D debian/git.emacsen-startup \ '$(GIT)'/etc/emacs/site-start.d/50git-core.el # bash completion install -d -m0755 '$(GIT)'/etc/bash_completion.d install -m0644 contrib/completion/git-completion.bash \ '$(GIT)'/etc/bash_completion.d/git # contrib install -d -m0755 '$(GIT)'/usr/share/doc/git cp -R contrib '$(GIT)'/usr/share/doc/git/ rm -rf '$(GIT)'/usr/share/doc/git/contrib/completion find '$(GIT)'/usr/share/doc/git/contrib -type f | xargs chmod 0644 find '$(GIT)'/usr/share/doc/git/contrib -type d | xargs chmod 0755 find '$(GIT)'/usr/share/doc/git/ -name .gitignore | xargs rm -f # upstream changelog test -r changelog || ln -s debian/changelog.upstream changelog install-indep: build-arch-stamp build-indep-stamp rm -rf '$(TMP)' install -d -m0755 '$(TMP)' DESTDIR='$(TMP)' $(MAKE) install install-doc \ CC='$(CC)' CFLAGS='$(CFLAGS)' $(OPTS) $(MAKE) -CDocumentation install-webdoc WEBDOC_DEST='$(TMP)'/html \ 2>/dev/null # RelNotes are shipped in git rm -f '$(TMP)'/html/RelNotes* # git-doc rm -rf '$(GIT)'-doc install -d -m0755 '$(GIT)'-doc # git-cvs, git-svn for i in cvs svn; do \ rm -rf '$(GIT)'-$$i && \ install -d -m0755 '$(GIT)'-$$i/usr/lib/git-core && \ install -m0755 '$(TMP)'/usr/lib/git-core/git-$$i* \ '$(GIT)'-$$i/usr/lib/git-core/ && \ install -d -m0755 '$(GIT)'-$$i/usr/share/man/man1 && \ install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \ '$(GIT)'-$$i/usr/share/man/man1/ && \ gzip -9 '$(GIT)'-$$i/usr/share/man/man1/*.1 || exit 1; \ done # git-cvs install -d -m0755 '$(GIT)'-cvs/usr/bin install -m0755 '$(TMP)'/usr/bin/git-cvsserver '$(GIT)'-cvs/usr/bin/ # git-arch rm -rf '$(GIT)'-arch install -d -m0755 '$(GIT)'-arch/usr/lib/git-core install -m0755 '$(TMP)'/usr/lib/git-core/git-archimport \ '$(GIT)'-arch/usr/lib/git-core/ install -d -m0755 '$(GIT)'-arch/usr/share/man/man1 install -m0644 '$(TMP)'/usr/share/man/man1/git-archimport.1 \ '$(GIT)'-arch/usr/share/man/man1/ gzip -9 '$(GIT)'-arch/usr/share/man/man1/*.1 # git-email rm -rf '$(GIT)'-email install -d -m0755 '$(GIT)'-email/usr/lib/git-core install -m0755 '$(TMP)'/usr/lib/git-core/git-send-email \ '$(GIT)'-email/usr/lib/git-core/ install -d -m0755 '$(GIT)'-email/usr/share/man/man1 install -m0644 '$(TMP)'/usr/share/man/man1/git-send-email.1 \ '$(GIT)'-email/usr/share/man/man1/ gzip -9 '$(GIT)'-email/usr/share/man/man1/*.1 # git-daemon-run rm -rf '$(GIT)'-daemon-run install -d -m0755 '$(GIT)'-daemon-run/etc/sv/git-daemon/log install -m0755 debian/git-daemon/run \ '$(GIT)'-daemon-run/etc/sv/git-daemon/run install -m0755 debian/git-daemon/log/run \ '$(GIT)'-daemon-run/etc/sv/git-daemon/log/run # git-gui rm -rf '$(GIT)'-gui install -d -m0755 '$(GIT)'-gui/usr/lib/git-core install -m0755 '$(TMP)'/usr/lib/git-core/git-gui \ '$(GIT)'-gui/usr/lib/git-core/ install -m0755 '$(TMP)'/usr/lib/git-core/git-citool \ '$(GIT)'-gui/usr/lib/git-core/ install -d -m0755 '$(GIT)'-gui/usr/share/man/man1 for i in gui citool; do \ install -m0644 '$(TMP)'/usr/share/man/man1/git-$$i* \ '$(GIT)'-gui/usr/share/man/man1/; \ done gzip -9 '$(GIT)'-gui/usr/share/man/man1/*.1 install -d -m0755 '$(GIT)'-gui/usr/share/git-gui cp -a '$(TMP)'/usr/share/git-gui/lib '$(GIT)'-gui/usr/share/git-gui/ # gitk rm -rf '$(GIT)'k install -d -m0755 '$(GIT)'k/usr/bin install -m0755 '$(TMP)'/usr/bin/gitk \ '$(GIT)'k/usr/bin/gitk install -d -m0755 '$(GIT)'k/usr/share/man/man1 install -m0644 '$(TMP)'/usr/share/man/man1/gitk.1 \ '$(GIT)'k/usr/share/man/man1/ gzip -9 '$(GIT)'k/usr/share/man/man1/*.1 install -d -m0755 '$(GIT)'k/usr/share/gitk cp -a '$(TMP)'/usr/share/gitk/lib '$(GIT)'k/usr/share/gitk/ # gitweb rm -rf '$(GIT)'web install -d -m0755 '$(GIT)'web/usr/lib/cgi-bin install -m0755 gitweb/gitweb.cgi '$(GIT)'web/usr/lib/cgi-bin/gitweb.cgi install -d -m0755 '$(GIT)'web/usr/share/gitweb ln -s ../../lib/cgi-bin/gitweb.cgi \ '$(GIT)'web/usr/share/gitweb/index.cgi install -m0644 gitweb/gitweb.css \ '$(GIT)'web/usr/share/gitweb/gitweb.css install -m0644 gitweb/git-favicon.png \ '$(GIT)'web/usr/share/gitweb/git-favicon.png install -m0644 gitweb/git-logo.png \ '$(GIT)'web/usr/share/gitweb/git-logo.png install -d -m0755 '$(GIT)'web/etc install -m0644 debian/gitweb.conf '$(GIT)'web/etc/gitweb.conf install -d -m0755 '$(GIT)'web/etc/apache2/conf.d install -m0644 debian/gitweb.apache2.conf \ '$(GIT)'web/etc/apache2/conf.d/gitweb install -d -m0755 '$(GIT)'web/var/cache/git/ # git-all rm -rf '$(GIT)'-all install -d -m0755 '$(GIT)'-all # git-core rm -rf '$(GIT)'-core install -d -m0755 '$(GIT)'-core/usr/share/doc ln -s git '$(GIT)'-core/usr/share/doc/git-core # upstream changelog test -r changelog || ln -s debian/changelog.upstream changelog binary: binary-arch binary-indep binary-arch: install-arch git.deb rm -f debian/substvars dpkg-shlibdeps '$(GIT)'/usr/bin/* '$(GIT)'/usr/lib/git-core/* dpkg-gencontrol -isp -pgit -P'$(GIT)' dpkg -b '$(GIT)' .. binary-indep: install-indep git-doc.deb git-arch.deb git-cvs.deb git-svn.deb \ git-daemon-run.deb git-email.deb git-gui.deb gitk.deb gitweb.deb \ git-all.deb git-core.deb-DEBIAN rm -f debian/substvars for i in -doc -arch -cvs -svn -daemon-run -email -gui k web -all \ -core; do \ dpkg-gencontrol -isp -pgit$$i -P'$(GIT)'$$i && \ dpkg -b '$(GIT)'$$i .. || exit 1; \ done .PHONY: patch build clean install install-arch install-indep binary \ binary-arch binary-indep include debian/implicit