Makefile未处理所有命令

Makefile未处理所有命令,makefile,gnu-make,gnu,Makefile,Gnu Make,Gnu,我试图通过先预处理,然后编译,然后组装,然后链接,逐步将hello.c转换为hello。但是,仅执行makefile的第一个命令: Osheens-MacBook-Air-1115:Assignment0.1 osheensachdev$ ls hello.c makefile Osheens-MacBook-Air-1115:Assignment0.1 osheensachdev$ cat makefile hello.i : hello.c gcc -E hello.c -

我试图通过先预处理,然后编译,然后组装,然后链接,逐步将hello.c转换为hello。但是,仅执行makefile的第一个命令:

Osheens-MacBook-Air-1115:Assignment0.1 osheensachdev$ ls
hello.c     makefile
Osheens-MacBook-Air-1115:Assignment0.1 osheensachdev$ cat makefile

hello.i : hello.c
    gcc -E hello.c -o hello.i

hello.s : hello.i
    gcc -S hello.i -o hello.s

hello.o : hello.s
    gcc -c hello.s -o hello.o

hello : hello.o
    $ld hello.o -e main hello

clean:
    rm hello.i hello.s hello.o hello
Osheens-MacBook-Air-1115:Assignment0.1 osheensachdev$ make
gcc -E hello.c -o hello.i
Osheens-MacBook-Air-1115:Assignment0.1 osheensachdev$ make
make: `hello.i' is up to date.
我在网上搜索了链接文件,但没有找到任何关于为什么这不起作用的具体信息


我还指定了目标:[依赖关系],所以我不明白为什么这不起作用。

生成文件的第一个目标是默认目标

这就是为什么在许多Makefiles中,您会在顶部看到一个all target,用于生成所有内容:

all: build test

build: <prerequisites>

test: <prerequisites>
因为您没有指定一个,所以生成hello。我只添加生成此目标所需的所有内容:

你好,我还不存在。 你好,我需要你好。先打个招呼。 你好,c已经制作好了。无事可做。 现在打招呼,即运行gcc-e hello.c-o hello.i。 停止 然后你再次运行Make,没有任何特定目标

你好,我已经存在了。无事可做。 停止 我怀疑你想打个招呼,也就是说,你的程序

要么:

在顶部移动hello并将其设置为默认目标 或者跑去打招呼