all repos — cgit @ 5ec6e02bd1cc0c05b7cfd0d53371e7d176daec39

a hyperfast web frontend for git written in c

Makefile (view raw)

 1CGIT_VERSION = 0.4
 2
 3prefix = /var/www/htdocs/cgit
 4
 5SHA1_HEADER = <openssl/sha.h>
 6CACHE_ROOT = /var/cache/cgit
 7CGIT_CONFIG = /etc/cgitrc
 8
 9EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
10OBJECTS = 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 \
12	ui-snapshot.o ui-blob.o
13
14CFLAGS += -Wall
15
16ifdef DEBUG
17	CFLAGS += -g
18endif
19
20CFLAGS += -Igit
21CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
22CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
23CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
24
25
26#
27# If make is run on a nongit platform, we need to get the git sources as a tarball.
28# But there is currently no recent enough tarball available on kernel.org, so download
29# a zipfile from hjemli.net instead
30#
31GITVER = $(shell git version 2>/dev/null || echo nogit)
32ifeq ($(GITVER),nogit)
33GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2
34INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip)
35else
36INITGIT = ./submodules.sh -i
37endif
38
39
40#
41# basic build rules
42#
43all: cgit
44
45cgit: cgit.c cgit.h $(OBJECTS)
46	$(CC) $(CFLAGS) cgit.c -o cgit $(OBJECTS) $(EXTLIBS)
47
48$(OBJECTS): cgit.h git/libgit.a
49
50git/libgit.a:
51	$(INITGIT)
52	$(MAKE) -C git
53
54#
55# phony targets
56#
57install: all clean-cache
58	mkdir -p $(prefix)
59	install cgit $(prefix)/cgit.cgi
60	install cgit.css $(prefix)/cgit.css
61	install add.png del.png $(prefix)/
62
63clean-cgit:
64	rm -f cgit *.o
65
66distclean-cgit: clean-cgit
67	git clean -d -x
68
69clean-sub:
70	$(MAKE) -C git clean
71
72distclean-sub: clean-sub
73	$(shell cd git && git clean -d -x)
74
75clean-cache:
76	rm -rf $(CACHE_ROOT)/*
77
78clean: clean-cgit clean-sub
79
80distclean: distclean-cgit distclean-sub
81
82.PHONY: all install clean clean-cgit clean-sub clean-cache \
83	distclean distclean-cgit distclean-sub