2010-01-30 23:30:40 +01:00
|
|
|
# The default target of this Makefile is...
|
|
|
|
all::
|
|
|
|
|
|
|
|
# Define V=1 to have a more verbose compile.
|
|
|
|
#
|
|
|
|
# Define JSMIN to point to JavaScript minifier that functions as
|
2010-05-28 08:25:49 +02:00
|
|
|
# a filter to have static/gitweb.js minified.
|
2010-01-30 23:30:40 +01:00
|
|
|
#
|
2010-04-03 02:35:05 +02:00
|
|
|
# Define CSSMIN to point to a CSS minifier in order to generate a minified
|
2010-05-28 08:25:49 +02:00
|
|
|
# version of static/gitweb.css
|
2010-04-03 02:35:05 +02:00
|
|
|
#
|
2010-01-30 23:30:40 +01:00
|
|
|
|
|
|
|
prefix ?= $(HOME)
|
|
|
|
bindir ?= $(prefix)/bin
|
2010-05-01 22:36:15 +02:00
|
|
|
gitwebdir ?= /var/www/cgi-bin
|
|
|
|
|
2010-01-30 23:30:40 +01:00
|
|
|
RM ?= rm -f
|
2010-05-01 22:36:15 +02:00
|
|
|
INSTALL ?= install
|
2010-01-30 23:30:40 +01:00
|
|
|
|
|
|
|
# default configuration for gitweb
|
|
|
|
GITWEB_CONFIG = gitweb_config.perl
|
|
|
|
GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
|
|
|
|
GITWEB_HOME_LINK_STR = projects
|
|
|
|
GITWEB_SITENAME =
|
|
|
|
GITWEB_PROJECTROOT = /pub/git
|
|
|
|
GITWEB_PROJECT_MAXDEPTH = 2007
|
|
|
|
GITWEB_EXPORT_OK =
|
|
|
|
GITWEB_STRICT_EXPORT =
|
|
|
|
GITWEB_BASE_URL =
|
|
|
|
GITWEB_LIST =
|
|
|
|
GITWEB_HOMETEXT = indextext.html
|
2010-05-28 08:25:49 +02:00
|
|
|
GITWEB_CSS = static/gitweb.css
|
|
|
|
GITWEB_LOGO = static/git-logo.png
|
|
|
|
GITWEB_FAVICON = static/git-favicon.png
|
|
|
|
GITWEB_JS = static/gitweb.js
|
2010-01-30 23:30:40 +01:00
|
|
|
GITWEB_SITE_HEADER =
|
|
|
|
GITWEB_SITE_FOOTER =
|
2010-09-21 09:25:19 +02:00
|
|
|
HIGHLIGHT_BIN = highlight
|
2010-01-30 23:30:40 +01:00
|
|
|
|
|
|
|
# include user config
|
|
|
|
-include ../config.mak.autogen
|
|
|
|
-include ../config.mak
|
2010-09-26 15:02:24 +02:00
|
|
|
-include config.mak
|
2010-01-30 23:30:40 +01:00
|
|
|
|
|
|
|
# determine version
|
|
|
|
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
|
|
|
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
|
|
|
|
|
|
|
|
-include ../GIT-VERSION-FILE
|
|
|
|
|
|
|
|
### Build rules
|
|
|
|
|
|
|
|
SHELL_PATH ?= $(SHELL)
|
|
|
|
PERL_PATH ?= /usr/bin/perl
|
|
|
|
|
|
|
|
# Shell quote;
|
2010-05-01 22:36:15 +02:00
|
|
|
bindir_SQ = $(subst ','\'',$(bindir))#'
|
|
|
|
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
|
2010-05-28 08:25:49 +02:00
|
|
|
gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
|
2010-05-01 22:36:15 +02:00
|
|
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
|
|
|
|
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
|
|
|
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
|
2010-01-30 23:30:40 +01:00
|
|
|
|
|
|
|
# Quiet generation (unless V=1)
|
|
|
|
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
|
|
|
|
QUIET_SUBDIR1 =
|
|
|
|
|
|
|
|
ifneq ($(findstring $(MAKEFLAGS),w),w)
|
|
|
|
PRINT_DIR = --no-print-directory
|
|
|
|
else # "make -w"
|
|
|
|
NO_SUBDIR = :
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(findstring $(MAKEFLAGS),s),s)
|
|
|
|
ifndef V
|
|
|
|
QUIET = @
|
|
|
|
QUIET_GEN = $(QUIET)echo ' ' GEN $@;
|
|
|
|
QUIET_SUBDIR0 = +@subdir=
|
|
|
|
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
|
|
|
|
$(MAKE) $(PRINT_DIR) -C $$subdir
|
|
|
|
export V
|
|
|
|
export QUIET
|
|
|
|
export QUIET_GEN
|
|
|
|
export QUIET_SUBDIR0
|
|
|
|
export QUIET_SUBDIR1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
all:: gitweb.cgi
|
|
|
|
|
2010-05-01 22:36:15 +02:00
|
|
|
GITWEB_PROGRAMS = gitweb.cgi
|
|
|
|
|
2010-01-30 23:30:40 +01:00
|
|
|
ifdef JSMIN
|
2010-05-28 08:25:49 +02:00
|
|
|
GITWEB_FILES += static/gitweb.min.js
|
|
|
|
GITWEB_JS = static/gitweb.min.js
|
|
|
|
all:: static/gitweb.min.js
|
|
|
|
static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
|
2010-04-15 14:57:18 +02:00
|
|
|
$(QUIET_GEN)$(JSMIN) <$< >$@
|
2010-05-01 22:36:15 +02:00
|
|
|
else
|
2010-05-28 08:25:49 +02:00
|
|
|
GITWEB_FILES += static/gitweb.js
|
2010-04-03 02:35:05 +02:00
|
|
|
endif
|
2010-04-15 14:57:18 +02:00
|
|
|
|
2010-04-03 02:35:05 +02:00
|
|
|
ifdef CSSMIN
|
2010-05-28 08:25:49 +02:00
|
|
|
GITWEB_FILES += static/gitweb.min.css
|
|
|
|
GITWEB_CSS = static/gitweb.min.css
|
|
|
|
all:: static/gitweb.min.css
|
|
|
|
static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
|
2010-06-18 23:01:25 +02:00
|
|
|
$(QUIET_GEN)$(CSSMIN) <$< >$@
|
2010-05-01 22:36:15 +02:00
|
|
|
else
|
2010-05-28 08:25:49 +02:00
|
|
|
GITWEB_FILES += static/gitweb.css
|
2010-04-03 02:35:05 +02:00
|
|
|
endif
|
2010-01-30 23:30:40 +01:00
|
|
|
|
2010-05-28 08:25:49 +02:00
|
|
|
GITWEB_FILES += static/git-logo.png static/git-favicon.png
|
2010-05-01 22:36:15 +02:00
|
|
|
|
2010-04-15 14:57:18 +02:00
|
|
|
GITWEB_REPLACE = \
|
|
|
|
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
|
|
|
|
-e 's|++GIT_BINDIR++|$(bindir)|g' \
|
|
|
|
-e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
|
|
|
|
-e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
|
|
|
|
-e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
|
|
|
|
-e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
|
|
|
|
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
|
|
|
|
-e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
|
|
|
|
-e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
|
|
|
|
-e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
|
|
|
|
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
|
|
|
|
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
|
|
|
|
-e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
|
|
|
|
-e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
|
|
|
|
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
|
|
|
|
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
|
|
|
|
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
|
|
|
|
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
|
2010-09-21 09:25:19 +02:00
|
|
|
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
|
|
|
|
-e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
|
2010-04-15 14:57:18 +02:00
|
|
|
|
|
|
|
GITWEB-BUILD-OPTIONS: FORCE
|
|
|
|
@rm -f $@+
|
|
|
|
@echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
|
|
|
|
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
|
|
|
|
|
|
|
|
gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
|
2010-01-30 23:30:40 +01:00
|
|
|
$(QUIET_GEN)$(RM) $@ $@+ && \
|
|
|
|
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
|
2010-04-15 14:57:18 +02:00
|
|
|
$(GITWEB_REPLACE) $< >$@+ && \
|
2010-01-30 23:30:40 +01:00
|
|
|
chmod +x $@+ && \
|
|
|
|
mv $@+ $@
|
|
|
|
|
2010-09-26 15:02:26 +02:00
|
|
|
### Testing rules
|
|
|
|
|
|
|
|
test:
|
|
|
|
$(MAKE) -C ../t gitweb-test
|
|
|
|
|
|
|
|
test-installed:
|
|
|
|
GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \
|
|
|
|
$(MAKE) -C ../t gitweb-test
|
|
|
|
|
2010-05-01 22:36:15 +02:00
|
|
|
### Installation rules
|
|
|
|
|
|
|
|
install: all
|
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
|
|
|
|
$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
|
2010-05-28 08:25:49 +02:00
|
|
|
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
|
|
|
|
$(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
|
2010-05-01 22:36:15 +02:00
|
|
|
|
|
|
|
### Cleaning rules
|
|
|
|
|
2010-01-30 23:30:40 +01:00
|
|
|
clean:
|
2010-05-28 08:25:49 +02:00
|
|
|
$(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS
|
2010-04-15 14:57:18 +02:00
|
|
|
|
2010-09-26 15:02:26 +02:00
|
|
|
.PHONY: all clean install test test-installed .FORCE-GIT-VERSION-FILE FORCE
|
2010-01-30 23:30:40 +01:00
|
|
|
|