-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.in
69 lines (53 loc) · 2.13 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Initial Version Copyright (C) 2010 eZuce, Inc., All Rights Reserved.
# Licensed to the User under the LGPL license.
#
BUILDDIR = $(abspath @builddir@)
SRC = $(abspath @srcdir@)
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_REVISION = @PACKAGE_REVISION@
DISTRO=@DISTRO@
DISTRO_OS = $(word 1,$(subst -, ,$(DISTRO)))
DISTRO_VER = $(word 2,$(subst -, ,$(DISTRO)))
DISTRO_ARCH = $(word 3,$(subst -, ,$(DISTRO)))
DISTRO_RESULTS_DIR = $(strip \
$(subst fedora,Fedora, \
$(subst centos,CentOS,$(DISTRO_OS)))_$(DISTRO_VER))
# utility
empty :=
space := $(empty) $(empty)
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))
PROJ_REVISION = $(shell cd $(SRC)/$(PROJ) && ./config/revision-gen @PACKAGE_VERSION@)
default-first-target : help-basics;
sipx.% :
$(MAKE) $(foreach P,$(sipx),$(P).$*)
lib.% :
$(MAKE) $(foreach P,$(lib),$(P).$*)
help.sipx.list = List all sipxecs projects considered in this build system. To add or remove, edit .modules-include or .modules-exclude
lib.list sipx.list : %.list :
@echo $($*)
include $(sort $(wildcard mak/*.mk))
help.help = Show this help screen plus more information on more targets and important make variables.
.PHONY: help help-basics
help : help-basics
@echo -e "\nADDITIONAL TARGETS\n==================="
@$(MAKE) --no-print-directory -s help-more.print
@echo -e "\nSPECIAL VARIABLES\n==================="
@$(MAKE) --no-print-directory -s help-var.print
help-basics:
@echo -e "\nTARGETS\n==================="
@$(MAKE) --no-print-directory -s help.print
help.print help-more.print help-var.print: %.print :
@$(foreach H,$(filter $*.%,$(sort $(.VARIABLES))), \
echo "$$format_help" | Label="$(H:$*.%=%)" Text="$($(H))" bash;)
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