]> git.cameronkatri.com Git - cgit.git/blob - Makefile
Let makefile override the configfile location
[cgit.git] / Makefile
1 CGIT_VERSION = 0.4
2
3 prefix = /var/www/htdocs/cgit
4
5 SHA1_HEADER = <openssl/sha.h>
6 CACHE_ROOT = /var/cache/cgit
7 CGIT_CONFIG = /etc/cgitrc
8
9 EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
10 OBJECTS = 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-snapshot.o ui-blob.o
13
14 CFLAGS += -Wall
15
16 ifdef DEBUG
17 CFLAGS += -g
18 endif
19
20 CFLAGS += -Igit
21 CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
22 CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
23 CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
24
25
26 #
27 # 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
29 # a zipfile from hjemli.net instead
30 #
31 GITVER = $(shell git version 2>/dev/null || echo nogit)
32 ifeq ($(GITVER),nogit)
33 GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2
34 INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip)
35 else
36 INITGIT = ./submodules.sh -i
37 endif
38
39
40 #
41 # basic build rules
42 #
43 all: cgit
44
45 cgit: cgit.c cgit.h $(OBJECTS)
46 $(CC) $(CFLAGS) cgit.c -o cgit $(OBJECTS) $(EXTLIBS)
47
48 $(OBJECTS): cgit.h git/libgit.a
49
50 git/libgit.a:
51 $(INITGIT)
52 $(MAKE) -C git
53
54 #
55 # phony targets
56 #
57 install: all clean-cache
58 mkdir -p $(prefix)
59 install cgit $(prefix)/cgit.cgi
60 install cgit.css $(prefix)/cgit.css
61 install add.png del.png $(prefix)/
62
63 clean-cgit:
64 rm -f cgit *.o
65
66 distclean-cgit: clean-cgit
67 git clean -d -x
68
69 clean-sub:
70 $(MAKE) -C git clean
71
72 distclean-sub: clean-sub
73 $(shell cd git && git clean -d -x)
74
75 clean-cache:
76 rm -rf $(CACHE_ROOT)/*
77
78 clean: clean-cgit clean-sub
79
80 distclean: distclean-cgit distclean-sub
81
82 .PHONY: all install clean clean-cgit clean-sub clean-cache \
83 distclean distclean-cgit distclean-sub