简体   繁体   English

使用自动工具的多个构建标志

[英]Multiple build flags with autotools

I am working at a C application with ncurses for a CLI that uses autotools for build. 我在使用ncurses的C应用程序中使用CLI,该CLI使用自动工具进行构建。 Besides the actual application, there is a testing framework (cutter) and there are some preprocessor constants that enable or disable some features (for example, there is a constant WINDOW that borders all ncurses windows - useful for managing the window layout). 除了实际的应用程序之外,还有一个测试框架(切纸器),并且有一些启用或禁用某些功能的预处理器常量(例如,有一个常量WINDOW与所有ncurses窗口接壤-对管理窗口布局很有用)。

Of course, some of these constants can be specified manually at compile time (ie make) but I'd like to have 2 build targets: debug and release. 当然,其中一些常量可以在编译时手动指定(即make),但我希望有2个构建目标:调试和发布。 Also, there is a problem with cutter (configure checks for it, and this is supposed to happen if it's going to be used, but I cannot require a normal user to install cutter to compile). 另外,裁纸器存在问题(配置检查,如果要使用它,应该会发生这种情况,但是我不能要求普通用户安装裁纸器进行编译)。 So, I was thinking at the following setup: to create a configure flag that enables tests (disabled by default) and 2 make targets (make creates the release version and make debug, the debug one). 因此,我在考虑以下设置:创建一个配置标记,该标记启用测试(默认情况下禁用)和2个make目标(make创建发行版本,make debug,即debug一个)。 Is this workflow correct or there is a better way to do this? 此工作流程是否正确或有更好的方法来做到这一点?

If it were me, I'd use AC_ARG_WITH to setup where the cutter testing framework resides (eg include/library paths) and any related stuff that deals with cutter (eg preprocessor flags), and one or more AC_ARG_ENABLE variables (or possibly AC_ARG_WITH) to enable other preprocessor directives. 如果是我,我将使用AC_ARG_WITH设置切割器测试框架的位置(例如,include / library路径)以及处理切割器的任何相关内容(例如,预处理器标志)以及一个或多个AC_ARG_ENABLE变量(或者可能是AC_ARG_WITH)启用其他预处理程序指令。 This way you don't have to maintain a debug target. 这样,您就不必维护调试目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM