Skip to content

Commit b82d66e

Browse files
avargitster
authored andcommitted
gitweb/Makefile: prepare to merge into top-level Makefile
Since the "gitweb/Makefile" was split out from the top-level Makefile in 62331ef (gitweb: Makefile improvements, 2010-01-30) we've kept the inter-dependencies between the two, and worse have dealt with a lot of duplication as a result. In preparation for merging the two again add a MAK_DIR_GITWEB variable to various rules in it. This will allow us to set this variable to "gitweb/" as we include it in the top-level Makefile, which will minimize the size of the subsequent diff. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 564ebde commit b82d66e

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

gitweb/Makefile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
all::
33
.PHONY: all
44

5+
MAK_DIR_GITWEB =
6+
57
# Define V=1 to have a more verbose compile.
68
#
79
# Define JSMIN to point to JavaScript minifier that functions as
@@ -106,17 +108,19 @@ GITWEB_PROGRAMS = gitweb.cgi
106108
GITWEB_JS_MIN = static/gitweb.min.js
107109
ifdef JSMIN
108110
GITWEB_JS = $(GITWEB_JS_MIN)
109-
all:: $(GITWEB_JS_MIN)
110-
$(GITWEB_JS_MIN): $(GITWEB_JS_IN) GITWEB-BUILD-OPTIONS
111+
all:: $(MAK_DIR_GITWEB)$(GITWEB_JS_MIN)
112+
$(MAK_DIR_GITWEB)$(GITWEB_JS_MIN): $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
113+
$(MAK_DIR_GITWEB)$(GITWEB_JS_MIN): $(MAK_DIR_GITWEB)$(GITWEB_JS_IN)
111114
$(QUIET_GEN)$(JSMIN) <$< >$@
112115
endif
113116
GITWEB_FILES += $(GITWEB_JS)
114117

115118
GITWEB_CSS_MIN = static/gitweb.min.css
116119
ifdef CSSMIN
117120
GITWEB_CSS = $(GITWEB_CSS_MIN)
118-
all:: $(GITWEB_CSS_MIN)
119-
$(GITWEB_CSS_MIN): $(GITWEB_CSS_IN) GITWEB-BUILD-OPTIONS
121+
all:: $(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN)
122+
$(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN): $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
123+
$(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN): $(MAK_DIR_GITWEB)$(GITWEB_CSS_IN)
120124
$(QUIET_GEN)$(CSSMIN) <$< >$@
121125
endif
122126
GITWEB_FILES += $(GITWEB_CSS)
@@ -161,19 +165,20 @@ GITWEB_REPLACE = \
161165
-e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
162166

163167
.PHONY: FORCE
164-
GITWEB-BUILD-OPTIONS: FORCE
168+
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
165169
@rm -f $@+
166170
@echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
167171
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
168172

169-
gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
173+
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
174+
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
170175
$(QUIET_GEN)$(RM) $@ $@+ && \
171176
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
172177
$(GITWEB_REPLACE) $< >$@+ && \
173178
chmod +x $@+ && \
174179
mv $@+ $@
175180

176-
static/gitweb.js: $(GITWEB_JSLIB_FILES)
181+
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
177182
$(QUIET_GEN)$(RM) $@ $@+ && \
178183
cat $^ >$@+ && \
179184
mv $@+ $@
@@ -194,14 +199,16 @@ test-installed:
194199
.PHONY: install
195200
install: all
196201
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
197-
$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
202+
$(INSTALL) -m 755 $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_PROGRAMS)) \
203+
'$(DESTDIR_SQ)$(gitwebdir_SQ)'
198204
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
199-
$(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
205+
$(INSTALL) -m 644 $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_FILES)) \
206+
'$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
200207

201208
### Cleaning rules
202209

203210
.PHONY: clean
204211
clean:
205-
$(RM) gitweb.cgi $(GITWEB_JS_IN) \
212+
$(RM) $(addprefix $(MAK_DIR_GITWEB),gitweb.cgi $(GITWEB_JS_IN) \
206213
$(GITWEB_JS_MIN) $(GITWEB_CSS_MIN) \
207-
GITWEB-BUILD-OPTIONS
214+
GITWEB-BUILD-OPTIONS)

0 commit comments

Comments
 (0)