blob: 138f2610b073be9d2a131ff4631bb6097aaf6a87 [file] [log] [blame]
Lars Hjemli14d360d2007-02-05 00:21:06 +01001CGIT_VERSION = 0.2
Lars Hjemli0d169ad2006-12-09 15:18:17 +01002
Lars Hjemlic52e8412007-02-04 23:57:34 +01003prefix = /var/www/htdocs/cgit
Lars Hjemli0d169ad2006-12-09 15:18:17 +01004
Lars Hjemli61c3ca92007-05-08 22:40:59 +02005SHA1_HEADER = <openssl/sha.h>
6
Lars Hjemlic52e8412007-02-04 23:57:34 +01007CACHE_ROOT = /var/cache/cgit
Lars Hjemlicc1dbd12007-05-10 11:25:12 +02008EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
Lars Hjemli44923f82006-12-11 17:25:41 +01009OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \
Lars Hjemli61c3ca92007-05-08 22:40:59 +020010 ui-summary.o ui-log.o ui-view.o ui-tree.o ui-commit.o ui-diff.o \
Lars Hjemlica8eb8f2007-05-09 00:48:09 +020011 ui-snapshot.o ui-blob.o
Lars Hjemli25105d72006-12-10 22:31:36 +010012
13CFLAGS += -Wall
Lars Hjemli0d169ad2006-12-09 15:18:17 +010014
Lars Hjemli447025f2007-01-17 01:13:05 +010015ifdef DEBUG
16 CFLAGS += -g
17endif
18
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020019CFLAGS += -Igit -DSHA1_HEADER='$(SHA1_HEADER)'
Lars Hjemli61c3ca92007-05-08 22:40:59 +020020
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020021
22
23
24#
25# basic build rules
26#
Lars Hjemli0d169ad2006-12-09 15:18:17 +010027all: cgit
28
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020029cgit: 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#
Lars Hjemlic45b8172006-12-13 14:39:41 +010042install: all clean-cache
Lars Hjemlic52e8412007-02-04 23:57:34 +010043 mkdir -p $(prefix)
44 install cgit $(prefix)/cgit.cgi
45 install cgit.css $(prefix)/cgit.css
Lars Hjemli0d169ad2006-12-09 15:18:17 +010046
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020047clean-cgit:
Lars Hjemli76827d82006-12-10 23:50:16 +010048 rm -f cgit *.o
Lars Hjemlic45b8172006-12-13 14:39:41 +010049
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020050distclean-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
Lars Hjemlic45b8172006-12-13 14:39:41 +010059clean-cache:
60 rm -rf $(CACHE_ROOT)/*
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020061
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