Skip to content

Commit 564ebde

Browse files
avargitster
authored andcommitted
gitweb/Makefile: clear up and de-duplicate the gitweb.{css,js} vars
Change the variable definitions for the $(GITWEB_CSS) and $(GITWEB_JS) so that we have a clear separation between what we use as "in" files, v.s. our "min" files. We can now make the appending to $(GITWEB_FILES) unconditional, since $(GITWEB_{JS,CSS}) is either the "min" or non-"min" version. This reduces the duplication within the file. While we're at it let's initialize "GITWEB_JSLIB_FILES" as we normally do with such variables. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1e08fa5 commit 564ebde

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

gitweb/Makefile

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ GITWEB_STRICT_EXPORT =
3131
GITWEB_BASE_URL =
3232
GITWEB_LIST =
3333
GITWEB_HOMETEXT = indextext.html
34-
GITWEB_CSS = static/gitweb.css
34+
GITWEB_CSS_IN = static/gitweb.css
35+
GITWEB_CSS = $(GITWEB_CSS_IN)
3536
GITWEB_LOGO = static/git-logo.png
3637
GITWEB_FAVICON = static/git-favicon.png
37-
GITWEB_JS = static/gitweb.js
38+
GITWEB_JS_IN = static/gitweb.js
39+
GITWEB_JS = $(GITWEB_JS_IN)
3840
GITWEB_SITE_HTML_HEAD_STRING =
3941
GITWEB_SITE_HEADER =
4042
GITWEB_SITE_FOOTER =
@@ -57,7 +59,7 @@ endif
5759
# What targets we'll add to 'all' for "make gitweb"
5860
GITWEB_ALL =
5961
GITWEB_ALL += gitweb.cgi
60-
GITWEB_ALL += static/gitweb.js
62+
GITWEB_ALL += $(GITWEB_JS)
6163

6264
### Build rules
6365

@@ -101,32 +103,31 @@ all:: $(GITWEB_ALL)
101103

102104
GITWEB_PROGRAMS = gitweb.cgi
103105

106+
GITWEB_JS_MIN = static/gitweb.min.js
104107
ifdef JSMIN
105-
GITWEB_FILES += static/gitweb.min.js
106-
GITWEB_JS = static/gitweb.min.js
107-
all:: static/gitweb.min.js
108-
static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
108+
GITWEB_JS = $(GITWEB_JS_MIN)
109+
all:: $(GITWEB_JS_MIN)
110+
$(GITWEB_JS_MIN): $(GITWEB_JS_IN) GITWEB-BUILD-OPTIONS
109111
$(QUIET_GEN)$(JSMIN) <$< >$@
110-
else
111-
GITWEB_FILES += static/gitweb.js
112112
endif
113+
GITWEB_FILES += $(GITWEB_JS)
113114

115+
GITWEB_CSS_MIN = static/gitweb.min.css
114116
ifdef CSSMIN
115-
GITWEB_FILES += static/gitweb.min.css
116-
GITWEB_CSS = static/gitweb.min.css
117-
all:: static/gitweb.min.css
118-
static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
117+
GITWEB_CSS = $(GITWEB_CSS_MIN)
118+
all:: $(GITWEB_CSS_MIN)
119+
$(GITWEB_CSS_MIN): $(GITWEB_CSS_IN) GITWEB-BUILD-OPTIONS
119120
$(QUIET_GEN)$(CSSMIN) <$< >$@
120-
else
121-
GITWEB_FILES += static/gitweb.css
122121
endif
122+
GITWEB_FILES += $(GITWEB_CSS)
123123

124124
GITWEB_FILES += static/git-logo.png static/git-favicon.png
125125

126126
# JavaScript files that are composed (concatenated) to form gitweb.js
127127
#
128128
# js/lib/common-lib.js should be always first, then js/lib/*.js,
129129
# then the rest of files; js/gitweb.js should be last (if it exists)
130+
GITWEB_JSLIB_FILES =
130131
GITWEB_JSLIB_FILES += static/js/lib/common-lib.js
131132
GITWEB_JSLIB_FILES += static/js/lib/datetime.js
132133
GITWEB_JSLIB_FILES += static/js/lib/cookies.js
@@ -201,6 +202,6 @@ install: all
201202

202203
.PHONY: clean
203204
clean:
204-
$(RM) gitweb.cgi static/gitweb.js \
205-
static/gitweb.min.js static/gitweb.min.css \
205+
$(RM) gitweb.cgi $(GITWEB_JS_IN) \
206+
$(GITWEB_JS_MIN) $(GITWEB_CSS_MIN) \
206207
GITWEB-BUILD-OPTIONS

0 commit comments

Comments
 (0)