summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-05-11 18:41:14 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-11 18:41:14 (UTC)
commitf596d10d7391ed72b73019e037a7f7eec7a50d02 (patch) (unidiff)
tree5ff2b0949adfa588363e01c0455f52f536a50135
parentdad80d1ff8e065002cdf4e37252164a7f8517a5b (diff)
downloadcgit-f596d10d7391ed72b73019e037a7f7eec7a50d02.zip
cgit-f596d10d7391ed72b73019e037a7f7eec7a50d02.tar.gz
cgit-f596d10d7391ed72b73019e037a7f7eec7a50d02.tar.bz2
Makefile: add support for building w.o. preinstalled git
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 86b2a70..ccc7582 100644
--- a/Makefile
+++ b/Makefile
@@ -1,67 +1,79 @@
1CGIT_VERSION = 0.3 1CGIT_VERSION = 0.3
2 2
3prefix = /var/www/htdocs/cgit 3prefix = /var/www/htdocs/cgit
4 4
5SHA1_HEADER = <openssl/sha.h> 5SHA1_HEADER = <openssl/sha.h>
6 6
7CACHE_ROOT = /var/cache/cgit 7CACHE_ROOT = /var/cache/cgit
8EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto 8EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
9OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \ 9OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \
10 ui-summary.o ui-log.o ui-view.o ui-tree.o ui-commit.o ui-diff.o \ 10 ui-summary.o ui-log.o ui-view.o ui-tree.o ui-commit.o ui-diff.o \
11 ui-snapshot.o ui-blob.o 11 ui-snapshot.o ui-blob.o
12 12
13CFLAGS += -Wall 13CFLAGS += -Wall
14 14
15ifdef DEBUG 15ifdef DEBUG
16 CFLAGS += -g 16 CFLAGS += -g
17endif 17endif
18 18
19CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)' 19CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)'
20 20
21 21
22#
23# If make is run on a nongit platform, we need to get the git sources as a tarball.
24# But there is currently no recent enough tarball available on kernel.org, so download
25# a zipfile from hjemli.net instead
26#
27GITVER = $(shell git version 2>/dev/null || echo nogit)
28ifeq ($(GITVER),nogit)
29GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2
30INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip)
31else
32INITGIT = ./submodules.sh -i
33endif
22 34
23 35
24# 36#
25# basic build rules 37# basic build rules
26# 38#
27all: cgit 39all: cgit
28 40
29cgit: cgit.c cgit.h $(OBJECTS) 41cgit: cgit.c cgit.h $(OBJECTS)
30 $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \ 42 $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \
31 $(OBJECTS) $(EXTLIBS) 43 $(OBJECTS) $(EXTLIBS)
32 44
33$(OBJECTS): cgit.h git/libgit.a 45$(OBJECTS): cgit.h git/libgit.a
34 46
35git/libgit.a: 47git/libgit.a:
36 ./submodules.sh -i 48 $(INITGIT)
37 $(MAKE) -C git 49 $(MAKE) -C git
38 50
39# 51#
40# phony targets 52# phony targets
41# 53#
42install: all clean-cache 54install: all clean-cache
43 mkdir -p $(prefix) 55 mkdir -p $(prefix)
44 install cgit $(prefix)/cgit.cgi 56 install cgit $(prefix)/cgit.cgi
45 install cgit.css $(prefix)/cgit.css 57 install cgit.css $(prefix)/cgit.css
46 58
47clean-cgit: 59clean-cgit:
48 rm -f cgit *.o 60 rm -f cgit *.o
49 61
50distclean-cgit: clean-cgit 62distclean-cgit: clean-cgit
51 git clean -d -x 63 git clean -d -x
52 64
53clean-sub: 65clean-sub:
54 $(MAKE) -C git clean 66 $(MAKE) -C git clean
55 67
56distclean-sub: clean-sub 68distclean-sub: clean-sub
57 $(shell cd git && git clean -d -x) 69 $(shell cd git && git clean -d -x)
58 70
59clean-cache: 71clean-cache:
60 rm -rf $(CACHE_ROOT)/* 72 rm -rf $(CACHE_ROOT)/*
61 73
62clean: clean-cgit clean-sub 74clean: clean-cgit clean-sub
63 75
64distclean: distclean-cgit distclean-sub 76distclean: distclean-cgit distclean-sub
65 77
66.PHONY: all install clean clean-cgit clean-sub clean-cache \ 78.PHONY: all install clean clean-cgit clean-sub clean-cache \
67 distclean distclean-cgit distclean-sub 79 distclean distclean-cgit distclean-sub