makefile执行出错的问题

我在AIX下测试make编译一个小程序:
makefile文件:

    edit: main.o \
            cc -o main.o
    main.o: main.c \
            cc -c main.c
    clean: \
            rm edit main.o

程序cc编译通过,但是在make编译下显示出错,如下:

personal>make
"makefile", line 2: make: 1254-056 Shell command not associated with a dependency: edit: main.o  cc -o .
"makefile", line 4: make: 1254-056 Shell command not associated with a dependency: main.o: main.c  cc -.
"makefile", line 6: make: 1254-056 Shell command not associated with a dependency: clean:  rm edit main.
make: 1254-058 Fatal errors encountered -- cannot continue.
阅读 6.2k
1 个回答

那个行末的‘\’好像不对吧?
而且我觉得两个对应的编译语句分别应该是
cc main.o -o edit
cc -c main.c -o main.o

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进