makefile文件制作入门
makefile文件制作入门
一、首先,看一下最简单的C文件 //hello.c文件 #include void main() { printf("hello world\n"); } 为hello.c编写makefile文件,这里用gcc编译- $vi makefile
- hello:hello.c
- gcc -o hello hello.c
- hello:hello.o
- gcc -o hello hello.o
- hello.o:hello.c
- gcc -c hello.c
makefile文件如下:
- main:main.o file1.o file2.o
- gcc -o main main.o file1.o file2.o
- main.o:main.c file1.h file2.h
- gcc -c main.c
- file1.o:file1.h file1.c
- gcc -c file1.c
- file2.o:file2.h file2.c
- gcc -c file2.c
评论暂时关闭