1 CGIT_VERSION = v0.8.2.1
2 CGIT_SCRIPT_NAME = cgit.cgi
3 CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
4 CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
5 CGIT_CONFIG = /etc/cgitrc
6 CACHE_ROOT = /var/cache/cgit
7 SHA1_HEADER = <openssl/sha.h>
9 GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
12 # Define NO_STRCASESTR if you don't have strcasestr.
14 # Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
20 # Platform specific tweaks
23 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
24 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
25 uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
27 ifeq ($(uname_O),Cygwin)
28 NO_STRCASESTR = YesPlease
29 NEEDS_LIBICONV = YesPlease
33 # Let the user override the above settings.
38 # Define a way to invoke make in subdirs quietly, shamelessly ripped
41 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
44 ifneq ($(findstring $(MAKEFLAGS),w),w)
45 PRINT_DIR = --no-print-directory
51 QUIET_CC = @echo ' ' CC $@;
52 QUIET_MM = @echo ' ' MM $@;
53 QUIET_SUBDIR0 = +@subdir=
54 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
55 $(MAKE) $(PRINT_DIR) -C $$subdir
59 # Define a pattern rule for automatic dependency building
62 $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@
65 # Define a pattern rule for silent object building
68 $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
71 EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
76 OBJECTS += configfile.o
79 OBJECTS += scan-tree.o
84 OBJECTS += ui-commit.o
90 OBJECTS += ui-repolist.o
91 OBJECTS += ui-shared.o
92 OBJECTS += ui-snapshot.o
94 OBJECTS += ui-summary.o
103 .PHONY: all libgit test install uninstall clean force-version get-git \
104 doc man-doc html-doc clean-doc
108 VERSION: force-version
109 @./gen-version.sh "$(CGIT_VERSION)"
113 CFLAGS += -g -Wall -Igit
114 CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
115 CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
116 CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
117 CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
118 CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
124 CFLAGS += -DNO_STRCASESTR
127 cgit: $(OBJECTS) libgit
128 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS)
132 -include $(OBJECTS:.o=.d)
135 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a
136 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a
139 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
142 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH)
143 $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
144 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH)
145 $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
146 $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
149 rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
150 rm -f $(CGIT_DATA_PATH)/cgit.css
151 rm -f $(CGIT_DATA_PATH)/cgit.png
153 doc: man-doc html-doc pdf-doc
155 man-doc: cgitrc.5.txt
156 a2x -f manpage cgitrc.5.txt
158 html-doc: cgitrc.5.txt
159 a2x -f xhtml --stylesheet=cgit-doc.css cgitrc.5.txt
161 pdf-doc: cgitrc.5.txt
162 a2x -f pdf cgitrc.5.txt
165 rm -f cgit VERSION *.o *.d
168 rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
171 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git