]> git.cameronkatri.com Git - cgit.git/blob - Makefile
4df95b4ed99a8734b74d57976321f04dcbdb63ba
[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.3
18 GIT_URL = https://git-core.googlecode.com/files/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
33 #-include config.mak
34
35 #
36 # Let the user override the above settings.
37 #
38 -include cgit.conf
39
40 export CGIT_SCRIPT_NAME CGIT_SCRIPT_PATH CGIT_DATA_PATH CGIT_CONFIG CACHE_ROOT
41
42 #
43 # Define a way to invoke make in subdirs quietly, shamelessly ripped
44 # from git.git
45 #
46 QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
47 QUIET_SUBDIR1 =
48
49 ifneq ($(findstring $(MAKEFLAGS),w),w)
50 PRINT_DIR = --no-print-directory
51 else # "make -w"
52 NO_SUBDIR = :
53 endif
54
55 ifndef V
56 QUIET_SUBDIR0 = +@subdir=
57 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
58 $(MAKE) $(PRINT_DIR) -C $$subdir
59 QUIET_TAGS = @echo ' ' TAGS $@;
60 export V
61 endif
62
63 .SUFFIXES:
64
65 all:: cgit
66
67 cgit:
68 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit $(EXTRA_GIT_TARGETS) NO_CURL=1
69
70 test:
71 @$(MAKE) --no-print-directory cgit EXTRA_GIT_TARGETS=all
72 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
73
74 install: all
75 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH)
76 $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
77 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH)
78 $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
79 $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
80 $(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir)
81 $(COPYTREE) filters/* $(DESTDIR)$(filterdir)
82
83 install-doc: install-man install-html install-pdf
84
85 install-man: doc-man
86 $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man5
87 $(INSTALL) -m 0644 $(DOC_MAN5) $(DESTDIR)$(mandir)/man5
88
89 install-html: doc-html
90 $(INSTALL) -m 0755 -d $(DESTDIR)$(htmldir)
91 $(INSTALL) -m 0644 $(DOC_HTML) $(DESTDIR)$(htmldir)
92
93 install-pdf: doc-pdf
94 $(INSTALL) -m 0755 -d $(DESTDIR)$(pdfdir)
95 $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir)
96
97 uninstall:
98 rm -f $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
99 rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
100 rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
101
102 uninstall-doc: uninstall-man uninstall-html uninstall-pdf
103
104 uninstall-man:
105 @for i in $(DOC_MAN5); do \
106 rm -fv $(DESTDIR)$(mandir)/man5/$$i; \
107 done
108
109 uninstall-html:
110 @for i in $(DOC_HTML); do \
111 rm -fv $(DESTDIR)$(htmldir)/$$i; \
112 done
113
114 uninstall-pdf:
115 @for i in $(DOC_PDF); do \
116 rm -fv $(DESTDIR)$(pdfdir)/$$i; \
117 done
118
119 doc: doc-man doc-html doc-pdf
120 doc-man: doc-man5
121 doc-man5: $(DOC_MAN5)
122 doc-html: $(DOC_HTML)
123 doc-pdf: $(DOC_PDF)
124
125 %.5 : %.5.txt
126 a2x -f manpage $<
127
128 $(DOC_HTML): %.html : %.txt
129 a2x -f xhtml --stylesheet=cgit-doc.css $<
130
131 $(DOC_PDF): %.pdf : %.txt
132 a2x -f pdf cgitrc.5.txt
133
134 clean: clean-doc
135 $(RM) cgit VERSION CGIT-CFLAGS *.o tags
136 $(RM) -r .deps
137
138 cleanall: clean
139 $(MAKE) -C git clean
140
141 clean-doc:
142 $(RM) cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
143
144 get-git:
145 curl -L $(GIT_URL) | tar -xzf - && rm -rf git && mv git-$(GIT_VER) git
146
147 tags:
148 $(QUIET_TAGS)find . -name '*.[ch]' | xargs ctags
149
150 .PHONY: all cgit git get-git
151 .PHONY: clean clean-doc cleanall
152 .PHONY: doc doc-html doc-man doc-pdf
153 .PHONY: install install-doc install-html install-man install-pdf
154 .PHONY: tags test
155 .PHONY: uninstall uninstall-doc uninstall-html uninstall-man uninstall-pdf