views:

72

answers:

4

a linker receives obj's and lib's to create exe's or other libs. But so does a makefile(but it can start from sources on top of that). what is the difference between the two?

+4  A: 

No, a Makefile does not.

A Makefile is essentially a script to tell the make program what files to send to what programs as part of the build file.

So, a Makefile can invoke the compiler, linker, etc with the appropriate source files/object files, but it doesn't actually do the work itself.

I think you have missed the whole concept of a Makefile, so I suggest you do some further reading.

Dan McGrath
+1  A: 

A linker and a makefile have almost nothing in common. A makefile is a set of instructions used by make. They can be instructions that build a program, install some files, or whatever you want make to do. A linker is a program that takes object files as input and combines them into an output executable (or shared library).

Carl Norum
+1  A: 

A makefile is just some kind of ruleset that defines what needs to be compiled and which compiling process depends on what. That way the make software can automate the process.

Using make and makefiles however does not mean that you are not using a regular compiler and linker. So basically those will still run, you just don't need to run it yourself, but define the process before in the makefile.

poke
+1  A: 

Make uses a makefile to evaluate a set of rules on whether to invoke the compiler on a source file (due to it changing, most likely) and eventually invoke the linker to create final object file.

You can read more about make here: http://www.gnu.org/software/make/

Skcus Isc