blob: e69ad7e3562e66dbab48554a6f1cec0973e61baa [file] [log] [blame]
Lars Hjemlic52e8412007-02-04 23:57:34 +01001prefix = /var/www/htdocs/cgit
Lars Hjemli61c3ca92007-05-08 22:40:59 +02002SHA1_HEADER = <openssl/sha.h>
Lars Hjemlic52e8412007-02-04 23:57:34 +01003CACHE_ROOT = /var/cache/cgit
Lars Hjemli9ecde652007-05-14 23:09:49 +02004CGIT_CONFIG = /etc/cgitrc
Lars Hjemliea2831f2007-05-15 00:48:31 +02005CGIT_SCRIPT_NAME = cgit.cgi
Lars Hjemli9ecde652007-05-14 23:09:49 +02006
Lars Hjemliad3b39d2007-05-15 18:38:31 +02007#
8# Let the user override the above settings.
9#
10-include cgit.conf
11
Lars Hjemlif6925032007-06-18 09:42:10 +020012
13CGIT_VERSION = 0.5
14
15all: cgit
16
17VERSION:
18 gen-version.sh
19
20-include VERSION
21
22
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020023EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
Lars Hjemli44923f82006-12-11 17:25:41 +010024OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \
Lars Hjemliffc69732007-06-16 20:20:42 +020025 ui-summary.o ui-log.o ui-tree.o ui-commit.o ui-diff.o \
Lars Hjemlica8eb8f2007-05-09 00:48:09 +020026 ui-snapshot.o ui-blob.o
Lars Hjemli25105d72006-12-10 22:31:36 +010027
28CFLAGS += -Wall
Lars Hjemli0d169ad2006-12-09 15:18:17 +010029
Lars Hjemli447025f2007-01-17 01:13:05 +010030ifdef DEBUG
31 CFLAGS += -g
32endif
33
Lars Hjemli9ecde652007-05-14 23:09:49 +020034CFLAGS += -Igit
35CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
36CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
37CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
Lars Hjemliea2831f2007-05-15 00:48:31 +020038CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
Lars Hjemli61c3ca92007-05-08 22:40:59 +020039
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020040
Lars Hjemlif596d102007-05-11 20:41:14 +020041#
Lars Hjemlid4dbfdf2007-05-20 13:14:36 +020042# If make is run on a nongit platform, get the git sources as a tarball.
Lars Hjemlif596d102007-05-11 20:41:14 +020043#
44GITVER = $(shell git version 2>/dev/null || echo nogit)
45ifeq ($(GITVER),nogit)
Lars Hjemlid4dbfdf2007-05-20 13:14:36 +020046GITURL = http://www.kernel.org/pub/software/scm/git/git-1.5.2.tar.bz2
47INITGIT = test -e git/git.c || ((curl "$(GITURL)" | tar -xj) && mv git-1.5.2 git)
Lars Hjemlif596d102007-05-11 20:41:14 +020048else
49INITGIT = ./submodules.sh -i
50endif
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020051
52
Lars Hjemlif6925032007-06-18 09:42:10 +020053cgit: cgit.c cgit.h VERSION $(OBJECTS)
Lars Hjemli9ecde652007-05-14 23:09:49 +020054 $(CC) $(CFLAGS) cgit.c -o cgit $(OBJECTS) $(EXTLIBS)
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020055
56$(OBJECTS): cgit.h git/libgit.a
57
58git/libgit.a:
Lars Hjemlif596d102007-05-11 20:41:14 +020059 $(INITGIT)
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020060 $(MAKE) -C git
61
62#
63# phony targets
64#
Lars Hjemlic45b8172006-12-13 14:39:41 +010065install: all clean-cache
Lars Hjemlic52e8412007-02-04 23:57:34 +010066 mkdir -p $(prefix)
Lars Hjemliea2831f2007-05-15 00:48:31 +020067 install cgit $(prefix)/$(CGIT_SCRIPT_NAME)
Lars Hjemlic52e8412007-02-04 23:57:34 +010068 install cgit.css $(prefix)/cgit.css
Lars Hjemli0d169ad2006-12-09 15:18:17 +010069
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020070clean-cgit:
Lars Hjemlif6925032007-06-18 09:42:10 +020071 rm -f cgit VERSION *.o
Lars Hjemlic45b8172006-12-13 14:39:41 +010072
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020073distclean-cgit: clean-cgit
74 git clean -d -x
75
76clean-sub:
77 $(MAKE) -C git clean
78
79distclean-sub: clean-sub
80 $(shell cd git && git clean -d -x)
81
Lars Hjemlic45b8172006-12-13 14:39:41 +010082clean-cache:
83 rm -rf $(CACHE_ROOT)/*
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020084
85clean: clean-cgit clean-sub
86
87distclean: distclean-cgit distclean-sub
88
Lars Hjemlif6925032007-06-18 09:42:10 +020089version: clean-cgit
90 ./gen-version.sh
91 make
92
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020093.PHONY: all install clean clean-cgit clean-sub clean-cache \
Lars Hjemlif6925032007-06-18 09:42:10 +020094 distclean distclean-cgit distclean-sub release version