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