summaryrefslogtreecommitdiffabout
authorTodd Zullinger <tmz@pobox.com>2010-09-06 13:31:23 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-09-19 17:11:45 (UTC)
commit0c3130de9677ddb0a3e257dba8de4e066ac0db6b (patch) (unidiff)
tree9c4c75a573587ae3d8b243c7fc902047b224cf32
parent679f7ef4f3f31dca8c8ac5536c3e18a5188e051a (diff)
downloadcgit-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>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Makefile39
1 files changed, 38 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index db97ae3..3004e88 100644
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,35 @@
1CGIT_VERSION = v0.8.3.3 1CGIT_VERSION = v0.8.3.3
2CGIT_SCRIPT_NAME = cgit.cgi 2CGIT_SCRIPT_NAME = cgit.cgi
3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit 3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) 4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
5CGIT_CONFIG = /etc/cgitrc 5CGIT_CONFIG = /etc/cgitrc
6CACHE_ROOT = /var/cache/cgit 6CACHE_ROOT = /var/cache/cgit
7prefix = /usr
8docdir = $(prefix)/share/doc/cgit
9htmldir = $(docdir)
10pdfdir = $(docdir)
11mandir = $(prefix)/share/man
7SHA1_HEADER = <openssl/sha.h> 12SHA1_HEADER = <openssl/sha.h>
8GIT_VER = 1.7.3 13GIT_VER = 1.7.3
9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 14GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
10INSTALL = install 15INSTALL = install
11MAN5_TXT = $(wildcard *.5.txt) 16MAN5_TXT = $(wildcard *.5.txt)
12MAN_TXT = $(MAN5_TXT) 17MAN_TXT = $(MAN5_TXT)
13DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT)) 18DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT))
14DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT)) 19DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
15DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT)) 20DOC_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
@@ -94,49 +99,50 @@ OBJECTS += shared.o
94OBJECTS += ui-atom.o 99OBJECTS += ui-atom.o
95OBJECTS += ui-blob.o 100OBJECTS += ui-blob.o
96OBJECTS += ui-clone.o 101OBJECTS += ui-clone.o
97OBJECTS += ui-commit.o 102OBJECTS += ui-commit.o
98OBJECTS += ui-diff.o 103OBJECTS += ui-diff.o
99OBJECTS += ui-log.o 104OBJECTS += ui-log.o
100OBJECTS += ui-patch.o 105OBJECTS += ui-patch.o
101OBJECTS += ui-plain.o 106OBJECTS += ui-plain.o
102OBJECTS += ui-refs.o 107OBJECTS += ui-refs.o
103OBJECTS += ui-repolist.o 108OBJECTS += ui-repolist.o
104OBJECTS += ui-shared.o 109OBJECTS += ui-shared.o
105OBJECTS += ui-snapshot.o 110OBJECTS += ui-snapshot.o
106OBJECTS += ui-ssdiff.o 111OBJECTS += ui-ssdiff.o
107OBJECTS += ui-stats.o 112OBJECTS += ui-stats.o
108OBJECTS += ui-summary.o 113OBJECTS += ui-summary.o
109OBJECTS += ui-tag.o 114OBJECTS += ui-tag.o
110OBJECTS += ui-tree.o 115OBJECTS += ui-tree.o
111 116
112ifdef NEEDS_LIBICONV 117ifdef NEEDS_LIBICONV
113 EXTLIBS += -liconv 118 EXTLIBS += -liconv
114endif 119endif
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
120all: cgit 126all: cgit
121 127
122VERSION: force-version 128VERSION: force-version
123 @./gen-version.sh "$(CGIT_VERSION)" 129 @./gen-version.sh "$(CGIT_VERSION)"
124-include VERSION 130-include VERSION
125 131
126 132
127CFLAGS += -g -Wall -Igit 133CFLAGS += -g -Wall -Igit
128CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' 134CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
129CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' 135CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
130CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' 136CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
131CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' 137CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
132CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' 138CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
133 139
134ifdef NO_ICONV 140ifdef NO_ICONV
135 CFLAGS += -DNO_ICONV 141 CFLAGS += -DNO_ICONV
136endif 142endif
137ifdef NO_STRCASESTR 143ifdef NO_STRCASESTR
138 CFLAGS += -DNO_STRCASESTR 144 CFLAGS += -DNO_STRCASESTR
139endif 145endif
140ifdef NO_C99_FORMAT 146ifdef NO_C99_FORMAT
141 CFLAGS += -DNO_C99_FORMAT 147 CFLAGS += -DNO_C99_FORMAT
142endif 148endif
@@ -149,52 +155,83 @@ endif
149 155
150cgit: $(OBJECTS) libgit 156cgit: $(OBJECTS) libgit
151 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) 157 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS)
152 158
153cgit.o: VERSION 159cgit.o: VERSION
154 160
155ifneq "$(MAKECMDGOALS)" "clean" 161ifneq "$(MAKECMDGOALS)" "clean"
156 -include $(OBJECTS:.o=.d) 162 -include $(OBJECTS:.o=.d)
157endif 163endif
158 164
159libgit: 165libgit:
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
163test: all 169test: all
164 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all 170 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
165 171
166install: all 172install: 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
179install-doc: install-man install-html install-pdf
180
181install-man: doc-man
182 $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man5
183 $(INSTALL) -m 0644 $(DOC_MAN5) $(DESTDIR)$(mandir)/man5
184
185install-html: doc-html
186 $(INSTALL) -m 0755 -d $(DESTDIR)$(htmldir)
187 $(INSTALL) -m 0644 $(DOC_HTML) $(DESTDIR)$(htmldir)
188
189install-pdf: doc-pdf
190 $(INSTALL) -m 0755 -d $(DESTDIR)$(pdfdir)
191 $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir)
192
173uninstall: 193uninstall:
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
198uninstall-doc: uninstall-man uninstall-html uninstall-pdf
199
200uninstall-man:
201 @for i in $(DOC_MAN5); do \
202 rm -fv $(DESTDIR)$(mandir)/man5/$$i; \
203 done
204
205uninstall-html:
206 @for i in $(DOC_HTML); do \
207 rm -fv $(DESTDIR)$(htmldir)/$$i; \
208 done
209
210uninstall-pdf:
211 @for i in $(DOC_PDF); do \
212 rm -fv $(DESTDIR)$(pdfdir)/$$i; \
213 done
214
178doc: doc-man doc-html doc-pdf 215doc: doc-man doc-html doc-pdf
179doc-man: doc-man5 216doc-man: doc-man5
180doc-man5: $(DOC_MAN5) 217doc-man5: $(DOC_MAN5)
181doc-html: $(DOC_HTML) 218doc-html: $(DOC_HTML)
182doc-pdf: $(DOC_PDF) 219doc-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
193clean: clean-doc 230clean: clean-doc
194 rm -f cgit VERSION *.o *.d 231 rm -f cgit VERSION *.o *.d
195 232
196clean-doc: 233clean-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
199get-git: 236get-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