diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/Makefile b/Makefile index 644914c..138f261 100644 --- a/Makefile +++ b/Makefile | |||
@@ -1,12 +1,11 @@ | |||
1 | CGIT_VERSION = 0.2 | 1 | CGIT_VERSION = 0.2 |
2 | 2 | ||
3 | prefix = /var/www/htdocs/cgit | 3 | prefix = /var/www/htdocs/cgit |
4 | gitsrc = git | ||
5 | 4 | ||
6 | SHA1_HEADER = <openssl/sha.h> | 5 | SHA1_HEADER = <openssl/sha.h> |
7 | 6 | ||
8 | CACHE_ROOT = /var/cache/cgit | 7 | CACHE_ROOT = /var/cache/cgit |
9 | EXTLIBS = $(gitsrc)/libgit.a $(gitsrc)/xdiff/lib.a -lz -lcrypto | 8 | 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 \ | 9 | 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 \ | 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 |
@@ -17,28 +16,52 @@ ifdef DEBUG | |||
17 | CFLAGS += -g | 16 | CFLAGS += -g |
18 | endif | 17 | endif |
19 | 18 | ||
20 | CFLAGS += -I$(gitsrc) -DSHA1_HEADER='$(SHA1_HEADER)' | 19 | CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)' |
21 | 20 | ||
21 | |||
22 | |||
23 | |||
24 | # | ||
25 | # basic build rules | ||
26 | # | ||
22 | all: cgit | 27 | all: cgit |
23 | 28 | ||
29 | cgit: 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 | |||
35 | git/libgit.a: | ||
36 | ./submodules.sh -i | ||
37 | $(MAKE) -C git | ||
38 | |||
39 | # | ||
40 | # phony targets | ||
41 | # | ||
24 | install: all clean-cache | 42 | install: 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 | ||
29 | cgit: cgit.c cgit.h $(OBJECTS) $(gitsrc)/libgit.a | 47 | clean-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: | 50 | distclean-cgit: clean-cgit |
36 | $(MAKE) -C $(gitsrc) | 51 | git clean -d -x |
37 | 52 | ||
53 | clean-sub: | ||
54 | $(MAKE) -C git clean | ||
38 | 55 | ||
39 | .PHONY: clean | 56 | distclean-sub: clean-sub |
40 | clean: | 57 | $(shell cd git && git clean -d -x) |
41 | rm -f cgit *.o | ||
42 | 58 | ||
43 | clean-cache: | 59 | clean-cache: |
44 | rm -rf $(CACHE_ROOT)/* | 60 | rm -rf $(CACHE_ROOT)/* |
61 | |||
62 | clean: clean-cgit clean-sub | ||
63 | |||
64 | distclean: distclean-cgit distclean-sub | ||
65 | |||
66 | .PHONY: all install clean clean-cgit clean-sub clean-cache \ | ||
67 | distclean distclean-cgit distclean-sub | ||