]> git.ipfire.org Git - thirdparty/git.git/blame - gitweb/Makefile
Merge branch 'js/t1450-making-it-writable-does-not-need-full-posixperm'
[thirdparty/git.git] / gitweb / Makefile
CommitLineData
62331ef1
JWH
1# The default target of this Makefile is...
2all::
3
4# Define V=1 to have a more verbose compile.
5#
6# Define JSMIN to point to JavaScript minifier that functions as
18d05328 7# a filter to have static/gitweb.js minified.
62331ef1 8#
0e6ce213 9# Define CSSMIN to point to a CSS minifier in order to generate a minified
18d05328 10# version of static/gitweb.css
0e6ce213 11#
62331ef1
JWH
12
13prefix ?= $(HOME)
14bindir ?= $(prefix)/bin
152d9434
JN
15gitwebdir ?= /var/www/cgi-bin
16
62331ef1 17RM ?= rm -f
152d9434 18INSTALL ?= install
62331ef1 19
62331ef1
JWH
20# default configuration for gitweb
21GITWEB_CONFIG = gitweb_config.perl
22GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
131d6afc 23GITWEB_CONFIG_COMMON = /etc/gitweb-common.conf
62331ef1
JWH
24GITWEB_HOME_LINK_STR = projects
25GITWEB_SITENAME =
26GITWEB_PROJECTROOT = /pub/git
27GITWEB_PROJECT_MAXDEPTH = 2007
28GITWEB_EXPORT_OK =
29GITWEB_STRICT_EXPORT =
30GITWEB_BASE_URL =
31GITWEB_LIST =
32GITWEB_HOMETEXT = indextext.html
18d05328
PKS
33GITWEB_CSS = static/gitweb.css
34GITWEB_LOGO = static/git-logo.png
35GITWEB_FAVICON = static/git-favicon.png
36GITWEB_JS = static/gitweb.js
c1355b7f 37GITWEB_SITE_HTML_HEAD_STRING =
62331ef1
JWH
38GITWEB_SITE_HEADER =
39GITWEB_SITE_FOOTER =
7ce896b3 40HIGHLIGHT_BIN = highlight
62331ef1
JWH
41
42# include user config
43-include ../config.mak.autogen
44-include ../config.mak
9b93aeb2 45-include config.mak
62331ef1
JWH
46
47# determine version
48../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
49 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
50
e3a9237e 51ifneq ($(MAKECMDGOALS),clean)
62331ef1 52-include ../GIT-VERSION-FILE
e3a9237e 53endif
62331ef1
JWH
54
55### Build rules
56
57SHELL_PATH ?= $(SHELL)
58PERL_PATH ?= /usr/bin/perl
59
60# Shell quote;
152d9434
JN
61bindir_SQ = $(subst ','\'',$(bindir))#'
62gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
18d05328 63gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
152d9434
JN
64SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
65PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
66DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
62331ef1
JWH
67
68# Quiet generation (unless V=1)
69QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
70QUIET_SUBDIR1 =
71
72ifneq ($(findstring $(MAKEFLAGS),w),w)
73PRINT_DIR = --no-print-directory
74else # "make -w"
75NO_SUBDIR = :
76endif
77
78ifneq ($(findstring $(MAKEFLAGS),s),s)
79ifndef V
80 QUIET = @
81 QUIET_GEN = $(QUIET)echo ' ' GEN $@;
82 QUIET_SUBDIR0 = +@subdir=
83 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
84 $(MAKE) $(PRINT_DIR) -C $$subdir
85 export V
86 export QUIET
87 export QUIET_GEN
88 export QUIET_SUBDIR0
89 export QUIET_SUBDIR1
90endif
91endif
92
9a86dd57 93all:: gitweb.cgi static/gitweb.js
62331ef1 94
152d9434
JN
95GITWEB_PROGRAMS = gitweb.cgi
96
62331ef1 97ifdef JSMIN
18d05328
PKS
98GITWEB_FILES += static/gitweb.min.js
99GITWEB_JS = static/gitweb.min.js
100all:: static/gitweb.min.js
101static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
8de096b6 102 $(QUIET_GEN)$(JSMIN) <$< >$@
152d9434 103else
18d05328 104GITWEB_FILES += static/gitweb.js
0e6ce213 105endif
8de096b6 106
0e6ce213 107ifdef CSSMIN
18d05328
PKS
108GITWEB_FILES += static/gitweb.min.css
109GITWEB_CSS = static/gitweb.min.css
110all:: static/gitweb.min.css
111static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
70649945 112 $(QUIET_GEN)$(CSSMIN) <$< >$@
152d9434 113else
18d05328 114GITWEB_FILES += static/gitweb.css
0e6ce213 115endif
62331ef1 116
18d05328 117GITWEB_FILES += static/git-logo.png static/git-favicon.png
152d9434 118
9a86dd57
JN
119# JavaScript files that are composed (concatenated) to form gitweb.js
120#
121# js/lib/common-lib.js should be always first, then js/lib/*.js,
122# then the rest of files; js/gitweb.js should be last (if it exists)
123GITWEB_JSLIB_FILES += static/js/lib/common-lib.js
54b1479a 124GITWEB_JSLIB_FILES += static/js/lib/datetime.js
fcce886b 125GITWEB_JSLIB_FILES += static/js/lib/cookies.js
9a86dd57 126GITWEB_JSLIB_FILES += static/js/javascript-detection.js
291e52bd 127GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
9a86dd57
JN
128GITWEB_JSLIB_FILES += static/js/blame_incremental.js
129
130
8de096b6
JH
131GITWEB_REPLACE = \
132 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
133 -e 's|++GIT_BINDIR++|$(bindir)|g' \
134 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
135 -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
131d6afc 136 -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
8de096b6
JH
137 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
138 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
139 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
140 -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
141 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
142 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
143 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
144 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
145 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
146 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
147 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
148 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
149 -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
c1355b7f 150 -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
8de096b6 151 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
7ce896b3
CW
152 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
153 -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
8de096b6
JH
154
155GITWEB-BUILD-OPTIONS: FORCE
156 @rm -f $@+
157 @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
158 @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
159
160gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
62331ef1
JWH
161 $(QUIET_GEN)$(RM) $@ $@+ && \
162 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
8de096b6 163 $(GITWEB_REPLACE) $< >$@+ && \
62331ef1
JWH
164 chmod +x $@+ && \
165 mv $@+ $@
166
9a86dd57
JN
167static/gitweb.js: $(GITWEB_JSLIB_FILES)
168 $(QUIET_GEN)$(RM) $@ $@+ && \
169 cat $^ >$@+ && \
170 mv $@+ $@
171
958a8467
JN
172### Testing rules
173
174test:
175 $(MAKE) -C ../t gitweb-test
176
177test-installed:
178 GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \
179 $(MAKE) -C ../t gitweb-test
180
152d9434
JN
181### Installation rules
182
183install: all
184 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
185 $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
18d05328
PKS
186 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
187 $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
152d9434
JN
188
189### Cleaning rules
190
62331ef1 191clean:
a80b263e
RJ
192 $(RM) gitweb.cgi static/gitweb.js \
193 static/gitweb.min.js static/gitweb.min.css \
194 GITWEB-BUILD-OPTIONS
8de096b6 195
958a8467 196.PHONY: all clean install test test-installed .FORCE-GIT-VERSION-FILE FORCE
62331ef1 197