]>
Commit | Line | Data |
---|---|---|
62331ef1 JWH |
1 | # The default target of this Makefile is... |
2 | all:: | |
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 | |
13 | prefix ?= $(HOME) | |
14 | bindir ?= $(prefix)/bin | |
152d9434 JN |
15 | gitwebdir ?= /var/www/cgi-bin |
16 | ||
62331ef1 | 17 | RM ?= rm -f |
152d9434 | 18 | INSTALL ?= install |
62331ef1 | 19 | |
62331ef1 JWH |
20 | # default configuration for gitweb |
21 | GITWEB_CONFIG = gitweb_config.perl | |
22 | GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf | |
23 | GITWEB_HOME_LINK_STR = projects | |
24 | GITWEB_SITENAME = | |
25 | GITWEB_PROJECTROOT = /pub/git | |
26 | GITWEB_PROJECT_MAXDEPTH = 2007 | |
27 | GITWEB_EXPORT_OK = | |
28 | GITWEB_STRICT_EXPORT = | |
29 | GITWEB_BASE_URL = | |
30 | GITWEB_LIST = | |
31 | GITWEB_HOMETEXT = indextext.html | |
18d05328 PKS |
32 | GITWEB_CSS = static/gitweb.css |
33 | GITWEB_LOGO = static/git-logo.png | |
34 | GITWEB_FAVICON = static/git-favicon.png | |
35 | GITWEB_JS = static/gitweb.js | |
62331ef1 JWH |
36 | GITWEB_SITE_HEADER = |
37 | GITWEB_SITE_FOOTER = | |
7ce896b3 | 38 | HIGHLIGHT_BIN = highlight |
62331ef1 JWH |
39 | |
40 | # include user config | |
41 | -include ../config.mak.autogen | |
42 | -include ../config.mak | |
9b93aeb2 | 43 | -include config.mak |
62331ef1 JWH |
44 | |
45 | # determine version | |
46 | ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE | |
47 | $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE | |
48 | ||
49 | -include ../GIT-VERSION-FILE | |
50 | ||
51 | ### Build rules | |
52 | ||
53 | SHELL_PATH ?= $(SHELL) | |
54 | PERL_PATH ?= /usr/bin/perl | |
55 | ||
56 | # Shell quote; | |
152d9434 JN |
57 | bindir_SQ = $(subst ','\'',$(bindir))#' |
58 | gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' | |
18d05328 | 59 | gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' |
152d9434 JN |
60 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' |
61 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' | |
62 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' | |
62331ef1 JWH |
63 | |
64 | # Quiet generation (unless V=1) | |
65 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir | |
66 | QUIET_SUBDIR1 = | |
67 | ||
68 | ifneq ($(findstring $(MAKEFLAGS),w),w) | |
69 | PRINT_DIR = --no-print-directory | |
70 | else # "make -w" | |
71 | NO_SUBDIR = : | |
72 | endif | |
73 | ||
74 | ifneq ($(findstring $(MAKEFLAGS),s),s) | |
75 | ifndef V | |
76 | QUIET = @ | |
77 | QUIET_GEN = $(QUIET)echo ' ' GEN $@; | |
78 | QUIET_SUBDIR0 = +@subdir= | |
79 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ | |
80 | $(MAKE) $(PRINT_DIR) -C $$subdir | |
81 | export V | |
82 | export QUIET | |
83 | export QUIET_GEN | |
84 | export QUIET_SUBDIR0 | |
85 | export QUIET_SUBDIR1 | |
86 | endif | |
87 | endif | |
88 | ||
9a86dd57 | 89 | all:: gitweb.cgi static/gitweb.js |
62331ef1 | 90 | |
152d9434 JN |
91 | GITWEB_PROGRAMS = gitweb.cgi |
92 | ||
62331ef1 | 93 | ifdef JSMIN |
18d05328 PKS |
94 | GITWEB_FILES += static/gitweb.min.js |
95 | GITWEB_JS = static/gitweb.min.js | |
96 | all:: static/gitweb.min.js | |
97 | static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS | |
8de096b6 | 98 | $(QUIET_GEN)$(JSMIN) <$< >$@ |
152d9434 | 99 | else |
18d05328 | 100 | GITWEB_FILES += static/gitweb.js |
0e6ce213 | 101 | endif |
8de096b6 | 102 | |
0e6ce213 | 103 | ifdef CSSMIN |
18d05328 PKS |
104 | GITWEB_FILES += static/gitweb.min.css |
105 | GITWEB_CSS = static/gitweb.min.css | |
106 | all:: static/gitweb.min.css | |
107 | static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS | |
70649945 | 108 | $(QUIET_GEN)$(CSSMIN) <$< >$@ |
152d9434 | 109 | else |
18d05328 | 110 | GITWEB_FILES += static/gitweb.css |
0e6ce213 | 111 | endif |
62331ef1 | 112 | |
18d05328 | 113 | GITWEB_FILES += static/git-logo.png static/git-favicon.png |
152d9434 | 114 | |
9a86dd57 JN |
115 | # JavaScript files that are composed (concatenated) to form gitweb.js |
116 | # | |
117 | # js/lib/common-lib.js should be always first, then js/lib/*.js, | |
118 | # then the rest of files; js/gitweb.js should be last (if it exists) | |
119 | GITWEB_JSLIB_FILES += static/js/lib/common-lib.js | |
54b1479a | 120 | GITWEB_JSLIB_FILES += static/js/lib/datetime.js |
fcce886b | 121 | GITWEB_JSLIB_FILES += static/js/lib/cookies.js |
9a86dd57 | 122 | GITWEB_JSLIB_FILES += static/js/javascript-detection.js |
291e52bd | 123 | GITWEB_JSLIB_FILES += static/js/adjust-timezone.js |
9a86dd57 JN |
124 | GITWEB_JSLIB_FILES += static/js/blame_incremental.js |
125 | ||
126 | ||
8de096b6 JH |
127 | GITWEB_REPLACE = \ |
128 | -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ | |
129 | -e 's|++GIT_BINDIR++|$(bindir)|g' \ | |
130 | -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ | |
131 | -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ | |
132 | -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ | |
133 | -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ | |
134 | -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ | |
135 | -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \ | |
136 | -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ | |
137 | -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ | |
138 | -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ | |
139 | -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \ | |
140 | -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \ | |
141 | -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \ | |
142 | -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \ | |
143 | -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ | |
144 | -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ | |
145 | -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ | |
7ce896b3 CW |
146 | -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ |
147 | -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g' | |
8de096b6 JH |
148 | |
149 | GITWEB-BUILD-OPTIONS: FORCE | |
150 | @rm -f $@+ | |
151 | @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+ | |
152 | @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@ | |
153 | ||
154 | gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS | |
62331ef1 JWH |
155 | $(QUIET_GEN)$(RM) $@ $@+ && \ |
156 | sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ | |
8de096b6 | 157 | $(GITWEB_REPLACE) $< >$@+ && \ |
62331ef1 JWH |
158 | chmod +x $@+ && \ |
159 | mv $@+ $@ | |
160 | ||
9a86dd57 JN |
161 | static/gitweb.js: $(GITWEB_JSLIB_FILES) |
162 | $(QUIET_GEN)$(RM) $@ $@+ && \ | |
163 | cat $^ >$@+ && \ | |
164 | mv $@+ $@ | |
165 | ||
958a8467 JN |
166 | ### Testing rules |
167 | ||
168 | test: | |
169 | $(MAKE) -C ../t gitweb-test | |
170 | ||
171 | test-installed: | |
172 | GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \ | |
173 | $(MAKE) -C ../t gitweb-test | |
174 | ||
152d9434 JN |
175 | ### Installation rules |
176 | ||
177 | install: all | |
178 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' | |
179 | $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' | |
18d05328 PKS |
180 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' |
181 | $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' | |
152d9434 JN |
182 | |
183 | ### Cleaning rules | |
184 | ||
62331ef1 | 185 | clean: |
18d05328 | 186 | $(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS |
8de096b6 | 187 | |
958a8467 | 188 | .PHONY: all clean install test test-installed .FORCE-GIT-VERSION-FILE FORCE |
62331ef1 | 189 |