gitweb / Makefileon commit Merge branch 'hg/maint-attr-fix' into maint (755f0e3)
   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
  83ifdef JSMIN
  84GITWEB_JS = gitweb.min.js
  85all:: gitweb.min.js
  86gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS
  87        $(QUIET_GEN)$(JSMIN) <$< >$@
  88endif
  89
  90ifdef CSSMIN
  91GITWEB_CSS = gitweb.min.css
  92all:: gitweb.min.css
  93gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS
  94        $(QUIET_GEN)$(CSSMIN) <$ >$@
  95endif
  96
  97GITWEB_REPLACE = \
  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
 118GITWEB-BUILD-OPTIONS: FORCE
 119        @rm -f $@+
 120        @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
 121        @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
 122
 123gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
 124        $(QUIET_GEN)$(RM) $@ $@+ && \
 125        sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
 126                $(GITWEB_REPLACE) $< >$@+ && \
 127        chmod +x $@+ && \
 128        mv $@+ $@
 129
 130clean:
 131        $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS
 132
 133.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE
 134