]> git.ipfire.org Git - thirdparty/git.git/blame - gitweb/Makefile
Merge branch 'mz/maint-rebase-stat-config' into maint
[thirdparty/git.git] / gitweb / Makefile
CommitLineData
62331ef1
JWH
1# The default target of this Makefile is...
2all::
3
4# Define V=1 to have a more verbose compile.
5#
6# Define JSMIN to point to JavaScript minifier that functions as
18d05328 7# a filter to have static/gitweb.js minified.
62331ef1 8#
0e6ce213 9# Define CSSMIN to point to a CSS minifier in order to generate a minified
18d05328 10# version of static/gitweb.css
0e6ce213 11#
62331ef1
JWH
12
13prefix ?= $(HOME)
14bindir ?= $(prefix)/bin
152d9434
JN
15gitwebdir ?= /var/www/cgi-bin
16
62331ef1 17RM ?= rm -f
152d9434 18INSTALL ?= install
62331ef1 19
62331ef1
JWH
20# default configuration for gitweb
21GITWEB_CONFIG = gitweb_config.perl
22GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
23GITWEB_HOME_LINK_STR = projects
24GITWEB_SITENAME =
25GITWEB_PROJECTROOT = /pub/git
26GITWEB_PROJECT_MAXDEPTH = 2007
27GITWEB_EXPORT_OK =
28GITWEB_STRICT_EXPORT =
29GITWEB_BASE_URL =
30GITWEB_LIST =
31GITWEB_HOMETEXT = indextext.html
18d05328
PKS
32GITWEB_CSS = static/gitweb.css
33GITWEB_LOGO = static/git-logo.png
34GITWEB_FAVICON = static/git-favicon.png
35GITWEB_JS = static/gitweb.js
62331ef1
JWH
36GITWEB_SITE_HEADER =
37GITWEB_SITE_FOOTER =
38
39# include user config
40-include ../config.mak.autogen
41-include ../config.mak
42
43# determine version
44../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
45 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
46
47-include ../GIT-VERSION-FILE
48
49### Build rules
50
51SHELL_PATH ?= $(SHELL)
52PERL_PATH ?= /usr/bin/perl
53
54# Shell quote;
152d9434
JN
55bindir_SQ = $(subst ','\'',$(bindir))#'
56gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
18d05328 57gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
152d9434
JN
58SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
59PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
60DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
62331ef1
JWH
61
62# Quiet generation (unless V=1)
63QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
64QUIET_SUBDIR1 =
65
66ifneq ($(findstring $(MAKEFLAGS),w),w)
67PRINT_DIR = --no-print-directory
68else # "make -w"
69NO_SUBDIR = :
70endif
71
72ifneq ($(findstring $(MAKEFLAGS),s),s)
73ifndef V
74 QUIET = @
75 QUIET_GEN = $(QUIET)echo ' ' GEN $@;
76 QUIET_SUBDIR0 = +@subdir=
77 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
78 $(MAKE) $(PRINT_DIR) -C $$subdir
79 export V
80 export QUIET
81 export QUIET_GEN
82 export QUIET_SUBDIR0
83 export QUIET_SUBDIR1
84endif
85endif
86
87all:: gitweb.cgi
88
152d9434
JN
89GITWEB_PROGRAMS = gitweb.cgi
90
62331ef1 91ifdef JSMIN
18d05328
PKS
92GITWEB_FILES += static/gitweb.min.js
93GITWEB_JS = static/gitweb.min.js
94all:: static/gitweb.min.js
95static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
8de096b6 96 $(QUIET_GEN)$(JSMIN) <$< >$@
152d9434 97else
18d05328 98GITWEB_FILES += static/gitweb.js
0e6ce213 99endif
8de096b6 100
0e6ce213 101ifdef CSSMIN
18d05328
PKS
102GITWEB_FILES += static/gitweb.min.css
103GITWEB_CSS = static/gitweb.min.css
104all:: static/gitweb.min.css
105static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
70649945 106 $(QUIET_GEN)$(CSSMIN) <$< >$@
152d9434 107else
18d05328 108GITWEB_FILES += static/gitweb.css
0e6ce213 109endif
62331ef1 110
18d05328 111GITWEB_FILES += static/git-logo.png static/git-favicon.png
152d9434 112
8de096b6
JH
113GITWEB_REPLACE = \
114 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
115 -e 's|++GIT_BINDIR++|$(bindir)|g' \
116 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
117 -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
118 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
119 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
120 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
121 -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
122 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
123 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
124 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
125 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
126 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
127 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
128 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
129 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
130 -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
131 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
132 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g'
133
134GITWEB-BUILD-OPTIONS: FORCE
135 @rm -f $@+
136 @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
137 @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
138
139gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
62331ef1
JWH
140 $(QUIET_GEN)$(RM) $@ $@+ && \
141 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
8de096b6 142 $(GITWEB_REPLACE) $< >$@+ && \
62331ef1
JWH
143 chmod +x $@+ && \
144 mv $@+ $@
145
152d9434
JN
146### Installation rules
147
148install: all
149 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
150 $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
18d05328
PKS
151 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
152 $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
152d9434
JN
153
154### Cleaning rules
155
62331ef1 156clean:
18d05328 157 $(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS
8de096b6 158
152d9434 159.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE
62331ef1 160