Roland Ver. 4.5 Technical Information Seite 89

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 212
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 88
Chapter 7: Conditional Parts of Makefiles 79
ifeq (arg1, arg2)
ifeq arg1 arg2
ifeq "arg1" "arg2"
ifeq "arg1" arg2
ifeq arg1 "arg2"
Expand all variable references in arg1 and arg2 and compare them. If they
are identical, the text-if-true is effective; otherwise, the text-if-false, if any, is
effective.
Often you want to test if a variable has a non-empty value. When the value
results from complex expansions of variables and functions, expansions you
would consider empty may actually contain whitespace characters and thus are
not seen as empty. However, you can use the strip function (see Section 8.2
[Text Functions], page 84) to avoid interpreting whitespace as a non-empty
value. For example:
ifeq ($(strip $(foo)),)
text-if-empty
endif
will evaluate text-if-empty even if the expansion of $(foo) contains whitespace
characters.
ifneq (arg1, arg2)
ifneq arg1 arg2
ifneq "arg1" "arg2"
ifneq "arg1" arg2
ifneq arg1 "arg2"
Expand all variable references in arg1 and arg2 and compare them. If they
are different, the text-if-true is effective; otherwise, the text-if-false, if any, is
effective.
ifdef variable-name
The ifdef form takes the name of a variable as its argument, not a reference
to a variable. The value of that variable has a non-empty value, the text-if-true
is effective; otherwise, the text-if-false, if any, is effective. Variables that have
never been defined have an empty value. The text variable-name is expanded,
so it could be a variable or function that expands to the name of a variable.
For example:
bar = true
foo = bar
ifdef $(foo)
frobozz = yes
endif
The variable reference $(foo) is expanded, yielding bar, which is considered
to be the name of a variable. The variable bar is not expanded, but its value
is examined to determine if it is non-empty.
Note that ifdef only tests whether a variable has a value. It does not expand
the variable to see if that value is nonempty. Consequently, tests using ifdef
Seitenansicht 88
1 2 ... 84 85 86 87 88 89 90 91 92 93 94 ... 211 212

Kommentare zu diesen Handbüchern

Keine Kommentare