优化了命名
This commit is contained in:
13
C10-Makefile/testmake/main.c
Normal file
13
C10-Makefile/testmake/main.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tool1.h"
|
||||
#include "tool2.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
mytool1();
|
||||
mytool2();
|
||||
|
||||
return 0;
|
||||
}
|
||||
12
C10-Makefile/testmake/makefile
Normal file
12
C10-Makefile/testmake/makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
OBJS=main.o tool1.o tool2.o
|
||||
CC=gcc
|
||||
CFLAGS+=-c -Wall -g
|
||||
|
||||
mytool:$(OBJS)
|
||||
$(CC) $^ -o $@
|
||||
|
||||
%.o:%.c
|
||||
$(CC) $^ $(CFLAGS) -o $@
|
||||
|
||||
clean:
|
||||
$(RM) *.o mytool -r
|
||||
9
C10-Makefile/testmake/tool1.c
Normal file
9
C10-Makefile/testmake/tool1.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tool1.h"
|
||||
|
||||
void mytool1(void)
|
||||
{
|
||||
printf("tool1 print\n");
|
||||
}
|
||||
6
C10-Makefile/testmake/tool1.h
Normal file
6
C10-Makefile/testmake/tool1.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef TOOL1_H__
|
||||
#define TOOL1_H__
|
||||
|
||||
void mytool1(void);
|
||||
|
||||
#endif
|
||||
9
C10-Makefile/testmake/tool2.c
Normal file
9
C10-Makefile/testmake/tool2.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tool2.h"
|
||||
|
||||
void mytool2(void)
|
||||
{
|
||||
printf("tool2 print\n");
|
||||
}
|
||||
6
C10-Makefile/testmake/tool2.h
Normal file
6
C10-Makefile/testmake/tool2.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef TOOL2_H__
|
||||
#define TOOL2_H__
|
||||
|
||||
void mytool2(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user