本文介绍了令:对于所有的`将做什么“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要通过如PGM创建make文件。
I am going through an eg pgm to create a make file.
我的文件夹eg_make_creation包含下列文件,
My folder eg_make_creation contains the following files,
desktop:~/eg_make_creation$ ls
factorial.c functions.h hello hello.c main.c Makefile
的Makefile
# I am a comment, and I want to say that the variable CC will be
# the compiler to use.
CC=gcc
# Hwy!, I am comment no.2. I want to say that CFLAGS will be the
#options I'll pass to the compiler
CFLAGS=-c -Wall
all:hello
hello:main.o factorial.o hello.o
$(CC) main.o factorial.o hello.o -o hello
main.o:main.c
$(CC) $(CFLAGS) main.c
factorial.o:factorial.c
$(CC) $(CFLAGS) factorial.c
hello.o:hello.c
$(CC) $(CFLAGS) hello.c
clean:
rm -rf *o hello
错误:
desktop:~/eg_make_creation$ make all
make: Nothing to be done for `all'.
请帮助我了解编译此程序。
Please help me understand to compile this program.
推荐答案
有时,做任何对所有的错误可以用空格makefile规则,而不是标签命令之前造成的。请确保您使用的标签,而不是空格你的规则里面。
Sometimes "Nothing to be done for all" error can be caused by spaces before command in makefile rule instead of tab. Please ensure that you use tabs instead of spaces inside of your rules.
all:
<\t>$(CC) $(CFLAGS) ...
而不是
all:
$(CC) $(CFLAGS) ...
这篇关于令:对于所有的`将做什么“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!