summaryrefslogtreecommitdiffabout
path: root/Makefile
Unidiff
Diffstat (limited to 'Makefile') (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile49
1 files changed, 36 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 644914c..138f261 100644
--- a/Makefile
+++ b/Makefile
@@ -1,44 +1,67 @@
1CGIT_VERSION = 0.2 1CGIT_VERSION = 0.2
2 2
3prefix = /var/www/htdocs/cgit 3prefix = /var/www/htdocs/cgit
4gitsrc = git
5 4
6SHA1_HEADER = <openssl/sha.h> 5SHA1_HEADER = <openssl/sha.h>
7 6
8CACHE_ROOT = /var/cache/cgit 7CACHE_ROOT = /var/cache/cgit
9EXTLIBS = $(gitsrc)/libgit.a $(gitsrc)/xdiff/lib.a -lz -lcrypto 8EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
10OBJECTS = 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 \
11 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 \
12 ui-snapshot.o ui-blob.o 11 ui-snapshot.o ui-blob.o
13 12
14CFLAGS += -Wall 13CFLAGS += -Wall
15 14
16ifdef DEBUG 15ifdef DEBUG
17 CFLAGS += -g 16 CFLAGS += -g
18endif 17endif
19 18
20CFLAGS += -I$(gitsrc) -DSHA1_HEADER='$(SHA1_HEADER)' 19CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)'
21 20
21
22
23
24#
25# basic build rules
26#
22all: cgit 27all: cgit
23 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#
24install: all clean-cache 42install: all clean-cache
25 mkdir -p $(prefix) 43 mkdir -p $(prefix)
26 install cgit $(prefix)/cgit.cgi 44 install cgit $(prefix)/cgit.cgi
27 install cgit.css $(prefix)/cgit.css 45 install cgit.css $(prefix)/cgit.css
28 46
29cgit: cgit.c cgit.h $(OBJECTS) $(gitsrc)/libgit.a 47clean-cgit:
30 $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \ 48 rm -f cgit *.o
31 $(OBJECTS) $(EXTLIBS)
32
33$(OBJECTS): cgit.h
34 49
35$(gitsrc)/libgit.a: 50distclean-cgit: clean-cgit
36 $(MAKE) -C $(gitsrc) 51 git clean -d -x
37 52
53clean-sub:
54 $(MAKE) -C git clean
38 55
39.PHONY: clean 56distclean-sub: clean-sub
40clean: 57 $(shell cd git && git clean -d -x)
41 rm -f cgit *.o
42 58
43clean-cache: 59clean-cache:
44 rm -rf $(CACHE_ROOT)/* 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