File: Makefile.shared

package info (click to toggle)
kamailio 4.2.0-2+deb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 56,276 kB
  • sloc: ansic: 552,836; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (54 lines) | stat: -rw-r--r-- 1,551 bytes parent folder | download | duplicates (2)
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
#
# $Id$
#
# shared functions 
#
#
# History:
# --------
#  2008-06-27  initial version (andrei)
#

escape_values=$(subst $$,\$$,$(subst ",\", $(1)))

# generates echo "$(1)=escape($(1))"
cfg_gen_var=echo "$(1)=$(call escape_values,$($(1)))"

# similar to cfg_gen_var, but for FOO=1 var=$(FOO)
# it would generate "echo var=$(FOO)" and not "echo var=1"
cfg_gen_var2=echo "$(1)=$(call escape_values,$(value $(1)))"

# generate a var from itself concatenated with another one
cfg_gen_var3=echo "$(1)=$(call escape_values,$(value $(1))) \$$($(2))"

# generates echo "$(1)=escape($(1)) >> $(2)"
cfg_save_var=$(call cfg_gen_var,$(1)) >>$(2);
# same as above but uses cfg_gen_var2
cfg_save_var2=$(call cfg_gen_var2,$(1)) >>$(2);
# concatenate another var to first var
cfg_save_var3=$(call cfg_gen_var3,$(1),$(2)) >>$(3);

# map function $(1) on variable list $($(2)) (the function is used with only
# one arg)
mapf1=$(foreach v,$($(2)),$(call $(1),$v))
# map function $(1) on variable list $($(2)), passing also $(3) as second
# arg
mapf2=$(foreach v,$($(2)),$(call $(1),$v,$(3)))


#cfg_fixed_to_file=$(call mapf2,cfg_save_var,saved_fixed_vars,$(1))
#cfg_chg_to_file=$(call mapf2,cfg_save_var2,saved_chg_vars,$(1))

ifeq (${err_fail},1)
sh_err_fail=set -e;
try_err=$(1) ; if [ $$? != 0 ]; then echo ERROR: $(1) failed ;  exit 1 ; fi
else
sh_err_fail=
try_err=$(1) ; if [ $$? != 0 ]; then echo ERROR: $(1) failed ; fi
endif

DOCBOOK = $(shell which docbook2x-man 2>/dev/null)
ifeq ($(DOCBOOK),)
	DOCBOOK = $(shell which db2x_docbook2man 2>/dev/null)
endif