author | Lars Hjemli <hjemli@gmail.com> | 2007-05-11 18:41:14 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-11 18:41:14 (UTC) |
commit | f596d10d7391ed72b73019e037a7f7eec7a50d02 (patch) (unidiff) | |
tree | 5ff2b0949adfa588363e01c0455f52f536a50135 | |
parent | dad80d1ff8e065002cdf4e37252164a7f8517a5b (diff) | |
download | cgit-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>
-rw-r--r-- | Makefile | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1,67 +1,79 @@ | |||
1 | CGIT_VERSION = 0.3 | 1 | CGIT_VERSION = 0.3 |
2 | 2 | ||
3 | prefix = /var/www/htdocs/cgit | 3 | prefix = /var/www/htdocs/cgit |
4 | 4 | ||
5 | SHA1_HEADER = <openssl/sha.h> | 5 | SHA1_HEADER = <openssl/sha.h> |
6 | 6 | ||
7 | CACHE_ROOT = /var/cache/cgit | 7 | CACHE_ROOT = /var/cache/cgit |
8 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto | 8 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto |
9 | OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \ | 9 | OBJECTS = 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 | ||
13 | CFLAGS += -Wall | 13 | CFLAGS += -Wall |
14 | 14 | ||
15 | ifdef DEBUG | 15 | ifdef DEBUG |
16 | CFLAGS += -g | 16 | CFLAGS += -g |
17 | endif | 17 | endif |
18 | 18 | ||
19 | CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)' | 19 | CFLAGS += -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 | # | ||
27 | GITVER = $(shell git version 2>/dev/null || echo nogit) | ||
28 | ifeq ($(GITVER),nogit) | ||
29 | GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2 | ||
30 | INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip) | ||
31 | else | ||
32 | INITGIT = ./submodules.sh -i | ||
33 | endif | ||
22 | 34 | ||
23 | 35 | ||
24 | # | 36 | # |
25 | # basic build rules | 37 | # basic build rules |
26 | # | 38 | # |
27 | all: cgit | 39 | all: cgit |
28 | 40 | ||
29 | cgit: cgit.c cgit.h $(OBJECTS) | 41 | cgit: 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 | ||
35 | git/libgit.a: | 47 | git/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 | # |
42 | install: all clean-cache | 54 | install: 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 | ||
47 | clean-cgit: | 59 | clean-cgit: |
48 | rm -f cgit *.o | 60 | rm -f cgit *.o |
49 | 61 | ||
50 | distclean-cgit: clean-cgit | 62 | distclean-cgit: clean-cgit |
51 | git clean -d -x | 63 | git clean -d -x |
52 | 64 | ||
53 | clean-sub: | 65 | clean-sub: |
54 | $(MAKE) -C git clean | 66 | $(MAKE) -C git clean |
55 | 67 | ||
56 | distclean-sub: clean-sub | 68 | distclean-sub: clean-sub |
57 | $(shell cd git && git clean -d -x) | 69 | $(shell cd git && git clean -d -x) |
58 | 70 | ||
59 | clean-cache: | 71 | clean-cache: |
60 | rm -rf $(CACHE_ROOT)/* | 72 | rm -rf $(CACHE_ROOT)/* |
61 | 73 | ||
62 | clean: clean-cgit clean-sub | 74 | clean: clean-cgit clean-sub |
63 | 75 | ||
64 | distclean: distclean-cgit distclean-sub | 76 | distclean: 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 |