首页 > makefile执行出错的问题

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.

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

【热门文章】
【热门文章】