【发布时间】:2012-10-04 18:29:33
【问题描述】:
我不熟悉使用 makefile 并尝试生成基本的 makefile 作为大学练习的一部分。我有两个源代码文件,chello.c 和 writeexit.s,它们必须经过编译/汇编,然后链接以生成 chello。
这是我目前的 makefile 代码:
chello: chello.o writeexit.o
ld -N chello.o writeexit.o -o chello
chello.o: chello.c
gcc -c chello.c -o chello.o
writeexit.o: writeexit.s
as writeexit.s -o writeexit.o
ld、gcc 和 as 之前的空格都是制表符,所以我认为空格很好。当我调用“make makefile”时,它返回“make: Nothing to be done for `makefile”。但是,如果我更改了 chello 的依赖项,例如 chello.c,则会返回相同的消息,并且不会修改 chello 的行为。
【问题讨论】:
-
你如何调用
make?听起来您可能正在输入make makefile,而您应该输入make -f makefile或(除非您还有一个名为Makefile的文件潜伏在同一目录中),只是make。
标签: makefile