@matheusbsbs / matheus-bagliano / commits / 63267de2ac
Fork 0

gitweb: Minify gitweb.js if JSMIN is defined

It requires that $JSMIN command can function as a filter. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Sep 1, 2009 at 13:39 UTC 63267de2acc18027fc0208c0937fd62b91301fec
1 file changed +20
Makefile
+20
@@ -198,6 +198,9 @@ all::
198 # memory allocators with the nedmalloc allocator written by Niall Douglas.
199 #
200 # Define NO_REGEX if you have no or inferior regex support in your C library.
201 +#
202 +# Define JSMIN to point to JavaScript minifier that functions as
203 +# a filter to have gitweb.js minified.
204
205 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
206 @$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -250,6 +253,9 @@ lib = lib
253 # DESTDIR=
254 pathsep = :
255
256 +# JavaScript minifier invocation that can function as filter
257 +JSMIN =
258 +
259 # default configuration for gitweb
260 GITWEB_CONFIG = gitweb_config.perl
261 GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
@@ -265,7 +271,11 @@ GITWEB_HOMETEXT = indextext.html
271 GITWEB_CSS = gitweb.css
272 GITWEB_LOGO = git-logo.png
273 GITWEB_FAVICON = git-favicon.png
274 +ifdef JSMIN
275 +GITWEB_JS = gitweb.min.js
276 +else
277 GITWEB_JS = gitweb.js
278 +endif
279 GITWEB_SITE_HEADER =
280 GITWEB_SITE_FOOTER =
281
@@ -1388,8 +1398,13 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
1398 chmod +x $@+ && \
1399 mv $@+ $@
1400
1401 +ifdef JSMIN
1402 +OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb.min.js
1403 +gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
1404 +else
1405 OTHER_PROGRAMS += gitweb/gitweb.cgi
1406 gitweb/gitweb.cgi: gitweb/gitweb.perl
1407 +endif
1408 $(QUIET_GEN)$(RM) $@ $@+ && \
1409 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1410 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
@@ -1440,6 +1455,11 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
1455 mv $@+ $@
1456 endif # NO_PERL
1457
1458 +ifdef JSMIN
1459 +gitweb/gitweb.min.js: gitweb/gitweb.js
1460 + $(QUIET_GEN)$(JSMIN) <$< >$@
1461 +endif # JSMIN
1462 +
1463 configure: configure.ac
1464 $(QUIET_GEN)$(RM) $@ $<+ && \
1465 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \