The Great Makefile Debate: To Export, or not to Export

Post Thursday, 23rd August 2007 - Posted by Tom Bell

Another day, another debate. Todays debate was about the Makefiles in my AffinityOS project. The whole debate started due to the fact I use the following in my Makefile for the building of my cross-compiler.

export PATH=${PATH}:`pwd`/tools/cross-compiler/bin

When I explained the usage of the Makefiles. The following was said.

[08/23/07][17:30]< tulcod> using export for a kernel makes so much sense
[08/23/07][17:30]< tulcod> </sarcasm>

This immediately tells me that he doesn't understand the point of the export in the Makefile. For those of you who wish to know, the export appends the binary directory of the compiled cross-compiler to the path, so that the Makefiles can execute the compiled binaries.

[08/23/07][17:32]< tulcod> tomb|work: that's a little bit illogical imo, but that's just my opinion
[08/23/07][17:34]< tulcod> so from what you're telling me, it sounds a bit illogical

So, he's already admitted that it's his opinion that he finds it illogical. Apprently installing shouldn't be part of the building process, why? He didn't explain why, he just said it. I fail to see how this affects anything.

[08/23/07][17:34]< tulcod> tomb|work: installing an application should not be part of the building process
[08/23/07][17:35]< tulcod> plus, the build dir generally gets removed

They don't get installed into the build directory, they're just build in the build directory. Also the cross-compiler directory can be removed.

[08/23/07][17:35]< tulcod> tomb|work: like I said, that can be removed.

Why would a person building the cross-compiler delete the directory containing the cross-compiler they just built? Another point I fail to see.

[08/23/07][17:36]< tulcod> tomb|work: and that's not totally into the philosphy of makefiles and stuff, so that's the slightly illogical point

Now the philosphy of Makefiles is to delete the directory you just installed the cross-compiler into. I think that his point is the slightly illogical one. This iterates more the point that he doesn't understand my Makefiles, but feels he has the sufficient knowledge to comment on them.

[08/23/07][17:38]<@tomb|work> but if you're going to build affinityos you're going to want to add the bin dir to the path
[08/23/07][17:38]< tulcod> tomb|work: which is wrong, cause that might get deleted

Obviously it might be deleted, but the directory the binaries are installed to won't get deleted unless the user specifically deletes it, the Makefile doesn't touch it apart from installing the cross-compiler into it. Why would the user delete a directory they are going to use? More reiteration he fails to understand my system.

The next part is interesting, he changes his point altogether suggesting that I use relative paths to the cross-compiler in my Makefiles. But I thought that directory could be deleted?

[08/23/07][17:38]< tulcod> tomb|work: then why use export at all?
[08/23/07][17:38]< tulcod> tomb|work: it could just refer to relative directories, no?

So I disproved his first point so he changes to a completely different point. Why not include the relative path in the Makefiles! Now this is an interesting point with a variety of flaws as I point out, but he fails to accept.

[08/23/07][17:39]< tulcod> why can't the build script of affinityos refer to the recently built build-tools relatively instead of having to use export?

I will now outline the flaws in his point of hardcoding the paths into each Makefile that needs to call the compiler, instead of calling a compiler in the path.

  • Requires hardcoding the path in each Makefile that needs to call the compiler, where as the export method only requires the name of the binary
  • If the directory structure changes and affects the location of the cross-compiler directory, every Makefile with the relative path hardcoded into it will need editing, where as the export method requires zero editing.

I asked him why he says export is bad, and he replies with the funniest answer.

[08/23/07][17:46]<@tomb|work> so why is export bad
[08/23/07][17:46]< tulcod> 1. cause it's useless
[08/23/07][17:46]<@tomb|work> why
[08/23/07][17:46]< tulcod> :-/
[08/23/07][17:46]< tulcod> cause you can use relative paths

Please see the above list as to why relative paths are a bad idea for this project. Now we get to the point where I start pointing out the flaws with his point.

[08/23/07][17:48]<@tomb|work> if I modify my dir structure
[08/23/07][17:48]< tulcod> explain how it's better than export
[08/23/07][17:48]<@tomb|work> I have to edit every makefile
[08/23/07][17:48]< tulcod> nope
[08/23/07][17:48]< tulcod> use variables

Use variables? Would I, or would I not still need to edit the variables with the new path, yes, yes I would. Point disproved.

[08/23/07][17:51]< tulcod> tomb|work: using export means you're either going to run a program or initializing bash (or ayn other shell)

He got one thing right, yes I will be running a program... The cross-compiler I just built. So he disproves his own point. So I tell him what he said just makes no sense, and he comes back to the variables and hardcoded relative stuff point.

[08/23/07][17:51]<@tomb|work> I am going to run a program
[08/23/07][17:51]<@tomb|work> the cross-compiler I just built
[08/23/07][17:51]< tulcod> tomb|work: :-/
[08/23/07][17:51]<@tomb|work> make build-tools
[08/23/07][17:51]< tulcod> tomb|work: once again, why can't you use relative paths for it?
[08/23/07][17:51]<@tomb|work> tulcod, because you would have to hardcde the path into each makefile
[08/23/07][17:52]< tulcod> tomb|work: those variables aren't exactly hardcoded...
[08/23/07][17:52]<@tomb|work> instead of having a top level makefile with CC=i586-elf-gcc etc
[08/23/07][17:52]<@tomb|work> tulcod, they're all different
[08/23/07][17:52]<@tomb|work> there are multiple depths of makefile

How are those variables not hardcoded, where are they getting the relative path from without using a bunch of commands, which make the building less efficient.

Now I explain how this is a pointless debate because he won't accept that his point is fact and is flawed. If his point was logical and made sense I would accept it, however he continues to believe that his point is right, and mine is flawed.

[08/23/07][17:56]< tulcod> while this flaw can be proven scientifically

Apprently this flaw of it's useless can be scientifically proven. I would like to see the logic behind that, after I proved that his method has more flaws. And his proof for this is the following statement.

[08/23/07][17:56]< tulcod> you can use relative paths using variables

Wow! The point that I proved had multiple flaws is proof that my way is flawed. He is working some amazing logic here. I explain the flaws to him once again, to which he just tries to reiterate his point more.

[08/23/07][17:58]< tulcod> tomb|work: it's much easier, that's something different

Apprently now he believes if something is harder that it is better. I fail to see the logic in this argument, but then again he's a Gentoo user, and they all like it hard. I choose to ask why export is useless.

[08/23/07][17:59]<@tomb|work> why is export useless again?
[08/23/07][17:59]< tulcod> tomb|work: cause there's better ways, as I explained

But didn't I just prove all those 'better' ways to have major flaws? i think he's failing to accept the fact that he has been proven wrong. I ask him to explain how it adds flexibility like he says, but he told me to just go learn about Unix. Wait what does Unix have to do with this? Yes, that's right nothing. More beating around the bush on his part.

The rest of this 'debate' involved me explaining how his points are valid, but flawed, however he keep insisting that they are the better way, even after I proved them all to be flawed.

The moral of this rant is that if you seriously believe that you're right, at least be able to back up your points logically.

Tags tags: affinityos debate rant