Friday, October 9, 2009

Some things that i should have learnt way before...

There was nothing much to keep me occupied in the past month to post about it. Creating Makefile was one of the thing that came across after idling for long time.
So here is the way you do it, how ever the complete tutorial about it could be found at
http://www.gnu.org/software/make/manual/make.html

Here are a few simple sample files for make

/**
*main.c
*/

#include "stdio.h"
int main()
{
printf("main");
two();
return 0;
}

/**
*two.c
*/

#include "stdio.h"
#include "header.h"

int two(){
printf("two %d", N);
return 0;
}


/**
*header.h
*/

#define N 100


#Makefile

objects = main.o\
two.o
edit : $(objects)
gcc -o edit $(objects)

two.o : header.h
.PHONY : clean

clean :
rm edit $(objects)

#end Makefile

how ever a better insight could be obtained by glancing through the URL though ;)

No comments:

Post a Comment