|
From: Daniel G. <sp...@ho...> - 2002-04-10 14:13:51
|
THANKS!!! Great explanation, very clear! I have the idea now! Thanks again, Daniel >From: Luigi Santillo <gi...@li...> >To: dev...@so... >Subject: Re: [Dev-C++] A basic q... >Date: Wed, 10 Apr 2002 07:57:04 +0200 > >Hello Daniel, > >A makefile is a set of instructions (a program if you wish) that will be >interpreted by a program generally known as "make". > >"make" is a general tool, not strictly related to programming languages, >but undoubtedly one is likely to run into it when dealing with "compiled" >programming languages. > >Here is what I mean. > >Consider the classic "BASIC" programming language (hope you know a little >about it), a program written with such language is a set of instructions >which a BASIC interpreter reads and executes, one at a time, each time you >run the program. There is no executable file and to run a program you >always need: the source code and the interpreter. Also, if a program has >syntax errors, you will find out about them, only when the interpreter >executes the offending line of code; in fact only at that time it will >realize that the instruction is wrong. > >Consider instead a C (or C++) program (I mean here what is known as a >statically linked program, that is, one which does not use any DLL). You >write the source code, a compiler will then translate it into an object >file which a linker will use to make an executable file. Thus the program >is translated into machine code only once (and not each time you execute >the program), also to execute the program, you only need the executable >file (often called the binary file) and nothing else (this of course is not >true of dynamically linked programs, which also require the right DLLs). >Since to run a program, you must have compiled already *all* the >instructions, if there are syntax errors, you will find out about them, at >compile time, no instruction will be executed if there are syntax errors. > >Now here is the reason why one uses "make" with compiled programming >languages: >say that one writes some source code and then compiles it, making the >corresponding executable file, now suppose that he makes some changes to >the source code, what happens is that the executable file no longer >corresponds to the source. This never happens with interpreted languages, >because, as I said, there is no executable file for those languages. > >The classic way (don't know how many still use it) to keep a binary up to >date is to use "make". Roughly, What "make" does is the following: >- read the time stamp of the binary file >- read the time of the corresponding source file >- if the source happens to be "younger" that the binary, this latter is >out-of-date > >When the binary is out of date, the actions needed to update it will be >performed, by "make". > >Things are a bit more complicated when a program is made of code spread >across different source files, but the basic idea is the same. > >At this point you could ask: >- How does "make" know which source file is the one used to compile some >binary file? >- How does it know which are the actions to update a binary file? > >Well, you put these informations in a text file, named "makefile", >arranging them in some special way (just the syntax understood by "make"). > >The above is, I hope, the frame of the picture: if you wish to fill it with >details, you could start by reading the manual of the GNU "make" (I've >found it on the Dev-C++ resource site). > >At 14:13 09/04/02 +0100, Daniel Glenfield wrote: >>I have gaps in my knowledge lol. >>What's a MAKE file, and what does it do? > > > > >-- >Luigi >gi...@li... > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |