.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
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |