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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Jun 28, 2022 at 12:15 UTC
564ebde3d323fc3b22534dcbb32723807771b955
1 file changed
+18
-17
gitweb/Makefile
+18
-17
@@ -31,10 +31,12 @@ GITWEB_STRICT_EXPORT =
31
GITWEB_BASE_URL =
32
GITWEB_LIST =
33
GITWEB_HOMETEXT = indextext.html
34
-GITWEB_CSS = static/gitweb.css
34
+GITWEB_CSS_IN = static/gitweb.css
35
+GITWEB_CSS = $(GITWEB_CSS_IN)
36
GITWEB_LOGO = static/git-logo.png
37
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)
40
GITWEB_SITE_HTML_HEAD_STRING =
41
GITWEB_SITE_HEADER =
42
GITWEB_SITE_FOOTER =
@@ -57,7 +59,7 @@ endif
59
# What targets we'll add to 'all' for "make gitweb"
60
GITWEB_ALL =
61
GITWEB_ALL += gitweb.cgi
60
-GITWEB_ALL += static/gitweb.js
62
+GITWEB_ALL += $(GITWEB_JS)
63
64
### Build rules
65
@@ -101,25 +103,23 @@ all:: $(GITWEB_ALL)
103
104
GITWEB_PROGRAMS = gitweb.cgi
105
106
+GITWEB_JS_MIN = static/gitweb.min.js
107
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
111
$(QUIET_GEN)$(JSMIN) <$< >$@
110
-else
111
-GITWEB_FILES += static/gitweb.js
112
endif
113
+GITWEB_FILES += $(GITWEB_JS)
114
115
+GITWEB_CSS_MIN = static/gitweb.min.css
116
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
120
$(QUIET_GEN)$(CSSMIN) <$< >$@
120
-else
121
-GITWEB_FILES += static/gitweb.css
121
endif
122
+GITWEB_FILES += $(GITWEB_CSS)
123
124
GITWEB_FILES += static/git-logo.png static/git-favicon.png
125
@@ -127,6 +127,7 @@ GITWEB_FILES += static/git-logo.png static/git-favicon.png
127
#
128
# js/lib/common-lib.js should be always first, then js/lib/*.js,
129
# then the rest of files; js/gitweb.js should be last (if it exists)
130
+GITWEB_JSLIB_FILES =
131
GITWEB_JSLIB_FILES += static/js/lib/common-lib.js
132
GITWEB_JSLIB_FILES += static/js/lib/datetime.js
133
GITWEB_JSLIB_FILES += static/js/lib/cookies.js
@@ -201,6 +202,6 @@ install: all
202
203
.PHONY: clean
204
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) \
207
GITWEB-BUILD-OPTIONS