How important is it to learn makefiles? [closed]

I work in c++ mostly as a hobby (I’m still in school and therefor don’t have a real job). The IDEs generate the makefile for me and so I’m wondering if it’s worth learning how to make them myself. By “worth learning” I mean, should I drop everything and learn how to write them before continuing to learn c++? Is learning them going to be really necessary? If so, should I learn about them (general syntax and understanding how they work etc.) or really learn how to write them?

3

Yes, it is definitely worth understanding how Makefiles work. It might not be relevant to you right now (because you are using an IDE that generates them), but the chances are that the knowledge will be useful in the future.

By “worth learning” I mean, should I drop everything and learn how to write them before continuing to learn c++?

Frankly, that is a bizarre notion of “worth learning” …

But no I don’t think you need to do that.

Is learning them going to be really necessary?

We cannot predict whether you are really going to need this knowledge in the future. It depends on whether you continue with C++ programming and what context you do it in.

If so, should I learn about them (general syntax and understanding how they work etc.) or really learn how to write them?

I’d recommend both. If you can’t write a Makefile, it is debatable that you know what is going on.

There is the other viewpoint which says that too much knowledge is not helpful.

If you get deeply into this you will learn that there are many different versions of Make, and that writing a complicated Makefile that works with multiple versions of Make on multiple platforms is … hard. However, in the open source world, it is “best practice” to use tools such as automake, autoconf and so on to generate the makefiles, etc. If you do that, a lot of the version / platform related complexity is dealt with behind the scenes.


Finally, you tagged the question with “java”. My take is that you shouldn’t use make to build Java applications (unless you are building native code libraries as well). There are Java specific build tools that are much easier to use … and do a better job than make. (Ant, Maven, and Gradle are obvious candidates.)

If you’re working with open source or Unix-like operating systems, yes. Take heart though, they’re not that complicated. Learning make will save you a lot of time in the long run.

3

Makefiles are important on UNIX systems (e.g. AIX, Linux, OS X). However, I think that their absolute “you gotta know it” importance has diminished in recent years. For example, you don’t really find them in Windows development (Visual Studio, etc.) and XCode (on OS X) uses a different system altogether. I’m not much into Java, but there I think they use ant files and whatnot.

There is a very cool system called CMake that generates native build files for the operating system that you happen to be running on. For example, if you write your project specification in CMake, then you can create a Visual Studio build project on Windows, an XCode project on Mac, and a Makefile on Linux. In a way, CMake replaces autoconf and automake.

I usually create CMake files for my “big projects” but I know Make in case I want to write a quick “just get it done” Makefile. It’s good for your cultural literacy, because there are tons and tons of software libraries that use Makefiles, and you will inevitably need to edit the specific compilers and library locations. But you will find that big projects (like KDE) are migrating toward CMake and the like since Make does have some limitations that rear their ugly head when projects get complicated.

1

I’m bias as i think makefiles are a terrible system. You should learn general syntax so you can modifying an existing makefile. But i don’t think learning everything about it nor making one from scratch is useful.

3

As with many aspects of IDE output, a typical auto-generated makefile is often inefficiently structured.

With an appropriate level of understanding, it is often possible to significantly improve the performance (faster builds etc). However, unless you really know what’s going on, you are more likely to FUBAR, when fiddling with an autogen-ed file.

I highly recommend being able to understand what is going on… whether you subsequently choose to start editing an existing one, or creating your own, is a separate issue.

Being able to successfully use make or something like it lets you check the “understands how to model the dependencies between parts of a program composed of more than one module” box.

Learning how to write Makefiles is a good idea for a number of reasons.

  1. Make is a language which lets you encode dependencies between components via rules. You will get a lot of experience with writing code this way, and it broadens your tools for thinking about solving programming problems.
  2. The principles you learn with Make can be used with Ant, Maven, and Rake if you choose to learn programming in the Java or Ruby world.
  3. Many IDEs have magic files which carry configuration information to help you build your software. If you don’t believe me, try to write a script to build your software without the IDE. When you write your own Makefiles, you become very aware of the dependencies between your code, libraries, and your environment variables. As systems get larger, this turns out to be a useful tool for debugging your system.

You should always try to understand the build system you are using.

That does not necessarily mean you have to be able to create all of the build files by hand.
The important part is understanding what the build system is doing for your project and the general ability to compile small projects manually (as in “typing commands on a terminal”).

I just tend to think that creating (simple) Makefiles is the easiest step to understand what is going on, but you might have other means of understanding how to build things.

Why/when to learn Makefiles

If you keep programming for Windows only and don’t expect anybody else to compile your code, feel free to compile the code how you like.

If you want to program compiler agnostic (as in “let others decide what compiler or IDE they want to use”), then you should learn another build system than just letting your IDE “deal with it”.

If you want to program for different platforms, then you certainly need to use a widespread build system.

That still doesn’t mean you have to know how the autogenerated Makefiles work in detail.
You just have to know how the input files for the build system work.
These just happen to have a similar syntax sometimes.


I personally really like Makefiles and use them for many things. Not just compiling code.
I create a Makefile for every bigger pdf I create (with LaTeX) and every project I need to automate a couple of tasks in (building, packaging, uploading, updating dependencies from source repositories, pull/push manual backups)

However, I am working on the terminal a lot and I am working with Linux.
I don’t use what you would call an IDE other than vim (powerful text editor) and console tools.
This might be very different for you.

If you ever complained about having to run different re-occuring commands just to “update”/package/upload/.. a “project”,
then learning how to write Makefiles might be something helpful for you.

If you have and use tools/GUIs/IDEs for everything,
then you might not get anything out of that knowledge.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật