Makefile (view raw)
1CGIT_VERSION = 0.2
2
3prefix = /var/www/htdocs/cgit
4
5SHA1_HEADER = <openssl/sha.h>
6
7CACHE_ROOT = /var/cache/cgit
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 \
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
12
13CFLAGS += -Wall
14
15ifdef DEBUG
16 CFLAGS += -g
17endif
18
19CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)'
20
21
22
23
24#
25# basic build rules
26#
27all: cgit
28
29cgit: cgit.c cgit.h $(OBJECTS)
30 $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \
31 $(OBJECTS) $(EXTLIBS)
32
33$(OBJECTS): cgit.h git/libgit.a
34
35git/libgit.a:
36 ./submodules.sh -i
37 $(MAKE) -C git
38
39#
40# phony targets
41#
42install: all clean-cache
43 mkdir -p $(prefix)
44 install cgit $(prefix)/cgit.cgi
45 install cgit.css $(prefix)/cgit.css
46
47clean-cgit:
48 rm -f cgit *.o
49
50distclean-cgit: clean-cgit
51 git clean -d -x
52
53clean-sub:
54 $(MAKE) -C git clean
55
56distclean-sub: clean-sub
57 $(shell cd git && git clean -d -x)
58
59clean-cache:
60 rm -rf $(CACHE_ROOT)/*
61
62clean: clean-cgit clean-sub
63
64distclean: distclean-cgit distclean-sub
65
66.PHONY: all install clean clean-cgit clean-sub clean-cache \
67 distclean distclean-cgit distclean-sub