Makefile说变量是空的,但它不是
Makefile says that variable is empty but it's not
我正在尝试创建具有以下内容的makefile:
$(CXX)=g++
$(SRC)=../src
$(INCL)=../include
all: cpu ram temperature swap statusshooter
$(CXX) main.cpp cpu.o ram.o temperature.o swap.o statusshooter.o -o main.o -I$(INCL) -Ofast -Wall -lyaml-cpp -lglog -lpqxx -lpq
cpu:
$(CXX) -c $(SRC)/CCpu.cpp -o cpu.o -Ofast -Wall
ram:
$(CXX) -c $(SRC)/CRam.cpp -o ram.o -Ofast -Wall
temperature:
$(CXX) -c $(SRC)/CTemperature.cpp -o temperature.o -Ofast -Wall
swap:
$(CXX) -c $(SRC)/CSwap.cpp -o swap.o -Ofast -Wall
statusshooter:
$(CXX) -c $(SRC)/CStatusShooter.cpp -o statusshooter.o -Ofast -Wall
使用执行该生成文件:make CXX=g++-4.7
抛出以下错误:
makefile:2: *** empty variable name. Stop.
如何解决此问题?
语法$(CXX)
用于评估make变量,而不是分配给它
CXX = g++
SRC = ../src
INCL = ../include
[...]
要为变量赋值,请写var=...
,而不是$var=...
,因此,在您的情况下,CXX=g++
等
相关文章:
- Makefile g++ 使用命令行中的 -D 变量进行编译,默认值
- 如何将makefile变量用作g 命令中包含的文件
- 使用定义的常量(来自 Makefile)在 C 中形成变量名称的一部分
- 与 Makefile 中的变量扩展混淆
- 如何在Makefile中正确使用变量
- Makefile说变量是空的,但它不是
- 使用 Code::Blocks、plink 和 makefile 进行远程编译时无法访问环境变量
- Makefile没有使用我的变量和规则(即编译器和它的标志)
- 如何定义一个变量,然后在目标[Makefile]中编译
- 用For循环填充Makefile变量
- 访问代码中的Makefile变量
- Makefile定制变量
- Makefile.am /配置.ac条件环境变量检查
- GNU Make -在规则/目标中设置shell命令输出中的MAKEFILE变量
- 根据Makefile中的目标更改变量
- 编译c++, Makefile基础知识:变量,包括库
- Makefile变量问题,make想要创建"*.o"而不是foo.o bar.o等
- C++makefile的Netbeans环境变量
- 如何将两个Makefile(每个生成的脚本都设置了特定的环境变量)合并到一个Makefile中
- 当环境变量发生变化时,让基于makefile的cmake项目自动运行make-rebuild_cache