1 CC=gcc
2 libs_for_gcc = -lgnu
3 normal_libs =
4 ok: ok.o
5 ifeq ($(CC),gcc)
6 $(CC) -o ok ok.o $(libs_for_gcc)
7 else
8 $(CC) -o ok ok.o $(normal_libs)
9 endif
make:
gcc -o ok ok.o -lgnu
/usr/bin/ld: cannot find -lgnu
collect2: error: ld returned 1 exit status
test:6: recipe for target 'ok' failed
make: *** [ok] Error 1
先看系統有沒有lgnu的庫,然後就是u路徑設置一下。-L