· GNU Make Manual. Free Software Foundation. last updated Janu. This manual (make) is available in the following formats: HTML (K bytes) - entirely on one web page. HTML - with one web page per node. HTML compressed (K gzipped characters) - entirely on one web page. ifeq (arg1, arg2) ifeq 'arg1' 'arg2' ifeq "arg1" "arg2" ifeq "arg1" 'arg2' ifeq 'arg1' "arg2" arg1とarg2のすべての変数参照を展開して比較します。もし二つが等しければ真の場合の内容が有効になり、そうでなければ偽の場合の内容があればこれが有効になります。 変数の値が. The ifeq directive begins the conditional, and specifies the condition. It contains two arguments, separated by a comma and surrounded by parentheses. Variable substitution is performed on both arguments and then they are compared. The lines of the makefile following the ifeq are obeyed if the two arguments match; otherwise they are ignored.
GNU Make has two assignment operators, ":=" and "=". ":=" performs immediate evaluation of the right-hand side and stores an actual string into the left-hand side. "=" is like a formula definition; it stores the right-hand side in an unevaluated form and then evaluates this form each time the left-hand side is used. When comparing something with the empty string `' using ifeq or ifneq, you usually want a string of just whitespace to match the empty string (see section Conditional Parts of Makefiles). Thus, the following may fail to have the desired results: (as opposed to the GNU make makefile conditionals such as ifeq (see section Syntax of Conditionals). GNU Make is a program that automates the running of shell commands and helps with repetitive tasks. It is typically used to transform files into some other form, e.g. compiling source code files into programs or libraries. It does this by tracking prerequisites and executing a hierarchy of commands to produce targets.
Code: SHELL = /usr/bin/ksh ifeq ($ (shell [ [ $ (V1) == 15 $ (V2) == 16 ]] echo true),true) v2=true else v2=false endif verify: @echo $ (v2) To test I ran these commands: Code: V2=18 V1=15 gmake verify # should print false V2=16 V1=15 gmake verify # should print true. Make sure that your SHELL variable is set to a shell that supports the. @CraigRinger -- just looking at this. If you do an ifeq ($1,) inside of the macro, the $1 is not expanded until the $(call is expanded, and thus it is valid to use the ifeq inside of the define (though I wouldn't recommend that practice). The ifeq directive begins the conditional, and specifies the condition. It contains two arguments, separated by a comma and surrounded by parentheses. Variable substitution is performed on both arguments and then they are compared. The lines of the makefile following the ifeq are obeyed if the two arguments match; otherwise they are ignored.
0コメント