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