Let me begin by telling you a little story. Some time ago I needed to run a script at work once a day. We had tons of machines ranging from big Unix servers to Linux desktops. Due to various reasons the script could only be run on a desktop machine. However using cron was disabled on desktops. All other machines allowed cron.
Permalink for comment 231670
To read all comments associated with this story, please click here.
On Linux/Unix, makefiles are used to specify which files depends on which files. This is considered like "state-of-the-art" because you don't have to type in a HUGE command line with all your program's files every time you want to compile something. And also only the modified files are recompiled. Really a good idea.
Of course, writing makefiles turned out to be almost as bad as tucking the compilation commands into a shell script. So someone invented a makefile generator. And this makefile generator needed a configuration file for each project... (I bet you see where this is heading.)
As programmers used the makefile generator instead of writing the makefiles themselves, they became less comfortable with editing the makefiles, and as more and more non-programmers needed to compile programs on different systems, editing makefiles didn't look like a good idea any more. Especially with all the different configurations in different Linux distros and on different desktops and servers, which made makefile editing necessary more often. The solution? Make the makefile generator generate a shell script that generated the makefile.
So, instead of writing a makefile ("config file for make"), we now write a config file for the makefile generator generator. Nice improvement.
So why are makefiles needed at all? Partially because of another hack: header files, partially I don't know why. Pascal does not need makefiles at all. A pascal compiler can automatically find out which files need recompilation and links the object files together automatically.
One command and the library path in the global configuration file is all that is needed to build an entire project. Why does C have to make it so hard?
Member since:
2006-06-24
On Linux/Unix, makefiles are used to specify which files depends on which files. This is considered like "state-of-the-art" because you don't have to type in a HUGE command line with all your program's files every time you want to compile something. And also only the modified files are recompiled. Really a good idea.
Of course, writing makefiles turned out to be almost as bad as tucking the compilation commands into a shell script. So someone invented a makefile generator. And this makefile generator needed a configuration file for each project... (I bet you see where this is heading.)
As programmers used the makefile generator instead of writing the makefiles themselves, they became less comfortable with editing the makefiles, and as more and more non-programmers needed to compile programs on different systems, editing makefiles didn't look like a good idea any more. Especially with all the different configurations in different Linux distros and on different desktops and servers, which made makefile editing necessary more often. The solution? Make the makefile generator generate a shell script that generated the makefile.
So, instead of writing a makefile ("config file for make"), we now write a config file for the makefile generator generator. Nice improvement.
So why are makefiles needed at all? Partially because of another hack: header files, partially I don't know why. Pascal does not need makefiles at all. A pascal compiler can automatically find out which files need recompilation and links the object files together automatically.
One command and the library path in the global configuration file is all that is needed to build an entire project. Why does C have to make it so hard?