2 CGIT_SCRIPT_NAME = cgit.cgi
3 CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
4 CGIT_CONFIG = /etc/cgitrc
5 CACHE_ROOT = /var/cache/cgit
6 SHA1_HEADER = <openssl/sha.h>
8 GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
11 # Let the user override the above settings.
16 # Define a way to invoke make in subdirs quietly, shamelessly ripped
19 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
22 ifneq ($(findstring $(MAKEFLAGS),w),w)
23 PRINT_DIR = --no-print-directory
29 QUIET_CC = @echo ' ' CC $@;
30 QUIET_MM = @echo ' ' MM $@;
31 QUIET_SUBDIR0 = +@subdir=
32 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
33 $(MAKE) $(PRINT_DIR) -C $$subdir
37 # Define a pattern rule for automatic dependency building
40 $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@
43 # Define a pattern rule for silent object building
46 $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
49 EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
54 OBJECTS += configfile.o
59 OBJECTS += ui-commit.o
64 OBJECTS += ui-repolist.o
65 OBJECTS += ui-shared.o
66 OBJECTS += ui-snapshot.o
67 OBJECTS += ui-summary.o
76 .PHONY: all git test install uninstall clean force-version get-git
80 VERSION: force-version
81 @./gen-version.sh "$(CGIT_VERSION)"
85 CFLAGS += -g -Wall -Igit
86 CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
87 CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
88 CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
89 CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
90 CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
93 cgit: $(OBJECTS) git/libgit.a git/xdiff/lib.a
94 $(QUIET_CC)$(CC) $(CFLAGS) -o cgit $(OBJECTS) $(EXTLIBS)
98 -include $(OBJECTS:.o=.d)
101 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a
104 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a
107 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
110 mkdir -p $(DESTDIR)$(CGIT_SCRIPT_PATH)
111 install cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
112 install cgit.css $(DESTDIR)$(CGIT_SCRIPT_PATH)/cgit.css
113 install cgit.png $(DESTDIR)$(CGIT_SCRIPT_PATH)/cgit.png
116 rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
117 rm -f $(CGIT_SCRIPT_PATH)/cgit.css
118 rm -f $(CGIT_SCRIPT_PATH)/cgit.png
121 rm -f cgit VERSION *.o *.d
124 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git