简体   繁体   English

进行安装和环境变量

[英]Make install and environment variables

I started using linux a few months ago and some things are not yet clear to me. 几个月前,我开始使用linux,但对我来说有些事情还不清楚。 When executing the make install command, is it possible to set some variables for the user? 执行make install命令时,是否可以为用户设置一些变量? For instance, when installing OGRE or CEGUI, are some variable like $OGRE_LIBS or $CEGUI_LIBS created? 例如,在安装OGRE或CEGUI时,是否创建了诸如$ OGRE_LIBS或$ CEGUI_LIBS之类的变量? If so, how can you find the names attribute to such variables? 如果是这样,您如何找到此类变量的名称属性? (i mean if you are not sure of the given name) (我的意思是如果您不确定给定名称)

If they are not set automatically: As, when installing such libraries, some filed are copied into /usr/local/share AND in /usr/local/include, I am not sure which variables I should set to which directory. 如果未自动设置它们:例如,在安装此类库时,会将某些文件复制到/ usr / local / share中,并复制到/ usr / local / include中,因此我不确定应将哪个变量设置到哪个目录。 Is there any convention for that? 有什么约定吗?

In advance, thank you for your explanation, 预先感谢您的解释,

Best, 最好,

Pierre A 皮埃尔·A

First of all Enviroment Variables has a constant name so that anyone can use them with no importance for the absolute path. 首先,环境变量具有一个常量名称,因此任何人都可以在绝对路径中使用它们而不必担心。 the easiest way to check whether an envvar exists or not is using a helper bash/sh script. 检查envvar是否存在的最简单方法是使用助手bash / sh脚本。 envar_checker.sh envar_checker.sh

#!/bin/bash

if [ -z ${envar+x} ] ; then
    echo ${envar} is not set!
    exit 1
fi
touch ./envar_exists

Makefile: 生成文件:

.envar_ok:
    ./envar_checker.sh

build: .envar_ok target1 target2

The advantage in this approach is that you will check the envvars only once! 这种方法的优点是您只需要检查一次envvars!

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

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