I have recently began studying Makefiles in Linux. I have ample experience developing applications with advanced IDEs, such as Visual Studio.
My first impression and query after reading a few tutorials: is there any need to study Makefiles? Perhaps the IDEs are using it internally, but is this something everyone should learn eventually?
3
Yes, even if you don’t use them often, it’s good to know how and why things work the way they do. Some environments may not support IDEs as such or the IDE for a new language might be immature or non-existent. You can also make a script that triggers a makefile, thereby allowing code that can autocompile without human intervention. Thus knowing how to make fully working programs out of many pieces is a good skill to have; even if you mostly use the autopilot version.
1
There are an unlimited number of things to learn with an unlimited depth to which they can be learned.
Since you will </life>
far before you learn it all, you need to prioritize which you will focus on.
If you are a windows developer using windows tools, then learning unix makefiles may not be a big advantage. If you are a c
developer on any platform, it is probably a good idea.
Keep in mind different platforms and languages have different approaches to the same problem, eg apache ant
with java.
So it really depends on where you are headed in your career/learning. IMO, becoming an expert at version control software (eg, git) is one of the best things any software engineer can do, if they haven’t already.
Yes, if you need advanced build options.
Visual Studio autogen project files, such as .csproj.
.csproj itself is a kind of XML-style makefile.
You can use a text editor to edit and customize .csproj if you need advanced options.
If you study MSBuild carefully, you will find that there are similar concepts to Makefile.
Build targets, include list of files, define properties, etc …
Yes. Because IDE’s may not be helpful if you want to do automation. One of the Joel’s test is one button automatic build. Makefiles can produce that. Also such build can also be fired from the remote machine, without much hassles.
I am not aware of power of IDEs on linux, but Makefile also helps in doing more stuffs than pure compile. They can also be used for installation, dependency check, and pre-compile installation. You can also combine them with shell scripts, and do multiple builds.
An IDE and an Automated Build System have different purposes. An IDE is useful when your are developing the software and want to compile the code ect. An Automated Build System is useful when you want to Automate the building and compiling.
There are many situations in which an Automated System would help you out:
-
Do you have a large project with a large number of developers contributing to your source control? How do you create a latest compiled build? Do you expect someone to be in-charge of compiling the latest version in their IDE?
-
Does your project depend on some library that is developed by someone else on a different timeline? How do you manage their updates? Do you have to update that reference in your project manually and then build?
-
Very often a project will have several different components. For example a web service and a Desktop and Mobile Client. What if you have some resources, say string values, or images that are common in all of them? How will you manage the updates in them? You wouldn’t want to hunt down all of the references in your different projects and update them manually.
Makefiles in linux, are only one example of Automated Build system. There are several option for this even in the .NET world.
Though using and configuring such systems are strictly not necessary, you’ll organize and streamline your development a lot if you learn and use these systems.