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
7# a filter to have gitweb.js minified.
8#
9# Define CSSMIN to point to a CSS minifier in order to generate a minified
10# version of gitweb.css
11#
12
13prefix ?= $(HOME)
14bindir ?= $(prefix)/bin
15RM ?= rm -f
16
17# default configuration for gitweb
18GITWEB_CONFIG = gitweb_config.perl
19GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
20GITWEB_HOME_LINK_STR = projects
21GITWEB_SITENAME =
22GITWEB_PROJECTROOT = /pub/git
23GITWEB_PROJECT_MAXDEPTH = 2007
24GITWEB_EXPORT_OK =
25GITWEB_STRICT_EXPORT =
26GITWEB_BASE_URL =
27GITWEB_LIST =
28GITWEB_HOMETEXT = indextext.html
29GITWEB_CSS = gitweb.css
30GITWEB_LOGO = git-logo.png
31GITWEB_FAVICON = git-favicon.png
32GITWEB_JS = gitweb.js
33GITWEB_SITE_HEADER =
34GITWEB_SITE_FOOTER =
35
36# include user config
37-include ../config.mak.autogen
38-include ../config.mak
39
40# determine version
41../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
42 $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
43
44-include ../GIT-VERSION-FILE
45
46### Build rules
47
48SHELL_PATH ?= $(SHELL)
49PERL_PATH ?= /usr/bin/perl
50
51# Shell quote;
52bindir_SQ = $(subst ','\'',$(bindir)) #'
53SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) #'
54PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) #'
55
56# Quiet generation (unless V=1)
57QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
58QUIET_SUBDIR1 =
59
60ifneq ($(findstring $(MAKEFLAGS),w),w)
61PRINT_DIR = --no-print-directory
62else # "make -w"
63NO_SUBDIR = :
64endif
65
66ifneq ($(findstring $(MAKEFLAGS),s),s)
67ifndef V
68 QUIET = @
69 QUIET_GEN = $(QUIET)echo ' ' GEN $@;
70 QUIET_SUBDIR0 = +@subdir=
71 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
72 $(MAKE) $(PRINT_DIR) -C $$subdir
73 export V
74 export QUIET
75 export QUIET_GEN
76 export QUIET_SUBDIR0
77 export QUIET_SUBDIR1
78endif
79endif
80
81all:: gitweb.cgi
82
83FILES = gitweb.cgi
84ifdef JSMIN
85FILES += gitweb.min.js
86GITWEB_JS = gitweb.min.js
87endif
88ifdef CSSMIN
89FILES += gitweb.min.css
90GITWEB_CSS = gitweb.min.css
91endif
92gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS)
93
94gitweb.cgi:
95 $(QUIET_GEN)$(RM) $@ $@+ && \
96 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
97 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
98 -e 's|++GIT_BINDIR++|$(bindir)|g' \
99 -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
100 -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
101 -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
102 -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
103 -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
104 -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
105 -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
106 -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
107 -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
108 -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
109 -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
110 -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
111 -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
112 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
113 -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
114 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
115 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
116 $< >$@+ && \
117 chmod +x $@+ && \
118 mv $@+ $@
119
120ifdef JSMIN
121gitweb.min.js: gitweb.js
122 $(QUIET_GEN)$(JSMIN) <$< >$@
123endif # JSMIN
124
125ifdef CSSMIN
126gitweb.min.css: gitweb.css
127 $(QUIET_GEN)$(CSSMIN) <$ >$@
128endif
129
130clean:
131 $(RM) $(FILES)
132
133.PHONY: all clean .FORCE-GIT-VERSION-FILE