John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 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 |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 7 | # a filter to have static/gitweb.js minified. |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 8 | # |
Mark Rada | 0e6ce21 | 2010-04-02 20:35:05 -0400 | [diff] [blame] | 9 | # Define CSSMIN to point to a CSS minifier in order to generate a minified |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 10 | # version of static/gitweb.css |
Mark Rada | 0e6ce21 | 2010-04-02 20:35:05 -0400 | [diff] [blame] | 11 | # |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 12 | |
| 13 | prefix ?= $(HOME) |
| 14 | bindir ?= $(prefix)/bin |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 15 | gitwebdir ?= /var/www/cgi-bin |
| 16 | |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 17 | RM ?= rm -f |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 18 | INSTALL ?= install |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 19 | |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 20 | # default configuration for gitweb |
| 21 | GITWEB_CONFIG = gitweb_config.perl |
| 22 | GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf |
Jakub Narebski | 131d6af | 2011-07-25 00:29:18 +0200 | [diff] [blame] | 23 | GITWEB_CONFIG_COMMON = /etc/gitweb-common.conf |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 24 | GITWEB_HOME_LINK_STR = projects |
| 25 | GITWEB_SITENAME = |
| 26 | GITWEB_PROJECTROOT = /pub/git |
| 27 | GITWEB_PROJECT_MAXDEPTH = 2007 |
| 28 | GITWEB_EXPORT_OK = |
| 29 | GITWEB_STRICT_EXPORT = |
| 30 | GITWEB_BASE_URL = |
| 31 | GITWEB_LIST = |
| 32 | GITWEB_HOMETEXT = indextext.html |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 33 | GITWEB_CSS = static/gitweb.css |
| 34 | GITWEB_LOGO = static/git-logo.png |
| 35 | GITWEB_FAVICON = static/git-favicon.png |
| 36 | GITWEB_JS = static/gitweb.js |
Lénaïc Huard | c1355b7 | 2011-10-21 09:09:29 +0200 | [diff] [blame] | 37 | GITWEB_SITE_HTML_HEAD_STRING = |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 38 | GITWEB_SITE_HEADER = |
| 39 | GITWEB_SITE_FOOTER = |
Christopher Wilson | 7ce896b | 2010-09-21 00:25:19 -0700 | [diff] [blame] | 40 | HIGHLIGHT_BIN = highlight |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 41 | |
| 42 | # include user config |
| 43 | -include ../config.mak.autogen |
| 44 | -include ../config.mak |
Jakub Narebski | 9b93aeb | 2010-09-26 15:02:24 +0200 | [diff] [blame] | 45 | -include config.mak |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 46 | |
| 47 | # determine version |
| 48 | ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE |
| 49 | $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE |
| 50 | |
| 51 | -include ../GIT-VERSION-FILE |
| 52 | |
| 53 | ### Build rules |
| 54 | |
| 55 | SHELL_PATH ?= $(SHELL) |
| 56 | PERL_PATH ?= /usr/bin/perl |
| 57 | |
| 58 | # Shell quote; |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 59 | bindir_SQ = $(subst ','\'',$(bindir))#' |
| 60 | gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 61 | gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 62 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' |
| 63 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' |
| 64 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 65 | |
| 66 | # Quiet generation (unless V=1) |
| 67 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir |
| 68 | QUIET_SUBDIR1 = |
| 69 | |
| 70 | ifneq ($(findstring $(MAKEFLAGS),w),w) |
| 71 | PRINT_DIR = --no-print-directory |
| 72 | else # "make -w" |
| 73 | NO_SUBDIR = : |
| 74 | endif |
| 75 | |
| 76 | ifneq ($(findstring $(MAKEFLAGS),s),s) |
| 77 | ifndef V |
| 78 | QUIET = @ |
| 79 | QUIET_GEN = $(QUIET)echo ' ' GEN $@; |
| 80 | QUIET_SUBDIR0 = +@subdir= |
| 81 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ |
| 82 | $(MAKE) $(PRINT_DIR) -C $$subdir |
| 83 | export V |
| 84 | export QUIET |
| 85 | export QUIET_GEN |
| 86 | export QUIET_SUBDIR0 |
| 87 | export QUIET_SUBDIR1 |
| 88 | endif |
| 89 | endif |
| 90 | |
Jakub Narebski | 9a86dd5 | 2011-04-28 21:04:01 +0200 | [diff] [blame] | 91 | all:: gitweb.cgi static/gitweb.js |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 92 | |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 93 | GITWEB_PROGRAMS = gitweb.cgi |
| 94 | |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 95 | ifdef JSMIN |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 96 | GITWEB_FILES += static/gitweb.min.js |
| 97 | GITWEB_JS = static/gitweb.min.js |
| 98 | all:: static/gitweb.min.js |
| 99 | static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 100 | $(QUIET_GEN)$(JSMIN) <$< >$@ |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 101 | else |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 102 | GITWEB_FILES += static/gitweb.js |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 103 | endif |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 104 | |
Mark Rada | 0e6ce21 | 2010-04-02 20:35:05 -0400 | [diff] [blame] | 105 | ifdef CSSMIN |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 106 | GITWEB_FILES += static/gitweb.min.css |
| 107 | GITWEB_CSS = static/gitweb.min.css |
| 108 | all:: static/gitweb.min.css |
| 109 | static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS |
Jay Soffian | 7064994 | 2010-06-18 17:01:25 -0400 | [diff] [blame] | 110 | $(QUIET_GEN)$(CSSMIN) <$< >$@ |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 111 | else |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 112 | GITWEB_FILES += static/gitweb.css |
Mark Rada | 0e6ce21 | 2010-04-02 20:35:05 -0400 | [diff] [blame] | 113 | endif |
| 114 | |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 115 | GITWEB_FILES += static/git-logo.png static/git-favicon.png |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 116 | |
Jakub Narebski | 9a86dd5 | 2011-04-28 21:04:01 +0200 | [diff] [blame] | 117 | # JavaScript files that are composed (concatenated) to form gitweb.js |
| 118 | # |
| 119 | # js/lib/common-lib.js should be always first, then js/lib/*.js, |
| 120 | # then the rest of files; js/gitweb.js should be last (if it exists) |
| 121 | GITWEB_JSLIB_FILES += static/js/lib/common-lib.js |
Jakub Narebski | 54b1479 | 2011-04-28 21:04:04 +0200 | [diff] [blame] | 122 | GITWEB_JSLIB_FILES += static/js/lib/datetime.js |
Jakub Narebski | fcce886 | 2011-04-28 21:04:05 +0200 | [diff] [blame] | 123 | GITWEB_JSLIB_FILES += static/js/lib/cookies.js |
Jakub Narebski | 9a86dd5 | 2011-04-28 21:04:01 +0200 | [diff] [blame] | 124 | GITWEB_JSLIB_FILES += static/js/javascript-detection.js |
John 'Warthog9' Hawley | 291e52b | 2011-04-28 21:04:09 +0200 | [diff] [blame] | 125 | GITWEB_JSLIB_FILES += static/js/adjust-timezone.js |
Jakub Narebski | 9a86dd5 | 2011-04-28 21:04:01 +0200 | [diff] [blame] | 126 | GITWEB_JSLIB_FILES += static/js/blame_incremental.js |
| 127 | |
| 128 | |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 129 | GITWEB_REPLACE = \ |
| 130 | -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ |
| 131 | -e 's|++GIT_BINDIR++|$(bindir)|g' \ |
| 132 | -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ |
| 133 | -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ |
Jakub Narebski | 131d6af | 2011-07-25 00:29:18 +0200 | [diff] [blame] | 134 | -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \ |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 135 | -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ |
| 136 | -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ |
| 137 | -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ |
| 138 | -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \ |
| 139 | -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ |
| 140 | -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ |
| 141 | -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ |
| 142 | -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \ |
| 143 | -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \ |
| 144 | -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \ |
| 145 | -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \ |
| 146 | -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ |
| 147 | -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ |
Lénaïc Huard | c1355b7 | 2011-10-21 09:09:29 +0200 | [diff] [blame] | 148 | -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \ |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 149 | -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ |
Christopher Wilson | 7ce896b | 2010-09-21 00:25:19 -0700 | [diff] [blame] | 150 | -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ |
| 151 | -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g' |
John 'Warthog9' Hawley | 62331ef | 2010-01-30 23:30:40 +0100 | [diff] [blame] | 152 | |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 153 | GITWEB-BUILD-OPTIONS: FORCE |
| 154 | @rm -f $@+ |
| 155 | @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+ |
| 156 | @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@ |
| 157 | |
| 158 | gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS |
| 159 | $(QUIET_GEN)$(RM) $@ $@+ && \ |
| 160 | sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ |
| 161 | $(GITWEB_REPLACE) $< >$@+ && \ |
| 162 | chmod +x $@+ && \ |
| 163 | mv $@+ $@ |
| 164 | |
Jakub Narebski | 9a86dd5 | 2011-04-28 21:04:01 +0200 | [diff] [blame] | 165 | static/gitweb.js: $(GITWEB_JSLIB_FILES) |
| 166 | $(QUIET_GEN)$(RM) $@ $@+ && \ |
| 167 | cat $^ >$@+ && \ |
| 168 | mv $@+ $@ |
| 169 | |
Jakub Narebski | 958a846 | 2010-09-26 15:02:26 +0200 | [diff] [blame] | 170 | ### Testing rules |
| 171 | |
| 172 | test: |
| 173 | $(MAKE) -C ../t gitweb-test |
| 174 | |
| 175 | test-installed: |
| 176 | GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \ |
| 177 | $(MAKE) -C ../t gitweb-test |
| 178 | |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 179 | ### Installation rules |
| 180 | |
| 181 | install: all |
| 182 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' |
| 183 | $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' |
Pavan Kumar Sunkara | 18d0532 | 2010-05-28 11:55:49 +0530 | [diff] [blame] | 184 | $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' |
| 185 | $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' |
Jakub Narebski | 152d943 | 2010-05-01 22:36:15 +0200 | [diff] [blame] | 186 | |
| 187 | ### Cleaning rules |
| 188 | |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 189 | clean: |
Ramsay Jones | a80b263 | 2011-10-25 18:15:20 +0100 | [diff] [blame] | 190 | $(RM) gitweb.cgi static/gitweb.js \ |
| 191 | static/gitweb.min.js static/gitweb.min.css \ |
| 192 | GITWEB-BUILD-OPTIONS |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 193 | |
Jakub Narebski | 958a846 | 2010-09-26 15:02:26 +0200 | [diff] [blame] | 194 | .PHONY: all clean install test test-installed .FORCE-GIT-VERSION-FILE FORCE |
Junio C Hamano | 8de096b | 2010-04-15 08:57:18 -0400 | [diff] [blame] | 195 | |