Those makefiles...
I must be stupid! I've been reading the docs on make, automake, and autoconf. Why is it so complicated?
Do you have any advice on how to get the knack of it? For me it's just a big puzzle. |
use an ide that makes them for you. they are pretty standard really.
|
Kdevelop can make one for you...
|
I doubt that you are stupid. make is not easy! People have complained loud and long about make and there have been countless attempts to replace it or cover it up with a gui project manager, but it is like a bad penny; it just won't go away.
If you break it down, a simple rule for make is: Code:
<target> : <dependency list> Each rule is reduced by checking the depedency list and the target. If any dependency target is missing, find the rule for that target and reduce it. When all dependencies are present, and the target is present, and the target is older than any of the dependencies, execute the command list. If the target is newer than any dependency, no action is required and the rule is satisfied. The first rule that is evaluated is the first rule in the make file or the rule for the target specified on the make command ("make all"). The only other rules that are evaluated are targets from that dependency list which in turn may have dependent targets, which in turn... Most confusion comes from the default rules that are builtins for make. "make -p" will display all of the builtins. For instance, one default is: Code:
.c.o : Code:
xxxx.o : xxxx.c Another default rule is: Code:
.c : If you think your problem is with the default rules, add this line to your makefile: ".SUFFIXES :". This deletes all suffix rules and only uses the rules from the makefile. "make -r" does the same thing. Use "make -n" to show the commands that will be executed by make without actually executing the commands. Use "make -d" to show all of the steps make takes in evaluating the rules and resolving dependencies. This has a lot of output, but it does show exactly what is going on. mumble, mumble, mumble... |
Thank you! I will use the Kdev-IDE to generate all files, so that I can give them a close study. :study:
And then some day, I will create a project management utility to end this miserable situation. |
Thanks, Malicious! Perhaps there is no simple solution. Some people say that the configure and make files are only going more complex...
|
nah, don't use that, anjuta is much much nicer
|
I highly recommend "Linux Programming Unleashed 2nd Edition". There is a complete chapter on the subject with some very easy examples. I was writing my own Makefiles before I even finished it. At www.amazon.com, you can get factory seconds for less then $15 US.
For an example of what kind of book it is, see my post here: Why won't this simple program compile? Any text book is bound to have some errors. :D |
Rules.make
Can anybody tell me what is the significance of Rules.make file which is sometimes included in a Makefile..
When it is used and Why? and where can I find the nice tutorial on it? |
|
don't worry.
make does take a long time to get the hang of. It did me too ;) |
All times are GMT -5. The time now is 11:15 AM. |