blob: ed29b3ac33a98d73d8dd91da88d12349db16d75b [file] [log] [blame]
Jamie Coutureca59b262012-11-17 13:02:17 -05001all::
2
Jason A. Donenfelda6a932e2012-11-15 01:28:59 +01003CGIT_VERSION = v0.9.1
Lars Hjemliea2831f2007-05-15 00:48:31 +02004CGIT_SCRIPT_NAME = cgit.cgi
Lars Hjemlie8920b52007-09-03 21:52:14 +02005CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
Todd Zullingerd529c6f2009-01-11 18:23:59 -05006CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
Lars Hjemlie8920b52007-09-03 21:52:14 +02007CGIT_CONFIG = /etc/cgitrc
8CACHE_ROOT = /var/cache/cgit
Todd Zullinger0c3130d2010-09-06 09:31:23 -04009prefix = /usr
Todd Zullinger6d10c132010-09-06 09:31:24 -040010libdir = $(prefix)/lib
11filterdir = $(libdir)/cgit/filters
Todd Zullinger0c3130d2010-09-06 09:31:23 -040012docdir = $(prefix)/share/doc/cgit
13htmldir = $(docdir)
14pdfdir = $(docdir)
15mandir = $(prefix)/share/man
Lars Hjemlie8920b52007-09-03 21:52:14 +020016SHA1_HEADER = <openssl/sha.h>
John Keeping849ecd92013-04-08 09:00:22 +010017GIT_VER = 1.8.2.1
Jamie Coutureca59b262012-11-17 13:02:17 -050018GIT_URL = https://git-core.googlecode.com/files/git-$(GIT_VER).tar.gz
Todd Zullinger4ac89ec2009-01-11 18:23:52 -050019INSTALL = install
Todd Zullinger679f7ef2010-09-06 09:31:22 -040020MAN5_TXT = $(wildcard *.5.txt)
21MAN_TXT = $(MAN5_TXT)
22DOC_MAN5 = $(patsubst %.txt,%,$(MAN5_TXT))
23DOC_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
24DOC_PDF = $(patsubst %.txt,%.pdf,$(MAN_TXT))
Lars Hjemli9ecde652007-05-14 23:09:49 +020025
Mark Lodatoe4ddc8f2010-09-04 11:30:18 -040026# 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#
Ramsay Jones97fdac12008-11-15 18:26:32 +000031
32#-include config.mak
33
34#
Lars Hjemlia5e899e2008-12-05 18:47:16 +010035# Let the user override the above settings.
36#
37-include cgit.conf
38
John Keeping5f323c12013-03-06 21:22:06 +000039export CGIT_SCRIPT_NAME CGIT_SCRIPT_PATH CGIT_DATA_PATH CGIT_CONFIG CACHE_ROOT
40
Lars Hjemlia5e899e2008-12-05 18:47:16 +010041#
Lars Hjemlic60781d2008-03-25 01:41:10 +010042# Define a way to invoke make in subdirs quietly, shamelessly ripped
43# from git.git
44#
45QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
46QUIET_SUBDIR1 =
47
48ifneq ($(findstring $(MAKEFLAGS),w),w)
49PRINT_DIR = --no-print-directory
50else # "make -w"
51NO_SUBDIR = :
52endif
53
54ifndef V
Lars Hjemlic60781d2008-03-25 01:41:10 +010055 QUIET_SUBDIR0 = +@subdir=
56 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
57 $(MAKE) $(PRINT_DIR) -C $$subdir
Jamie Couture6419c9b2012-10-08 13:12:17 -040058 QUIET_TAGS = @echo ' ' TAGS $@;
Jamie Coutureca59b262012-11-17 13:02:17 -050059 export V
Lars Hjemlic60781d2008-03-25 01:41:10 +010060endif
Lars Hjemlif6925032007-06-18 09:42:10 +020061
Jamie Coutureca59b262012-11-17 13:02:17 -050062.SUFFIXES:
63
Jamie Coutureca59b262012-11-17 13:02:17 -050064all:: cgit
Lars Hjemli1ae41a02007-11-06 09:35:07 +010065
John Keeping5f323c12013-03-06 21:22:06 +000066cgit:
67 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit NO_CURL=1
Lars Hjemlia1266ed2008-08-01 01:25:51 +020068
John Keepingc95cc5e2013-04-01 15:09:05 +010069git:
70 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1
71
72test: all git
Lars Hjemlic60781d2008-03-25 01:41:10 +010073 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
Lars Hjemlib4649fc2007-11-11 00:40:58 +010074
Lars Hjemlie8920b52007-09-03 21:52:14 +020075install: all
Todd Zullinger4ac89ec2009-01-11 18:23:52 -050076 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH)
77 $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
Todd Zullingerd529c6f2009-01-11 18:23:59 -050078 $(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
Todd Zullinger6d10c132010-09-06 09:31:24 -040081 $(INSTALL) -m 0755 -d $(DESTDIR)$(filterdir)
82 $(INSTALL) -m 0755 filters/* $(DESTDIR)$(filterdir)
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020083
Todd Zullinger0c3130d2010-09-06 09:31:23 -040084install-doc: install-man install-html install-pdf
85
86install-man: doc-man
87 $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man5
88 $(INSTALL) -m 0644 $(DOC_MAN5) $(DESTDIR)$(mandir)/man5
89
90install-html: doc-html
91 $(INSTALL) -m 0755 -d $(DESTDIR)$(htmldir)
92 $(INSTALL) -m 0644 $(DOC_HTML) $(DESTDIR)$(htmldir)
93
94install-pdf: doc-pdf
95 $(INSTALL) -m 0755 -d $(DESTDIR)$(pdfdir)
96 $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir)
Lars Hjemlicc1dbd12007-05-10 11:25:12 +020097
Lars Hjemlie8920b52007-09-03 21:52:14 +020098uninstall:
Ferry Huberts96f05012011-07-18 12:45:56 +020099 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
Lars Hjemlicc1dbd12007-05-10 11:25:12 +0200102
Todd Zullinger0c3130d2010-09-06 09:31:23 -0400103uninstall-doc: uninstall-man uninstall-html uninstall-pdf
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100104
Todd Zullinger0c3130d2010-09-06 09:31:23 -0400105uninstall-man:
106 @for i in $(DOC_MAN5); do \
107 rm -fv $(DESTDIR)$(mandir)/man5/$$i; \
108 done
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100109
Todd Zullinger0c3130d2010-09-06 09:31:23 -0400110uninstall-html:
111 @for i in $(DOC_HTML); do \
112 rm -fv $(DESTDIR)$(htmldir)/$$i; \
113 done
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100114
Todd Zullinger0c3130d2010-09-06 09:31:23 -0400115uninstall-pdf:
116 @for i in $(DOC_PDF); do \
117 rm -fv $(DESTDIR)$(pdfdir)/$$i; \
118 done
119
Todd Zullinger679f7ef2010-09-06 09:31:22 -0400120doc: doc-man doc-html doc-pdf
121doc-man: doc-man5
122doc-man5: $(DOC_MAN5)
123doc-html: $(DOC_HTML)
124doc-pdf: $(DOC_PDF)
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100125
Todd Zullinger679f7ef2010-09-06 09:31:22 -0400126%.5 : %.5.txt
127 a2x -f manpage $<
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100128
Todd Zullinger679f7ef2010-09-06 09:31:22 -0400129$(DOC_HTML): %.html : %.txt
130 a2x -f xhtml --stylesheet=cgit-doc.css $<
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100131
Todd Zullinger679f7ef2010-09-06 09:31:22 -0400132$(DOC_PDF): %.pdf : %.txt
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100133 a2x -f pdf cgitrc.5.txt
134
135clean: clean-doc
Jason A. Donenfeld121089c2013-03-20 21:14:22 +0100136 $(RM) cgit VERSION CGIT-CFLAGS *.o tags
Jamie Coutureca59b262012-11-17 13:02:17 -0500137 $(RM) -r .deps
138
139cleanall: clean
140 $(MAKE) -C git clean
Lars Hjemlicc1dbd12007-05-10 11:25:12 +0200141
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100142clean-doc:
Jamie Coutureca59b262012-11-17 13:02:17 -0500143 $(RM) cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
Lars Hjemli5e57cb22009-02-12 10:53:31 +0100144
Lars Hjemli95eaf272007-09-03 22:42:54 +0200145get-git:
Ferry Huberts633a66c2012-11-03 17:49:45 -0600146 curl -L $(GIT_URL) | tar -xzf - && rm -rf git && mv git-$(GIT_VER) git
Jamie Couture6419c9b2012-10-08 13:12:17 -0400147
148tags:
149 $(QUIET_TAGS)find . -name '*.[ch]' | xargs ctags
Jamie Coutureca59b262012-11-17 13:02:17 -0500150
John Keepingc95cc5e2013-04-01 15:09:05 +0100151.PHONY: all cgit git get-git
Jamie Coutureca59b262012-11-17 13:02:17 -0500152.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