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