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
57 OBJECTS += scan-tree.o
62 OBJECTS += ui-commit.o
68 OBJECTS += ui-repolist.o
69 OBJECTS += ui-shared.o
70 OBJECTS += ui-snapshot.o
72 OBJECTS += ui-summary.o
81 .PHONY: all libgit test install uninstall clean force-version get-git
85 VERSION: force-version
86 @./gen-version.sh "$(CGIT_VERSION)"
90 CFLAGS += -g -Wall -Igit
91 CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
92 CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
93 CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
94 CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
95 CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
101 cgit: $(OBJECTS) libgit
102 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS)
106 -include $(OBJECTS:.o=.d)
109 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a
110 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a
113 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
116 mkdir -p $(DESTDIR)$(CGIT_SCRIPT_PATH)
117 install cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
118 install cgit.css $(DESTDIR)$(CGIT_SCRIPT_PATH)/cgit.css
119 install cgit.png $(DESTDIR)$(CGIT_SCRIPT_PATH)/cgit.png
122 rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
123 rm -f $(CGIT_SCRIPT_PATH)/cgit.css
124 rm -f $(CGIT_SCRIPT_PATH)/cgit.png
127 rm -f cgit VERSION *.o *.d
130 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git