Skip to content

Commit affc3b7

Browse files
avargitster
authored andcommitted
gitweb/Makefile: include in top-level Makefile
Include the gitweb/Makefile in the top-level Makefile rather than calling it as a sub-Makefile. As noted in the thread starting at at [1] (in particular [2]) we'll pay a high cost on NOOP runs of "make" just to figure out that we have nothing to do for "make gitweb". The "gitweb" script also isn't maintained out-of-tree, unlike "gitk-git" or "git-gui", which both have their own "Makefile". Other parts of it are already integrated into our main Makefiles, e.g. the documentation is built by Documentation/Makefile since 07ea4df (gitweb: Add gitweb(1) manpage for gitweb itself, 2011-10-16). 1. https://lore.kernel.org/git/[email protected]/ 2. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27438ef commit affc3b7

File tree

2 files changed

+29
-85
lines changed

2 files changed

+29
-85
lines changed

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ gitexecdir = libexec/git-core
538538
mergetoolsdir = $(gitexecdir)/mergetools
539539
sharedir = $(prefix)/share
540540
gitwebdir = $(sharedir)/gitweb
541+
gitwebstaticdir = $(gitwebdir)/static
541542
perllibdir = $(sharedir)/perl5
542543
localedir = $(sharedir)/locale
543544
template_dir = share/git-core/templates
@@ -556,7 +557,7 @@ localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
556557
htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
557558
perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))
558559

559-
export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
560+
export prefix bindir sharedir sysconfdir perllibdir localedir
560561

561562
# Set our default programs
562563
CC = cc
@@ -2071,6 +2072,7 @@ htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
20712072
prefix_SQ = $(subst ','\'',$(prefix))
20722073
perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
20732074
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
2075+
gitwebstaticdir_SQ = $(subst ','\'',$(gitwebstaticdir))
20742076

20752077
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
20762078
TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
@@ -2399,10 +2401,6 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
23992401
perllibdir:
24002402
@echo '$(perllibdir_SQ)'
24012403

2402-
.PHONY: gitweb
2403-
gitweb:
2404-
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
2405-
24062404
git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
24072405
$(QUIET_GEN)$(cmd_munge_script) && \
24082406
chmod +x $@+ && \
@@ -3036,6 +3034,15 @@ coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.c
30363034

30373035
.PHONY: coccicheck coccicheck-pending
30383036

3037+
# "Sub"-Makefiles, not really because they can't be run stand-alone,
3038+
# only there to contain directory-specific rules and variables
3039+
## gitweb/Makefile inclusion:
3040+
MAK_DIR_GITWEB = gitweb/
3041+
include gitweb/Makefile
3042+
3043+
.PHONY: gitweb
3044+
gitweb: $(MAK_DIR_GITWEB_ALL)
3045+
30393046
### Installation rules
30403047

30413048
ifneq ($(filter /%,$(firstword $(template_dir))),)
@@ -3108,7 +3115,6 @@ ifndef NO_PERL
31083115
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
31093116
(cd perl/build/lib && $(TAR) cf - .) | \
31103117
(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
3111-
$(MAKE) -C gitweb install
31123118
endif
31133119
ifndef NO_TCLTK
31143120
$(MAKE) -C gitk-git install
@@ -3163,10 +3169,8 @@ endif
31633169
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
31643170
done
31653171

3166-
.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
3172+
.PHONY: install-doc install-man install-man-perl install-html install-info install-pdf
31673173
.PHONY: quick-install-doc quick-install-man quick-install-html
3168-
install-gitweb:
3169-
$(MAKE) -C gitweb install
31703174

31713175
install-doc: install-man-perl
31723176
$(MAKE) -C Documentation install
@@ -3310,7 +3314,6 @@ clean: profile-clean coverage-clean cocciclean
33103314
$(MAKE) -C Documentation/ clean
33113315
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS
33123316
ifndef NO_PERL
3313-
$(MAKE) -C gitweb clean
33143317
$(RM) -r perl/build/
33153318
endif
33163319
$(MAKE) -C templates/ clean

gitweb/Makefile

Lines changed: 16 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
1-
# The default target of this Makefile is...
2-
all::
3-
.PHONY: all
4-
5-
MAK_DIR_GITWEB =
1+
ifndef MAK_DIR_GITWEB
2+
$(error do not run gitweb/Makefile stand-alone anymore. The "gitweb" and \
3+
"install-gitweb" targets now live in the top-level Makefile)
4+
endif
65

7-
# Define V=1 to have a more verbose compile.
8-
#
96
# Define JSMIN to point to JavaScript minifier that functions as
107
# a filter to have static/gitweb.js minified.
118
#
129
# Define CSSMIN to point to a CSS minifier in order to generate a minified
1310
# version of static/gitweb.css
1411
#
1512

16-
prefix ?= $(HOME)
17-
bindir ?= $(prefix)/bin
18-
gitwebdir ?= /var/www/cgi-bin
19-
20-
RM ?= rm -f
21-
INSTALL ?= install
22-
2313
# default configuration for gitweb
2414
GITWEB_CONFIG = gitweb_config.perl
2515
GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
@@ -44,71 +34,19 @@ GITWEB_SITE_HEADER =
4434
GITWEB_SITE_FOOTER =
4535
HIGHLIGHT_BIN = highlight
4636

47-
# include user config
48-
-include ../config.mak.autogen
49-
-include ../config.mak
50-
-include config.mak
51-
52-
# determine version
53-
.PHONY: .FORCE-GIT-VERSION-FILE
54-
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
55-
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
56-
57-
ifneq ($(MAKECMDGOALS),clean)
58-
-include ../GIT-VERSION-FILE
59-
endif
60-
6137
# What targets we'll add to 'all' for "make gitweb"
6238
GITWEB_ALL =
6339
GITWEB_ALL += gitweb.cgi
6440
GITWEB_ALL += $(GITWEB_JS)
6541

66-
### Build rules
67-
68-
SHELL_PATH ?= $(SHELL)
69-
PERL_PATH ?= /usr/bin/perl
70-
71-
# Shell quote;
72-
bindir_SQ = $(subst ','\'',$(bindir))#'
73-
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
74-
gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
75-
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
76-
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
77-
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
78-
79-
# Quiet generation (unless V=1)
80-
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
81-
QUIET_SUBDIR1 =
82-
83-
ifneq ($(findstring $(MAKEFLAGS),w),w)
84-
PRINT_DIR = --no-print-directory
85-
else # "make -w"
86-
NO_SUBDIR = :
87-
endif
88-
89-
ifneq ($(findstring $(MAKEFLAGS),s),s)
90-
ifndef V
91-
QUIET = @
92-
QUIET_GEN = $(QUIET)echo ' ' GEN $@;
93-
QUIET_SUBDIR0 = +@subdir=
94-
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
95-
$(MAKE) $(PRINT_DIR) -C $$subdir
96-
export V
97-
export QUIET
98-
export QUIET_GEN
99-
export QUIET_SUBDIR0
100-
export QUIET_SUBDIR1
101-
endif
102-
endif
103-
104-
all:: $(GITWEB_ALL)
42+
MAK_DIR_GITWEB_ALL = $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_ALL))
10543

10644
GITWEB_PROGRAMS = gitweb.cgi
10745

10846
GITWEB_JS_MIN = static/gitweb.min.js
10947
ifdef JSMIN
11048
GITWEB_JS = $(GITWEB_JS_MIN)
111-
all:: $(MAK_DIR_GITWEB)$(GITWEB_JS_MIN)
49+
GITWEB_ALL += $(MAK_DIR_GITWEB)$(GITWEB_JS_MIN)
11250
$(MAK_DIR_GITWEB)$(GITWEB_JS_MIN): $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
11351
$(MAK_DIR_GITWEB)$(GITWEB_JS_MIN): $(MAK_DIR_GITWEB)$(GITWEB_JS_IN)
11452
$(QUIET_GEN)$(JSMIN) <$< >$@
@@ -118,7 +56,7 @@ GITWEB_FILES += $(GITWEB_JS)
11856
GITWEB_CSS_MIN = static/gitweb.min.css
11957
ifdef CSSMIN
12058
GITWEB_CSS = $(GITWEB_CSS_MIN)
121-
all:: $(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN)
59+
GITWEB_ALL += $(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN)
12260
$(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN): $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
12361
$(MAK_DIR_GITWEB)$(GITWEB_CSS_MIN): $(MAK_DIR_GITWEB)$(GITWEB_CSS_IN)
12462
$(QUIET_GEN)$(CSSMIN) <$< >$@
@@ -185,19 +123,22 @@ $(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_
185123

186124
### Installation rules
187125

188-
.PHONY: install
189-
install: all
126+
.PHONY: install-gitweb
127+
install-gitweb: $(MAK_DIR_GITWEB_ALL)
190128
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
191-
$(INSTALL) -m 755 $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_PROGRAMS)) \
192-
'$(DESTDIR_SQ)$(gitwebdir_SQ)'
129+
$(INSTALL) -m 755 $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_PROGRAMS)) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
193130
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
194131
$(INSTALL) -m 644 $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_FILES)) \
195132
'$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
133+
ifndef NO_PERL
134+
install: install-gitweb
135+
endif
196136

197137
### Cleaning rules
198138

199-
.PHONY: clean
200-
clean:
139+
.PHONY: gitweb-clean
140+
gitweb-clean:
201141
$(RM) $(addprefix $(MAK_DIR_GITWEB),gitweb.cgi $(GITWEB_JS_IN) \
202142
$(GITWEB_JS_MIN) $(GITWEB_CSS_MIN) \
203143
GITWEB-BUILD-OPTIONS)
144+
clean: gitweb-clean

0 commit comments

Comments
 (0)