summaryrefslogtreecommitdiffstats
path: root/rules/pre/000-option-disabled.make
blob: 420219a28bbba59c816dbf31ccfcf332318ae65d (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# -*-makefile-*-
#
# Copyright (C) 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# nice little helper from eglibc
#
# $(call ptx/opt-dis, VAR) is 'y' if VAR is not 'y', or 'n' otherwise.
# VAR should be a variable name, not a variable reference; this is
# less general, but more terse for the intended use.
# You can use it to add a file to a list if an option group is
# disabled, like this:
#   routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += ...
#

define ptx/opt-dis
$(call ptx/ifdef,$(1),n,y)
endef


#
# $(call ptx/ifdef, PTXCONF_SYMBOL, yes, no) is equivalent to the C
# construct:
#
# PTXCONF_SYMBOL ? "yes" : "no"
#
# $(call ptx/ifdef, SYMBOL, yes, no)
#                     $1,    $2, $3
#
define ptx/ifdef
$(strip $(if $(filter y,$($(strip $(1)))),$(2),$(3)))
endef


#
# $(call ptx/ifeq, SYMBOL, val, yes, no) is equivalent to the C
# construct (plus, strings can be compared here, too):
#
# SYMBOL == val ? "yes" : "no"
#
# $(call ptx/ifeq, SYMBOL, val, yes, no)
#                    $1,    $2,  $3, $4
#
define ptx/ifeq
$(strip $(if $(filter $(strip $(2)),$($(strip $(1)))),$(3),$(4)))
endef


#
# $(call ptx/endis, PTXCONF_SYMBOL) returns "enable" or "disable"
# depending on the symbol is defined or not
#
# $(call ptx/endis, PTXCONF_SYMBOL)
#                     $1
#
define ptx/endis
$(call ptx/ifdef, $(1), enable, disable)
endef


#
# $(call ptx/disen, PTXCONF_SYMBOL) returns "disable" or "enable"
# depending on the symbol is defined or not
#
# $(call ptx/disen, PTXCONF_SYMBOL)
#                     $1
#
define ptx/disen
$(call ptx/ifdef, $(1), disable, enable)
endef


#
# $(call ptx/wwo, PTXCONF_SYMBOL) returns "with" or "without"
# depending on the symbol is defined or not
#
# $(call ptx/wwo, PTXCONF_SYMBOL)
#                     $1
#
define ptx/wwo
$(call ptx/ifdef, $(1), with, without)
endef


#
# $(call ptx/onoff, PTXCONF_SYMBOL) returns "ON" or "OFF"
# depending on the symbol is defined or not
#
# $(call ptx/onoff, PTXCONF_SYMBOL)
#                     $1
#
define ptx/onoff
$(call ptx/ifdef, $(1), ON, OFF)
endef


#
# $(call ptx/truefalse, PTXCONF_SYMBOL) returns "true" or "false"
# depending on the symbol is defined or not
#
# $(call ptx/truefalse, PTXCONF_SYMBOL)
#                     $1
#
define ptx/truefalse
$(call ptx/ifdef, $(1), true, false)
endef


#
# $(call ptx/falsetrue, PTXCONF_SYMBOL) returns "true" or "false"
# depending on the symbol is defined or not
#
# $(call ptx/falsetrue, PTXCONF_SYMBOL)
#                     $1
#
define ptx/falsetrue
$(call ptx/ifdef, $(1), false, true)
endef


#
# $(call ptx/yesno, PTXCONF_SYMBOL) returns "yes" or "no"
# depending on the symbol is defined or not
#
# $(call ptx/yesno, PTXCONF_SYMBOL)
#                     $1
#
define ptx/yesno
$(call ptx/ifdef, $(1), yes, no)
endef

# vim: syntax=make