Sunday, July 29, 2007

Makefile continued..

After reading my previous post you guys might have got a good understaning of makefile.

Let met put my understanding in this way.

Makefile has mainly 3 parts.
(1)target
(2)dependencies and
(3)rules

and format is like this
target: dependencies
rules

each dependency can be another target :)
for example say our final target is linux and we have two librarries lib1.o and lib2.o as dependencies for linux


makefile looks like this

linux: lib1.o lib2.o
gcc -g lib1.o lib2.o #(this is a comment) A tab is required before gcc
lib1.o: lib1.c
gcc -g -c lib1.c
lib2.o: lib2.c
gcc -g -c lib2.c



tryout this guys..lemme do a char device driver in da mean time.

No comments: