Walter Bright wrote:
Georg Wrede wrote:
'Round here we say "maassa maan tavalla", which is probably something like "When in Rome, do like the Romans do".

Makefiles aren't just a C(++) thing. Unix has a culture of its own, Windows (I wouldn't say have a culture, but still) does it another way. So do we import the Unix way to Windows or the other way around? I'd go with the Romans in Rome.

If there were a vote (outside of this NG!!) with D users, probably there are more folks who write in D /and/ in C or another language /on their own/ OS, than folks who write D apps (big enough to need makefiles) for both Windows and Linux.


There is no standard for makefiles, I've run across dozens of different make programs that use different syntax and have different extensions. So, if you're going to have the same makefile across systems, you have to start with finding a make program that is fairly identical across those systems.

Then you have the \ vs / problems. Some people assure me that Windows now works flawlessly with /, but that simply isn't so. I keep running into odd cases where it doesn't, so I don't use / on Windows.

File name case sensitivity differs.

The command line utilities called by makefiles differ in their names, switches, and how they work.

dmd's flags are the same. Other than that, you only need to configure how files are deleted and how the C compiler is invoked.

.o on Linux, .obj on Windows.

OBJSUFFIX_win32 = .obj
OBJSUFFIX_linux = .o
...
OS = linux
...
... file$(OBJSUFFIX_$(OS)) ...

nothing on Linux, .exe on Windows.

See above.

.a on Linux, .lib on Windows.

See above.

It just goes on and on.

No. At some point it stops and you are gained by understanding where OS matters for your product and how.

You could try and parameterize all of it, but then the makefile becomes an inscrutable mess. You could have scripts generate makefiles, embed scripts in the makefiles, etc., but is this really worthwhile? It's just a makefile. I spend almost zero time on them. I like them simple even if that means they're more verbose.

This is because you don't really need to. I work on Phobos a fair amount, and I don't want to update four-odd places whenever I add a module. There is something to be said about once and only once. I've overhauled Phobos' makefile twice, and every time I've been gained by it.

And again this brings a basic disagreement I have about making a hodge-podge of particular cases instead of searching the higher ground of proper abstraction.

More code in makefiles doesn't necessarily improve things quite a lot. druntime has a lot of makefiles; apparently every single blessed thing has a makefile dedicated to it. But that complicates things without benefit.


Andrei

Reply via email to