#!bin/bash
CC=gcc /*gcc compiler*/
CFLAGS=-I. /*current working directory*/
hello: p1.o p2.o p.h /*hello is the executable i want to create*/
$(cc) -o hello p1.o p2.o p.h -I.
显示的错误是
o hello p1.o p2.o p.h -I.
make: o: Command not found
make: [hello] Error 127 (ignored)
通过make来创建代码的目标文件但是不创建可执行的hello
答案 0 :(得分:4)
make
的变量区分大小写。你需要写
$(CC) -o hello p1.o p2.o p.h -I.
由于$(cc)
未设置,make
将尝试执行-o hello ...
。前导短划线会抑制make
语法中的错误,因此生成的命令是您看到的o hello ...
。