|
diff --git a/Makefile b/Makefile index 3004e88..ebf8f03 100644 --- a/ Makefile+++ b/ Makefile |
|
@@ -1,237 +1,241 @@ |
1 | CGIT_VERSION = v0.8.3.3 |
1 | CGIT_VERSION = v0.8.3.3 |
2 | CGIT_SCRIPT_NAME = cgit.cgi |
2 | CGIT_SCRIPT_NAME = cgit.cgi |
3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit |
3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit |
4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) |
4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) |
5 | CGIT_CONFIG = /etc/cgitrc |
5 | CGIT_CONFIG = /etc/cgitrc |
6 | CACHE_ROOT = /var/cache/cgit |
6 | CACHE_ROOT = /var/cache/cgit |
7 | prefix = /usr |
7 | prefix = /usr |
| |
8 | libdir = $(prefix)/lib |
| |
9 | filterdir = $(libdir)/cgit/filters |
8 | docdir = $(prefix)/share/doc/cgit |
10 | docdir = $(prefix)/share/doc/cgit |
9 | htmldir = $(docdir) |
11 | htmldir = $(docdir) |
10 | pdfdir = $(docdir) |
12 | pdfdir = $(docdir) |
11 | mandir = $(prefix)/share/man |
13 | mandir = $(prefix)/share/man |
12 | SHA1_HEADER = <openssl/sha.h> |
14 | SHA1_HEADER = <openssl/sha.h> |
13 | GIT_VER = 1.7.3 |
15 | GIT_VER = 1.7.3 |
14 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 |
16 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 |
15 | INSTALL = install |
17 | INSTALL = install |
16 | MAN5_TXT = $(wildcard *.5.txt) |
18 | MAN5_TXT = $(wildcard *.5.txt) |
17 | MAN_TXT = $(MAN5_TXT) |
19 | MAN_TXT = $(MAN5_TXT) |
18 | DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT)) |
20 | DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT)) |
19 | DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) |
21 | DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) |
20 | DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT)) |
22 | DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT)) |
21 | |
23 | |
22 | # Define NO_STRCASESTR if you don't have strcasestr. |
24 | # Define NO_STRCASESTR if you don't have strcasestr. |
23 | # |
25 | # |
24 | # Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1 |
26 | # Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1 |
25 | # implementation (slower). |
27 | # implementation (slower). |
26 | # |
28 | # |
27 | # Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). |
29 | # Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). |
28 | # |
30 | # |
29 | # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) |
31 | # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) |
30 | # do not support the 'size specifiers' introduced by C99, namely ll, hh, |
32 | # do not support the 'size specifiers' introduced by C99, namely ll, hh, |
31 | # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t). |
33 | # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t). |
32 | # some C compilers supported these specifiers prior to C99 as an extension. |
34 | # some C compilers supported these specifiers prior to C99 as an extension. |
33 | # |
35 | # |
34 | |
36 | |
35 | #-include config.mak |
37 | #-include config.mak |
36 | |
38 | |
37 | # |
39 | # |
38 | # Platform specific tweaks |
40 | # Platform specific tweaks |
39 | # |
41 | # |
40 | |
42 | |
41 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
43 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
42 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') |
44 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') |
43 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') |
45 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') |
44 | |
46 | |
45 | ifeq ($(uname_O),Cygwin) |
47 | ifeq ($(uname_O),Cygwin) |
46 | NO_STRCASESTR = YesPlease |
48 | NO_STRCASESTR = YesPlease |
47 | NEEDS_LIBICONV = YesPlease |
49 | NEEDS_LIBICONV = YesPlease |
48 | endif |
50 | endif |
49 | |
51 | |
50 | # |
52 | # |
51 | # Let the user override the above settings. |
53 | # Let the user override the above settings. |
52 | # |
54 | # |
53 | -include cgit.conf |
55 | -include cgit.conf |
54 | |
56 | |
55 | # |
57 | # |
56 | # Define a way to invoke make in subdirs quietly, shamelessly ripped |
58 | # Define a way to invoke make in subdirs quietly, shamelessly ripped |
57 | # from git.git |
59 | # from git.git |
58 | # |
60 | # |
59 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir |
61 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir |
60 | QUIET_SUBDIR1 = |
62 | QUIET_SUBDIR1 = |
61 | |
63 | |
62 | ifneq ($(findstring $(MAKEFLAGS),w),w) |
64 | ifneq ($(findstring $(MAKEFLAGS),w),w) |
63 | PRINT_DIR = --no-print-directory |
65 | PRINT_DIR = --no-print-directory |
64 | else # "make -w" |
66 | else # "make -w" |
65 | NO_SUBDIR = : |
67 | NO_SUBDIR = : |
66 | endif |
68 | endif |
67 | |
69 | |
68 | ifndef V |
70 | ifndef V |
69 | QUIET_CC = @echo ' ' CC $@; |
71 | QUIET_CC = @echo ' ' CC $@; |
70 | QUIET_MM = @echo ' ' MM $@; |
72 | QUIET_MM = @echo ' ' MM $@; |
71 | QUIET_SUBDIR0 = +@subdir= |
73 | QUIET_SUBDIR0 = +@subdir= |
72 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ |
74 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ |
73 | $(MAKE) $(PRINT_DIR) -C $$subdir |
75 | $(MAKE) $(PRINT_DIR) -C $$subdir |
74 | endif |
76 | endif |
75 | |
77 | |
76 | # |
78 | # |
77 | # Define a pattern rule for automatic dependency building |
79 | # Define a pattern rule for automatic dependency building |
78 | # |
80 | # |
79 | %.d: %.c |
81 | %.d: %.c |
80 | $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ |
82 | $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ |
81 | |
83 | |
82 | # |
84 | # |
83 | # Define a pattern rule for silent object building |
85 | # Define a pattern rule for silent object building |
84 | # |
86 | # |
85 | %.o: %.c |
87 | %.o: %.c |
86 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< |
88 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< |
87 | |
89 | |
88 | |
90 | |
89 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread |
91 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread |
90 | OBJECTS = |
92 | OBJECTS = |
91 | OBJECTS += cache.o |
93 | OBJECTS += cache.o |
92 | OBJECTS += cgit.o |
94 | OBJECTS += cgit.o |
93 | OBJECTS += cmd.o |
95 | OBJECTS += cmd.o |
94 | OBJECTS += configfile.o |
96 | OBJECTS += configfile.o |
95 | OBJECTS += html.o |
97 | OBJECTS += html.o |
96 | OBJECTS += parsing.o |
98 | OBJECTS += parsing.o |
97 | OBJECTS += scan-tree.o |
99 | OBJECTS += scan-tree.o |
98 | OBJECTS += shared.o |
100 | OBJECTS += shared.o |
99 | OBJECTS += ui-atom.o |
101 | OBJECTS += ui-atom.o |
100 | OBJECTS += ui-blob.o |
102 | OBJECTS += ui-blob.o |
101 | OBJECTS += ui-clone.o |
103 | OBJECTS += ui-clone.o |
102 | OBJECTS += ui-commit.o |
104 | OBJECTS += ui-commit.o |
103 | OBJECTS += ui-diff.o |
105 | OBJECTS += ui-diff.o |
104 | OBJECTS += ui-log.o |
106 | OBJECTS += ui-log.o |
105 | OBJECTS += ui-patch.o |
107 | OBJECTS += ui-patch.o |
106 | OBJECTS += ui-plain.o |
108 | OBJECTS += ui-plain.o |
107 | OBJECTS += ui-refs.o |
109 | OBJECTS += ui-refs.o |
108 | OBJECTS += ui-repolist.o |
110 | OBJECTS += ui-repolist.o |
109 | OBJECTS += ui-shared.o |
111 | OBJECTS += ui-shared.o |
110 | OBJECTS += ui-snapshot.o |
112 | OBJECTS += ui-snapshot.o |
111 | OBJECTS += ui-ssdiff.o |
113 | OBJECTS += ui-ssdiff.o |
112 | OBJECTS += ui-stats.o |
114 | OBJECTS += ui-stats.o |
113 | OBJECTS += ui-summary.o |
115 | OBJECTS += ui-summary.o |
114 | OBJECTS += ui-tag.o |
116 | OBJECTS += ui-tag.o |
115 | OBJECTS += ui-tree.o |
117 | OBJECTS += ui-tree.o |
116 | |
118 | |
117 | ifdef NEEDS_LIBICONV |
119 | ifdef NEEDS_LIBICONV |
118 | EXTLIBS += -liconv |
120 | EXTLIBS += -liconv |
119 | endif |
121 | endif |
120 | |
122 | |
121 | |
123 | |
122 | .PHONY: all libgit test install uninstall clean force-version get-git \ |
124 | .PHONY: all libgit test install uninstall clean force-version get-git \ |
123 | doc clean-doc install-doc install-man install-html install-pdf \ |
125 | doc clean-doc install-doc install-man install-html install-pdf \ |
124 | uninstall-doc uninstall-man uninstall-html uninstall-pdf |
126 | uninstall-doc uninstall-man uninstall-html uninstall-pdf |
125 | |
127 | |
126 | all: cgit |
128 | all: cgit |
127 | |
129 | |
128 | VERSION: force-version |
130 | VERSION: force-version |
129 | @./gen-version.sh "$(CGIT_VERSION)" |
131 | @./gen-version.sh "$(CGIT_VERSION)" |
130 | -include VERSION |
132 | -include VERSION |
131 | |
133 | |
132 | |
134 | |
133 | CFLAGS += -g -Wall -Igit |
135 | CFLAGS += -g -Wall -Igit |
134 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' |
136 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' |
135 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' |
137 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' |
136 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
138 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
137 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' |
139 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' |
138 | CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' |
140 | CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' |
139 | |
141 | |
140 | ifdef NO_ICONV |
142 | ifdef NO_ICONV |
141 | CFLAGS += -DNO_ICONV |
143 | CFLAGS += -DNO_ICONV |
142 | endif |
144 | endif |
143 | ifdef NO_STRCASESTR |
145 | ifdef NO_STRCASESTR |
144 | CFLAGS += -DNO_STRCASESTR |
146 | CFLAGS += -DNO_STRCASESTR |
145 | endif |
147 | endif |
146 | ifdef NO_C99_FORMAT |
148 | ifdef NO_C99_FORMAT |
147 | CFLAGS += -DNO_C99_FORMAT |
149 | CFLAGS += -DNO_C99_FORMAT |
148 | endif |
150 | endif |
149 | ifdef NO_OPENSSL |
151 | ifdef NO_OPENSSL |
150 | CFLAGS += -DNO_OPENSSL |
152 | CFLAGS += -DNO_OPENSSL |
151 | GIT_OPTIONS += NO_OPENSSL=1 |
153 | GIT_OPTIONS += NO_OPENSSL=1 |
152 | else |
154 | else |
153 | EXTLIBS += -lcrypto |
155 | EXTLIBS += -lcrypto |
154 | endif |
156 | endif |
155 | |
157 | |
156 | cgit: $(OBJECTS) libgit |
158 | cgit: $(OBJECTS) libgit |
157 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) |
159 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) |
158 | |
160 | |
159 | cgit.o: VERSION |
161 | cgit.o: VERSION |
160 | |
162 | |
161 | ifneq "$(MAKECMDGOALS)" "clean" |
163 | ifneq "$(MAKECMDGOALS)" "clean" |
162 | -include $(OBJECTS:.o=.d) |
164 | -include $(OBJECTS:.o=.d) |
163 | endif |
165 | endif |
164 | |
166 | |
165 | libgit: |
167 | libgit: |
166 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a |
168 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a |
167 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a |
169 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a |
168 | |
170 | |
169 | test: all |
171 | test: all |
170 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
172 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
171 | |
173 | |
172 | install: all |
174 | install: all |
173 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH) |
175 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH) |
174 | $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
176 | $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
175 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH) |
177 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH) |
176 | $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css |
178 | $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css |
177 | $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png |
179 | $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png |
| |
180 | $(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir) |
| |
181 | $(INSTALL) -m 0755 filters/* $(DESTDIR)$(filterdir) |
178 | |
182 | |
179 | install-doc: install-man install-html install-pdf |
183 | install-doc: install-man install-html install-pdf |
180 | |
184 | |
181 | install-man: doc-man |
185 | install-man: doc-man |
182 | $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man5 |
186 | $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man5 |
183 | $(INSTALL) -m 0644 $(DOC_MAN5) $(DESTDIR)$(mandir)/man5 |
187 | $(INSTALL) -m 0644 $(DOC_MAN5) $(DESTDIR)$(mandir)/man5 |
184 | |
188 | |
185 | install-html: doc-html |
189 | install-html: doc-html |
186 | $(INSTALL) -m 0755 -d $(DESTDIR)$(htmldir) |
190 | $(INSTALL) -m 0755 -d $(DESTDIR)$(htmldir) |
187 | $(INSTALL) -m 0644 $(DOC_HTML) $(DESTDIR)$(htmldir) |
191 | $(INSTALL) -m 0644 $(DOC_HTML) $(DESTDIR)$(htmldir) |
188 | |
192 | |
189 | install-pdf: doc-pdf |
193 | install-pdf: doc-pdf |
190 | $(INSTALL) -m 0755 -d $(DESTDIR)$(pdfdir) |
194 | $(INSTALL) -m 0755 -d $(DESTDIR)$(pdfdir) |
191 | $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir) |
195 | $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir) |
192 | |
196 | |
193 | uninstall: |
197 | uninstall: |
194 | rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
198 | rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
195 | rm -f $(CGIT_DATA_PATH)/cgit.css |
199 | rm -f $(CGIT_DATA_PATH)/cgit.css |
196 | rm -f $(CGIT_DATA_PATH)/cgit.png |
200 | rm -f $(CGIT_DATA_PATH)/cgit.png |
197 | |
201 | |
198 | uninstall-doc: uninstall-man uninstall-html uninstall-pdf |
202 | uninstall-doc: uninstall-man uninstall-html uninstall-pdf |
199 | |
203 | |
200 | uninstall-man: |
204 | uninstall-man: |
201 | @for i in $(DOC_MAN5); do \ |
205 | @for i in $(DOC_MAN5); do \ |
202 | rm -fv $(DESTDIR)$(mandir)/man5/$$i; \ |
206 | rm -fv $(DESTDIR)$(mandir)/man5/$$i; \ |
203 | done |
207 | done |
204 | |
208 | |
205 | uninstall-html: |
209 | uninstall-html: |
206 | @for i in $(DOC_HTML); do \ |
210 | @for i in $(DOC_HTML); do \ |
207 | rm -fv $(DESTDIR)$(htmldir)/$$i; \ |
211 | rm -fv $(DESTDIR)$(htmldir)/$$i; \ |
208 | done |
212 | done |
209 | |
213 | |
210 | uninstall-pdf: |
214 | uninstall-pdf: |
211 | @for i in $(DOC_PDF); do \ |
215 | @for i in $(DOC_PDF); do \ |
212 | rm -fv $(DESTDIR)$(pdfdir)/$$i; \ |
216 | rm -fv $(DESTDIR)$(pdfdir)/$$i; \ |
213 | done |
217 | done |
214 | |
218 | |
215 | doc: doc-man doc-html doc-pdf |
219 | doc: doc-man doc-html doc-pdf |
216 | doc-man: doc-man5 |
220 | doc-man: doc-man5 |
217 | doc-man5: $(DOC_MAN5) |
221 | doc-man5: $(DOC_MAN5) |
218 | doc-html: $(DOC_HTML) |
222 | doc-html: $(DOC_HTML) |
219 | doc-pdf: $(DOC_PDF) |
223 | doc-pdf: $(DOC_PDF) |
220 | |
224 | |
221 | %.5 : %.5.txt |
225 | %.5 : %.5.txt |
222 | a2x -f manpage $< |
226 | a2x -f manpage $< |
223 | |
227 | |
224 | $(DOC_HTML): %.html : %.txt |
228 | $(DOC_HTML): %.html : %.txt |
225 | a2x -f xhtml --stylesheet=cgit-doc.css $< |
229 | a2x -f xhtml --stylesheet=cgit-doc.css $< |
226 | |
230 | |
227 | $(DOC_PDF): %.pdf : %.txt |
231 | $(DOC_PDF): %.pdf : %.txt |
228 | a2x -f pdf cgitrc.5.txt |
232 | a2x -f pdf cgitrc.5.txt |
229 | |
233 | |
230 | clean: clean-doc |
234 | clean: clean-doc |
231 | rm -f cgit VERSION *.o *.d |
235 | rm -f cgit VERSION *.o *.d |
232 | |
236 | |
233 | clean-doc: |
237 | clean-doc: |
234 | rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo |
238 | rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo |
235 | |
239 | |
236 | get-git: |
240 | get-git: |
237 | curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git |
241 | curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git |
|