折腾:
【已解决】更新gitbook发布脚本Makefile忽略某些book
期间,自己写了:
SHOULD_IGNORE = false
但是看到:
unix – Makefile ifeq logical AND – Stack Overflow
不确定Makefile中bool变量是否是true或false
需要先去判断变量值
makefile variable bool
gnu make – Variable in makefile conditional? – Stack Overflow
GNU make – How to Use Variables
unix – Makefile ifeq logical AND – Stack Overflow
shell – Makefile define variable using if – Stack Overflow
【总结】
目前此处Makefile中,不存在内置的,bool类型的变量,都可以看成是字符串
所以自己写成任何形式都可以。
比如:
some_variable_1 = TRUE some_variable_2 = FALSE
或:
some_variable_1 = true some_variable_2 = false
或:
some_variable_1 = 1 some_variable_2 = 0
之后正常去对比变量即可,比如:
SHOULD_IGNORE = 1 ifneq ($(SHOULD_IGNORE), 0) $(info SHOULD_IGNORE=$(SHOULD_IGNORE)) endif
输出:
SHOULD_IGNORE=1
而普通的条件判断,则详见:
GNU make – Conditional Parts of Makefiles
conditional-directive text-if-true endif
conditional-directive
text-if-true
else
text-if-false
endif
转载请注明:在路上 » 【已解决】Makefile中如何定义和判断布尔类型变量