我是使用makefiles並嘗試生成基本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的空白,併爲全部的標籤,所以我覺得whitespacing是罰款。當我調用'make makefile'時,它會返回'make:makefile'不需要做'。'但是,如果我更改chello的依賴關係(如chello.c),則會返回相同的消息,並且chello的行爲不會被修改。
你是怎麼調用'make'的?這聽起來像你可能正在輸入'make makefile',而你應該輸入'make -f makefile'或者(除非你有一個名爲'Makefile'的文件在同一個目錄中潛伏),只需要'make'。 –