gitweb / Makefileon commit Merge branch 'jc/maint-fix-test-perm' into maint (a625740)
   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
  10prefix ?= $(HOME)
  11bindir ?= $(prefix)/bin
  12RM ?= rm -f
  13
  14# JavaScript minifier invocation that can function as filter
  15JSMIN ?=
  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
  32ifdef JSMIN
  33GITWEB_JS = gitweb.min.js
  34else
  35GITWEB_JS = gitweb.js
  36endif
  37GITWEB_SITE_HEADER =
  38GITWEB_SITE_FOOTER =
  39
  40# include user config
  41-include ../config.mak.autogen
  42-include ../config.mak
  43
  44# determine version
  45../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
  46        $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
  47
  48-include ../GIT-VERSION-FILE
  49
  50### Build rules
  51
  52SHELL_PATH ?= $(SHELL)
  53PERL_PATH  ?= /usr/bin/perl
  54
  55# Shell quote;
  56bindir_SQ = $(subst ','\'',$(bindir))         #'
  57SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) #'
  58PERL_PATH_SQ  = $(subst ','\'',$(PERL_PATH))  #'
  59
  60# Quiet generation (unless V=1)
  61QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
  62QUIET_SUBDIR1  =
  63
  64ifneq ($(findstring $(MAKEFLAGS),w),w)
  65PRINT_DIR = --no-print-directory
  66else # "make -w"
  67NO_SUBDIR = :
  68endif
  69
  70ifneq ($(findstring $(MAKEFLAGS),s),s)
  71ifndef V
  72        QUIET          = @
  73        QUIET_GEN      = $(QUIET)echo '   ' GEN $@;
  74        QUIET_SUBDIR0  = +@subdir=
  75        QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
  76                         $(MAKE) $(PRINT_DIR) -C $$subdir
  77        export V
  78        export QUIET
  79        export QUIET_GEN
  80        export QUIET_SUBDIR0
  81        export QUIET_SUBDIR1
  82endif
  83endif
  84
  85all:: gitweb.cgi
  86
  87ifdef JSMIN
  88FILES=gitweb.cgi gitweb.min.js
  89gitweb.cgi: gitweb.perl gitweb.min.js
  90else # !JSMIN
  91FILES=gitweb.cgi
  92gitweb.cgi: gitweb.perl
  93endif # JSMIN
  94
  95gitweb.cgi:
  96        $(QUIET_GEN)$(RM) $@ $@+ && \
  97        sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
  98            -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
  99            -e 's|++GIT_BINDIR++|$(bindir)|g' \
 100            -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
 101            -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
 102            -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
 103            -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
 104            -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
 105            -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
 106            -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
 107            -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
 108            -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
 109            -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
 110            -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
 111            -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
 112            -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
 113            -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
 114            -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
 115            -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
 116            -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
 117            $< >$@+ && \
 118        chmod +x $@+ && \
 119        mv $@+ $@
 120
 121ifdef JSMIN
 122gitweb.min.js: gitweb.js
 123        $(QUIET_GEN)$(JSMIN) <$< >$@
 124endif # JSMIN
 125
 126clean:
 127        $(RM) $(FILES)
 128
 129.PHONY: all clean .FORCE-GIT-VERSION-FILE