4918
5880
3万
GROAD
曲径通幽,安觅芳踪。
.c.o: $(CC) -c -o $@ $<
beyes@linux-beyes:~/C/Make/Suffix_Rule> ls Makefile test1.c test2.c test3.c test.c
#include <stdio.h> int main (void) { printf ("test:hello makefile\n"); test1 (); test2 (); test3 (); return (0); }
#include <stdio.h> int test1 (void) { printf ("test1:hello makefile\n"); return (0); }
#include <stdio.h> int test1 (void) { printf ("test2:hello makefile\n"); return (0); }
#include <stdio.h> int test1 (void) { printf ("test3:hello makefile\n"); return (0); }
CC=gcc OBJS=test.o test1.o test2.o test3.o test.exe:$(OBJS) $(CC) -o $@ $^ .c.o: $(CC) -c -o $@ $<
beyes@linux-beyes:~/C/Make/Suffix_Rule> make gcc -c -o test.o test.c gcc -c -o test1.o test1.c gcc -c -o test2.o test2.c gcc -c -o test3.o test3.c gcc -o test.exe test.o test1.o test2.o test3.o
beyes@linux-beyes:~/C/Make/Suffix_Rule> ./test.exe test:hello makefile test1:hello makefile test2:hello makefile test3:hello makefile
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )
GMT+8, 2024-5-19 14:02 , Processed in 0.068027 second(s), 22 queries .
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.