From: Junio C Hamano <gitster@pobox.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jakub Narebski <jnareb@gmail.com>,
Charles Bailey <charles@hashpling.org>,
Mark Rada <marada@uwaterloo.ca>,
git@vger.kernel.org
Subject: Re: [PATCHv5 2/6] Gitweb: add support for minifying gitweb.css
Date: Wed, 14 Apr 2010 18:42:56 -0700 [thread overview]
Message-ID: <7v1vehmqxr.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7veiihmtjw.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Wed\, 14 Apr 2010 17\:46\:27 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Unless you are including gitweb.cgi (iow, the contents of the generated
> file depends on the _contents_ of gitweb.min.js (or gitweb.js), gitweb.cgi
> does _not_ depend on these files. Of course if you generate gitweb.cgi
> out of gitweb.perl with one setting of GITWEB_JS and then change your
> mind, then you need to regenerate it, but that is not something you can do
> by comparing file timestamp of gitweb.cgi and the file timestamp of
> $(GITWEB_JS) anyway. You would need to imitate something like how
> GIT-BUILD-OPTIONS is used by the primary Makefile.
Here is a minimally tested patch.
In addition to the points raised by the proposed log message for the
previous one, this tries to make sure that the scripts are regenerated
whenever the replacement variables are modified. For a good measure, if
you used different JSMIN/CSSMIN since the last time you produced minified
version of these files, they are regenerated.
If this seems to work Ok, please send it back to me with a proper commit
log message (concat of the above and the previous) with Tested-by: or
Acked-by: as appropriate, so that we can fix it at the tip of 'master'
before we tag 1.7.1-rc2.
Thanks.
gitweb/Makefile | 75 ++++++++++++++++++++++++++++---------------------------
1 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/gitweb/Makefile b/gitweb/Makefile
index ffee4bd..f2e1d92 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -80,54 +80,55 @@ endif
all:: gitweb.cgi
-FILES = gitweb.cgi
ifdef JSMIN
-FILES += gitweb.min.js
GITWEB_JS = gitweb.min.js
+all:: gitweb.min.js
+gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS
+ $(QUIET_GEN)$(JSMIN) <$< >$@
endif
+
ifdef CSSMIN
-FILES += gitweb.min.css
GITWEB_CSS = gitweb.min.css
+all:: gitweb.min.css
+gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS
+ $(QUIET_GEN)$(CSSMIN) <$ >$@
endif
-gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS)
-gitweb.cgi:
+GITWEB_REPLACE = \
+ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
+ -e 's|++GIT_BINDIR++|$(bindir)|g' \
+ -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
+ -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
+ -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
+ -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
+ -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
+ -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
+ -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
+ -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
+ -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
+ -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
+ -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
+ -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
+ -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
+ -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
+ -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
+ -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g'
+
+GITWEB-BUILD-OPTIONS: FORCE
+ @rm -f $@+
+ @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+
+gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
$(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- $< >$@+ && \
+ $(GITWEB_REPLACE) $< >$@+ && \
chmod +x $@+ && \
mv $@+ $@
-ifdef JSMIN
-gitweb.min.js: gitweb.js
- $(QUIET_GEN)$(JSMIN) <$< >$@
-endif # JSMIN
-
-ifdef CSSMIN
-gitweb.min.css: gitweb.css
- $(QUIET_GEN)$(CSSMIN) <$ >$@
-endif
-
clean:
- $(RM) $(FILES)
+ $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS
+
+.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE
-.PHONY: all clean .FORCE-GIT-VERSION-FILE
prev parent reply other threads:[~2010-04-15 1:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 5:36 [PATCHv5 2/6] Gitweb: add support for minifying gitweb.css Mark Rada
2010-04-01 8:51 ` Jakub Narebski
2010-04-13 20:28 ` Charles Bailey
2010-04-13 22:30 ` Jakub Narebski
2010-04-14 5:40 ` Mark Rada
2010-04-14 17:22 ` Jakub Narebski
2010-04-14 19:17 ` Mark Rada
2010-04-14 20:04 ` Jakub Narebski
2010-04-14 23:58 ` Junio C Hamano
2010-04-15 0:18 ` Charles Bailey
2010-04-15 0:25 ` Jakub Narebski
2010-04-15 0:46 ` Junio C Hamano
2010-04-15 1:02 ` Jakub Narebski
2010-04-15 1:21 ` Mark Rada
2010-04-15 1:42 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v1vehmqxr.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=charles@hashpling.org \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=marada@uwaterloo.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).