|
makefile
main: main.o mytool1.o mytool2.o
gcc - o main main.o mytool1.o mytool2.o
main.o: main.c mytool1.h mytool2.h
gcc - c main.c
mytool1.o: mytool1.c mytool1.h
gcc - c mytool1.c
mytool2.o:mytool2.c mytool2, h
gcc -c mytool2.c
main.c
#include"mytool1.h"
#include"mytool2.h"
int
main (int argc, char **argv)
{
mytools1_print ("hello");
mytools2_print ("hello");
return 0;
}
/*mytool1.c*/
#include "mytool1.h"
void
mytool1_print (char *print_str)
{
printf ("this is mytool1 print %s\n", print_str);
}
/*mytool1.h*/
#ifndef_MYTOOL_1_H
#define_MYTOOL_1_H
void mytool1_print(char *print_str);
#endif
/*mytool2.c*/
#include "mytool2.h"
void
mytool2_print (char *print_str)
{
printf ("this is mytool2 print %s\n", print_str);
}
/*mytool2.h*/
#ifndef_MYTOOL_2_H
#define_MYTOOL_2_H
void mytool2_print(char *print_str);
#endif
makefile:2: *** 遗漏分隔符 。 停止。 |
|