Android makefiles:如何“提早返回”? [英] Android makefiles: How to "early return"?

查看:200
本文介绍了Android makefiles:如何“提早返回”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ndk-build构建一个库的bucnh。在某些时候,一个mk文件可以包含两次,因为它导入第三方库,我使用全局变量保护双重导入:

I'm building a bucnh of libraries using ndk-build. At some point, a mk file could be included twice, as it imports 3rd party libraries, I protected double-import using a global variable:

# Importing nlopt!
# Prevent warnings reporting module was imported twice:
ifneq ($(imported_nlopt_$(TARGET_ARCH_ABI)),true)
    imported_nlopt_$(TARGET_ARCH_ABI) := true
    ifeq ($(APP_OPTIM),debug)
        # Importing static library nlopt_debug:
            include $(CLEAR_VARS)
            LOCAL_MODULE    := nlopt_debug
            LOCAL_SRC_FILES := nlopt/nlopt-2.4.2/lib/$(PLATFORM)/$(COMPILER)/Debug/$(LIB_PREFIX)nlopt$(DEBUG_INFIX)$(DYNAMIC_LINK_EXT)
            include $(PREBUILT_SHARED_LIBRARY)
    else
        # Importing static library nlopt_release:
            include $(CLEAR_VARS)
            LOCAL_MODULE    := nlopt_release
            LOCAL_SRC_FILES := nlopt/nlopt-2.4.2/lib/$(PLATFORM)/$(COMPILER)/Release/$(LIB_PREFIX)nlopt$(DYNAMIC_LINK_EXT)
            include $(PREBUILT_SHARED_LIBRARY)
    endif
else
    $(info "NLOPT already imported!")
endif

我需要在很多地方做到这一点,它开始厌烦我让整个文件在 if 语句。

I need to do this in many place and it starts anoying me to have the whole file being in an if statement.

makefile中是否支持早期回报?我可以这样做:

Are "early returns" supported in makefiles? Could I do something like:

ifeq ($(imported_nlopt_$(TARGET_ARCH_ABI)),true)
    return
endif

imported_nlopt_$(TARGET_ARCH_ABI) := true
...


$ b

return is not recognized when I execute this.

推荐答案

这篇关于Android makefiles:如何“提早返回”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆