]> git.cameronkatri.com Git - cgit.git/blob - Makefile
git: update to 1.8.2.2
[cgit.git] / Makefile
1 all::
2
3 CGIT_VERSION = v0.9.1
4 CGIT_SCRIPT_NAME = cgit.cgi
5 CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
6 CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
7 CGIT_CONFIG = /etc/cgitrc
8 CACHE_ROOT = /var/cache/cgit
9 prefix = /usr
10 libdir = $(prefix)/lib
11 filterdir = $(libdir)/cgit/filters
12 docdir = $(prefix)/share/doc/cgit
13 htmldir = $(docdir)
14 pdfdir = $(docdir)
15 mandir = $(prefix)/share/man
16 SHA1_HEADER = <openssl/sha.h>
17 GIT_VER = 1.8.2.2
18 GIT_URL = https://git-core.googlecode.com/files/git-$(GIT_VER).tar.gz
19 INSTALL = install
20 MAN5_TXT = $(wildcard *.5.txt)
21 MAN_TXT = $(MAN5_TXT)
22 DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT))
23 DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
24 DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT))
25
26 # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
27 # do not support the 'size specifiers' introduced by C99, namely ll, hh,
28 # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
29 # some C compilers supported these specifiers prior to C99 as an extension.
30 #
31
32 #-include config.mak
33
34 #
35 # Let the user override the above settings.
36 #
37 -include cgit.conf
38
39 export CGIT_SCRIPT_NAME CGIT_SCRIPT_PATH CGIT_DATA_PATH CGIT_CONFIG CACHE_ROOT
40
41 #
42 # Define a way to invoke make in subdirs quietly, shamelessly ripped
43 # from git.git
44 #
45 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
46 QUIET_SUBDIR1 =
47
48 ifneq ($(findstring $(MAKEFLAGS),w),w)
49 PRINT_DIR = --no-print-directory
50 else # "make -w"
51 NO_SUBDIR = :
52 endif
53
54 ifndef V
55 QUIET_SUBDIR0 = +@subdir=
56 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
57 $(MAKE) $(PRINT_DIR) -C $$subdir
58 QUIET_TAGS = @echo ' ' TAGS $@;
59 export V
60 endif
61
62 .SUFFIXES:
63
64 all:: cgit
65
66 cgit:
67 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit NO_CURL=1
68
69 git:
70 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1
71
72 test: all git
73 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
74
75 install: all
76 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH)
77 $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
78 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH)
79 $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
80 $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
81 $(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir)
82 $(INSTALL) -m 0755 filters/* $(DESTDIR)$(filterdir)
83
84 install-doc: install-man install-html install-pdf
85
86 install-man: doc-man
87 $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man5
88 $(INSTALL) -m 0644 $(DOC_MAN5) $(DESTDIR)$(mandir)/man5
89
90 install-html: doc-html
91 $(INSTALL) -m 0755 -d $(DESTDIR)$(htmldir)
92 $(INSTALL) -m 0644 $(DOC_HTML) $(DESTDIR)$(htmldir)
93
94 install-pdf: doc-pdf
95 $(INSTALL) -m 0755 -d $(DESTDIR)$(pdfdir)
96 $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir)
97
98 uninstall:
99 rm -f $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
100 rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
101 rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
102
103 uninstall-doc: uninstall-man uninstall-html uninstall-pdf
104
105 uninstall-man:
106 @for i in $(DOC_MAN5); do \
107 rm -fv $(DESTDIR)$(mandir)/man5/$$i; \
108 done
109
110 uninstall-html:
111 @for i in $(DOC_HTML); do \
112 rm -fv $(DESTDIR)$(htmldir)/$$i; \
113 done
114
115 uninstall-pdf:
116 @for i in $(DOC_PDF); do \
117 rm -fv $(DESTDIR)$(pdfdir)/$$i; \
118 done
119
120 doc: doc-man doc-html doc-pdf
121 doc-man: doc-man5
122 doc-man5: $(DOC_MAN5)
123 doc-html: $(DOC_HTML)
124 doc-pdf: $(DOC_PDF)
125
126 %.5 : %.5.txt
127 a2x -f manpage $<
128
129 $(DOC_HTML): %.html : %.txt
130 a2x -f xhtml --stylesheet=cgit-doc.css $<
131
132 $(DOC_PDF): %.pdf : %.txt
133 a2x -f pdf cgitrc.5.txt
134
135 clean: clean-doc
136 $(RM) cgit VERSION CGIT-CFLAGS *.o tags
137 $(RM) -r .deps
138
139 cleanall: clean
140 $(MAKE) -C git clean
141
142 clean-doc:
143 $(RM) cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
144
145 get-git:
146 curl -L $(GIT_URL) | tar -xzf - && rm -rf git && mv git-$(GIT_VER) git
147
148 tags:
149 $(QUIET_TAGS)find . -name '*.[ch]' | xargs ctags
150
151 .PHONY: all cgit git get-git
152 .PHONY: clean clean-doc cleanall
153 .PHONY: doc doc-html doc-man doc-pdf
154 .PHONY: install install-doc install-html install-man install-pdf
155 .PHONY: tags test
156 .PHONY: uninstall uninstall-doc uninstall-html uninstall-man uninstall-pdf