3
所以我創建了一個規則來將所有.c文件轉換爲.o文件。我使用變量$
將規則的右側放入配方中。左邊是$ @,但右邊是空的。我記得我用$
做了一個類似的Makefile,它工作。
CFLAGS =-c -g
all:server client
server:server.o
gcc -o server server.o
client:client.o
gcc -o client client.o
clean:
rm *.o server client
%.o:%.c
gcc ${CFLAGS} -o [email protected] $
server.o : server.c
client.o : client.c
謝謝。這樣可行。我正在從一本書中學習,似乎錯過了'<'字符。 – Amumu