日期:2014-05-16  浏览次数:20606 次

这个程序如何写makefile?
main.c:
C/C++ code
#include "def1.h"

extern void function2();
extern void function3();

int main()
{
    function2();
    function3();
    //exit(EXIT_SUCCESS);
}


f1.c:
C/C++ code
#include "def2.h"
#include "def3.h"

void function3() 
{printf("aaabbbccc");
}


f2.c:
C/C++ code
#include "def2.h"
#include "def3.h"

void function3() 
{
}


f3.c:
C/C++ code
#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
------解决方案--------------------
探讨

main:main.c f1.c f2.c f3.c
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

这样就可以
------解决方案--------------------
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

这样更好