Makefile中的Clean命令无法正常运行

时间:2020-01-09 11:47:57

标签: c bash makefile

Makefile给我带来了清理问题:

CFLAGS=-ansi -Wpedantic -Wall -D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=200112L

LIBRARIES=-lpthread


all:    main.exe

main.exe: main.o DBGpthread.o
        gcc ${CFLAGS} -o main.exe main.o DBGpthread.o ${LIBRARIES}

main.o: main.c DBGpthread.h printerror.h
        gcc ${CFLAGS} -c main.c

DBGpthread.o: DBGpthread.c printerror.h
        gcc ${CFLAGS} -c DBGpthread.c

.PHONY: clean

clean:  
        -rm -f main.o DBGpthread.o main.exe

当我的目录中只有.c和.h文件,并且我执行make -f Makefile时一切正常,但是如果我再次在目录中使用* .o和main.exe再次执行make -f Makefile ,出现消息nothing to be done for all。 我必须手动删除* .o文件,才能再次执行命令make -f Makefile。 看来clean不能正常工作,并且仅在这台计算机上会发生这种情况。

1 个答案:

答案 0 :(得分:0)

好吧,我错了,一切正常。 如果我在程序中未进行任何更改时执行$(document).on('click', '.wish', function () { var thisId = $(this).attr('id'); console.log(thisId); //check if this is the id of the element you want to trigger var prodID = $('#'+thisId).data("show-value"); } ,则会出现错误make -f Makefile。 我不知道这一点,因为我对makefile有点陌生。 针对上述答案,nothing to be done for all-很好。