conditionals

来自「Linux 下的编译工具」· 代码 · 共 147 行

TXT
147
字号
#                                                                    -*-perl-*-$description = "Check GNU make conditionals.";$details = "Attempt various different flavors of GNU make conditionals.";run_make_test('arg1 = firstarg2 = secondarg3 = thirdarg4 = ccarg5 = secondall:ifeq ($(arg1),$(arg2))	@echo arg1 equals arg2else	@echo arg1 NOT equal arg2endififeq \'$(arg2)\' "$(arg5)"	@echo arg2 equals arg5else	@echo arg2 NOT equal arg5endififneq \'$(arg3)\' \'$(arg4)\'	@echo arg3 NOT equal arg4else	@echo arg3 equal arg4endififndef undefined	@echo variable is undefinedelse	@echo variable undefined is definedendififdef arg4	@echo arg4 is definedelse	@echo arg4 is NOT definedendif',              '',              'arg1 NOT equal arg2arg2 equals arg5arg3 NOT equal arg4variable is undefinedarg4 is defined');# Test expansion of variables inside ifdef.run_make_test('foo = 1FOO = fooF = fDEF = noDEF2 = noifdef $(FOO)DEF = yesendififdef $(F)ooDEF2 = yesendifDEF3 = noFUNC = $1ifdef $(call FUNC,DEF)3  DEF3 = yesendifall:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)',              '',              'DEF=yes DEF2=yes DEF3=yes');# Test all the different "else if..." constructsrun_make_test('arg1 = firstarg2 = secondarg3 = thirdarg4 = ccarg5 = fifthresult =ifeq ($(arg1),$(arg2))  result += arg1 equals arg2else ifeq \'$(arg2)\' "$(arg5)"  result += arg2 equals arg5else ifneq \'$(arg3)\' \'$(arg3)\'  result += arg3 NOT equal arg4else ifndef arg5  result += variable is undefinedelse ifdef undefined  result += arg4 is definedelse  result += successendifall: ; @echo $(result)',              '',              'success');# Test some random "else if..." construct nestingrun_make_test('arg1 = firstarg2 = secondarg3 = thirdarg4 = ccarg5 = secondifeq ($(arg1),$(arg2))  $(info failed 1)else ifeq \'$(arg2)\' "$(arg2)"  ifdef undefined    $(info failed 2)  else    $(info success)  endifelse ifneq \'$(arg3)\' \'$(arg3)\'  $(info failed 3)else ifdef arg5  $(info failed 4)else ifdef undefined  $(info failed 5)else  $(info failed 6)endif.PHONY: allall: ; @:',              '',              'success');# This tells the test driver that the perl test script executed properly.1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?