当前位置: 技术问答>linux和unix
这个程序如何写makefile?
来源: 互联网 发布时间:2017-01-06
本文导语: main.c: #include "def1.h" extern void function2(); extern void function3(); int main() { function2(); function3(); //exit(EXIT_SUCCESS); } f1.c: #include "def2.h" #include "def3.h" void function3() {printf("aaabbbccc"); } f2.c: #include "def2.h" #include "def3.h" ...
main.c:
f1.c:
f2.c:
f3.c:
#include "def1.h"
extern void function2();
extern void function3();
int main()
{
function2();
function3();
//exit(EXIT_SUCCESS);
}
f1.c:
#include "def2.h"
#include "def3.h"
void function3()
{printf("aaabbbccc");
}
f2.c:
#include "def2.h"
#include "def3.h"
void function3()
{
}
f3.c:
#include "def1.h"
#include "def2.h"
void function2()
{
}
|
main:main.c f1.c f2.c f3.c
cc -o main main.c f1.c f2.c f3.c
clean:
@rm -rf main
cc -o main main.c f1.c f2.c f3.c
clean:
@rm -rf main
|
把头文件也加上吧
|
main:main.c f1.c f2.c f3.c
cc -o main main.c f1.c f2.c f3.c
clean:
@rm -rf main
这样就可以
cc -o main main.c f1.c f2.c f3.c
clean:
@rm -rf main
这样就可以
|
main:main.c f1.c f2.c f3.c def1.h def2.h def3.h
cc -o main main.c f1.c f2.c f3.c
clean:
@rm -rf main
这样更好
cc -o main main.c f1.c f2.c f3.c
clean:
@rm -rf main
这样更好