重要章节2:关于变量和环境变量的转换关系
来源:互联网 发布:万网域名主机记录 编辑:程序博客网 时间:2024/05/18 00:48
6.10 Variables from the EnvironmentVariables in make can come from the environment in which make is run. Every environment variable that make sees when it starts up is transformed into a make variable with the same name and value. However, an explicit assignment in the makefile, or with a command argument, overrides the environment. (If the ‘-e’ flag is specified, then values from the environment override assignments in the makefile. See Summary of Options. But this is not recommended practice.)Thus, by setting the variable CFLAGS in your environment, you can cause all C compilations in most makefiles to use the compiler switches you prefer. This is safe for variables with standard or conventional meanings because you know that no makefile will use them for other things. (Note this is not totally reliable; some makefiles set CFLAGS explicitly and therefore are not affected by the value in the environment.)When make runs a recipe, variables defined in the makefile are placed into the environment of each shell. This allows you to pass values to sub-make invocations (see Recursive Use of make). By default, only variables that came from the environment or the command line are passed to recursive invocations. You can use the export directive to pass other variables. See Communicating Variables to a Sub-make, for full details.Other use of variables from the environment is not recommended. It is not wise for makefiles to depend for their functioning on environment variables set up outside their control, since this would cause different users to get different results from the same makefile. This is against the whole purpose of most makefiles.Such problems would be especially likely with the variable SHELL, which is normally present in the environment to specify the user's choice of interactive shell. It would be very undesirable for this choice to affect make; so, make handles the SHELL environment variable in a special way; see Choosing the Shell.
阅读全文
0 0
- 重要章节2:关于变量和环境变量的转换关系
- 系统变量与环境变量的关系
- 简析环境变量和变量延迟特殊字符以及中介法的微妙关系
- 重要章节1:makefile如何读取的
- java变量类型之间的转换关系
- 关于 子类局部变量 和 父类局部变量 的关系
- 关于C语言中 int型变量和unsigned int变量范围之间的关系
- 变量和内存的关系
- 引用和变量的关系。
- 关于linux的export命令和shell变量的生命周期,环境变量
- 操作系统环境变量LANG和NLS_LANG的关系
- 操作系统环境变量LANG和NLS_LANG的关系
- shell的本地变量和环境变量
- shell的本地变量和环境变量
- java的系统变量和环境变量
- shell的本地变量和环境变量
- 环境变量 和 系统变量 的path 区别
- 有关标准变量和环境变量的技巧
- 高处看Surface,WIndow,View,SurfaceView
- iOS 关于linker command failed with exit code 1的坑
- mac连手机bug解决
- JDBC Thin连接ORACLE,错误类型ORA-12505
- 重要章节1:makefile如何读取的
- 重要章节2:关于变量和环境变量的转换关系
- Ubuntu 下设置电脑使用固定IP地址
- 内核地址空间的划分
- java数据转json格式两种方式
- CentOS 5.8下filebench安装
- 章节之外:makefile中的函数定义
- 正则表达式语法
- 数据结构之哈希表
- 各数据库的JDBC的URL