Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (63 sloc) 2.63 KB
# Initial Version Copyright (C) 2010 eZuce, Inc., All Rights Reserved.
# Licensed to the User under the LGPL license.
#
SRC = $(abspath @srcdir@)
PACKAGE_VERSION := $(shell $(SRC)/config/git-version-gen .version | sed 's/\(.*\)\.\([0-9]\+\)-\([0-9a-z\-]\+\)/\1/g')
PACKAGE_REVISION := $(shell $(SRC)/config/git-version-gen .version | sed 's/\(.*\)\.\([0-9]\+\)[-\.]\([0-9a-f]\+\)-\?\(dirty\)\?/\2.\3/g')
help-var.DISTRO=To run a command for a different target distro. Default: $(DISTRO). Examples: fedora centos suse
DISTRO=@DISTRO@
help-var.DISTRO_VER=To run a command for a different target version. Default: $(DISTRO_VER).
DISTRO_VER=@DISTRO_VER@
help-var.DISTRO_ARCH=To run a command for a different target version. Default: $(DISTRO_ARCH).
DISTRO_ARCH=@DISTRO_ARCH@
LastRev = $(firstword $(shell cd $(SRC); git log -1 --format="%h %ci" -1 HEAD | sed -e 's|:|-|g'|cut -d\ -f 1) 0)
lowercase = $(shell echo $(1) | tr '[:upper:]' '[:lower:]')
# for each sipx-% target, define a variable for the corresponding project directory
PROJ = $(filter $(all),$(subst ., ,$@))
proj = $(call lowercase,$(PROJ))
# lists all the items in the list inclusive after given item
after = $(shell echo $2 | sed 's|\(.*\)\($1.*\)|\2|g')
# for each sipx.% target, define a variable for the last svn rev from git rebase
REV = $(call LastRev, $(PROJ))
default-first-target : help;
sipx.% :
$(MAKE) $(foreach P,$(sipx),$(P).$*)
lib.% :
$(MAKE) $(foreach P,$(lib),$(P).$*)
help.{sipx,lib}.list=list all sipx components
lib.list sipx.list : %.list :
@echo $($*)
include $(sort $(wildcard mak/*.mk))
help.*...=Do given target all the project after the given project, inclusive. e.g. 'make sipXconfig.check...' or 'make sipXconfig...'
$(foreach T,$(sipx),$(T).%...) :
$(MAKE) $(foreach T,$(call after,$(PROJ),$(sipx)),$(T).$*)
$(foreach T,$(lib),$(T).%...) :
$(MAKE) $(foreach T,$(call after,$(PROJ),$(lib)),$(T).$*)
.PHONY: help
help:
@echo "$$help_header"
@$(MAKE) --no-print-directory -s help.print
@echo "$$help_var_header"
@$(MAKE) --no-print-directory -s help-var.print
help.print help-var.print: %.print :
@$(foreach H,$(filter $*.%,$(sort $(.VARIABLES))), \
echo "$$format_help" | Label="$(H:$*.%=%)" Text="$($(H))" bash;)
define help_header
TARGETS
=======
endef
export help_header
define help_var_header
VARIABLES
===========
endef
export help_var_header
define format_help
MARGIN=18
WIDTH=`tput cols`
HELP_WIDTH=`echo $$[$${WIDTH} - $${MARGIN}]`
export TEXT=`echo "$${Text}" | fold -s -w $${HELP_WIDTH} | sed -e "2,10s|^| |g"`
export LABEL="$${Label}"
echo | awk '{printf("%-15s - %s\n", ENVIRON["LABEL"], ENVIRON["TEXT"]);}'
endef
export format_help
Jump to Line
Something went wrong with that request. Please try again.