これは私のメイクファイルです:
all:ll
ll:ll.c
gcc -c -Wall -Werror -02 c.c ll.c -o ll $@ $<
clean :
\rm -fr ll
make clean
または をしようとするとmake make
、次のエラーが発生します:
:makefile:4: *** missing separator. Stop.
どうすれば修正できますか?
ベストアンサー1
makeは定義します各レシピを開始するにはタブが必要ですすべてのルールのすべてのアクションはタブで識別されます。レシピの前にタブ以外の文字を付けたい場合は、.RECIPEPREFIX 変数を別の文字に設定できます。
確認するには、コマンドを使用しますcat -e -t -v makefile_name
。
^I
タブと行末が で示されています$
。どちらも依存関係が適切に終了していることを確認するために重要であり、タブはルールのアクションをマークして、make ユーティリティで簡単に識別できるようにします。
例:
Kaizen ~/so_test $ cat -e -t -v mk.t
all:ll$ ## here the $ is end of line ...
$
ll:ll.c $
^Igcc -c -Wall -Werror -02 c.c ll.c -o ll $@ $<$
## the ^I above means a tab was there before the action part, so this line is ok .
$
clean :$
\rm -fr ll$
## see here there is no ^I which means , tab is not present ....
## in this case you need to open the file again and edit/ensure a tab
## starts the action part