Live data from Hacker News

Why Use Make

bost.ocks.org

91–100 of 248 posts

Re: Why Use Make

#91
post #68

Earlier quoted context omitted.

Lots of "Don't do this" without suggesting alternatives doesn't do anyone much good. If you're on a *nix system, building C/C++ programs (or automating one-off builds like the example), what would you recommend in make's place?

I'd suggest tup[1] and Shake[2]. [1]: http://gittup.org/tup/ [2]: http://community.haskell.org/~ndm/shake/

also excellently documented... not like shake, at first

Re: Why Use Make

#92
post #87
post #83

Earlier quoted context omitted.

I'll have to respectfully disagree. IMHO, the utility of DSLs like Make is high when used very sparingly, for simple flows like the one the linked article describes. The more complex your Makefile, the less you should be using Make. If you need to write complete programs in Make, just stop bending over backwards and pick a real programming language. FWIW most non-trivial projects nowadays that use Make don't write ma…

Make is the assembly/C language of build system. Lots of other systems just generate makefile compatible files (qmake, cmake, premake, others), but often these fall into overly complex traps trying to explain everything both with simple unique words, and then clashing into these. Make is very optimal at the stage it is, everything above or below it it's just not that optimal.

As the assembly language of build systems, I agree that Make works well. But there, IMHO, its utility ends.

Re: Why Use Make

#93
post #9
post #3

Using make gets quickly really ugly. I wrote many Makefiles in my life and if you have to try to stick to GNU Make. At least it provides some basic functionality. But even that gets nasty quite soon when you need a simple thing like conditions with "and" or "or". If you have to write portable Makefiles ... well fsck. http://www.conifersystems.com/whitepapers/gnu-make/ There were recent discussions about adding GNU Gu…

Personally, I don't want a programming language in my makefiles. Unless working in a very codified environment (Java and Maven, for example), I think it is vital to keep your build system as simple as you can. If I absolutely need nontrivial logic in my makefile, I would much, much rather be forced to call out to a script file (because it encourages not doing that ). And if you insist on parking a programming languag…

I hear this sort of argument all the time (build systems, templating engines, config files, etc) and I'm not sure I agree with it anymore. Invariably people start adding features and you wnd up with horrible warty languages full of corner cases like make or shell.

Re: Why Use Make

#95
I like discussing build systems. However, personally I still come back to make all the time. There are certainly better alternatives (tup, shake, redo, etc), but make is simply available everywhere. It is available, if I use an OS which is a decade old. It will be available, if I use an OS in ten years from now.

I am writing this on Ubuntu LTS (12.04) and none of those three advanced build systems above is available from the default repos. This means a serious dependency burden, if somebody wants to build my stuff.

A few years ago, Jam was a promising build system. It seems to be dead now. Hopefully, tup and shake will stay longer.

Until you have good reasons against make, it is a perfectly fine initial solution.

Re: Why Use Make

#96
post #77

Absolutely do not use make for any new project. If you love make, it's a big, red, burning flag that you're not demanding enough of your tools and that you're not keeping up with changes in your ecosystem. There are many, many way better alternatives to make. Which one is better depends on the platform you're on. The majority of them throws in automatic dependency management for free. Yes, I know that the essence of…

If you are on a unix system, "redo" (designed by djb and implemented by apenwarr) is excellent. It's refreshingly simple and robust. And, there's a minimalist version called "do" which is a hundred-or-so lines of shell, that does a complete rebuild (no dependency tracking) - so you can package that with your project, and not have to worry about your users having to install yet another build system. Other alternatives…

For Unix-only and smaller projects another great option is fabricate.py

Re: Why Use Make

#98
post #9

Earlier quoted context omitted.

Personally, I don't want a programming language in my makefiles. Unless working in a very codified environment (Java and Maven, for example), I think it is vital to keep your build system as simple as you can. If I absolutely need nontrivial logic in my makefile, I would much, much rather be forced to call out to a script file (because it encourages not doing that ). And if you insist on parking a programming languag…

After using Rake (ruby with some dependency DSLish stuff) on a project for a solid year, I appreciate Make much more. Rake is too powerful and makes it too easy to keep a bunch of complex logic inside the Rakefile. Our project, left unchecked, turned the Rakefile into a pile of spaghetti. Make, on the other hand, being kind of crufty and inconvenient, encourages moving complex logic out of itself and into external sc…

What sort of issue did you run into. I am wondering if its osmething that could be solved by better modularization/sandboxing or if its more fundamental problems.

Re: Why Use Make

#99
post #25
post #14

Earlier quoted context omitted.

CMake generates Makefiles and it really is only good for building software while Make can be used for any number of complex tasks. I agree that if you need a build system use CMake it will make your life easy.

> use CMake it will make your life easy At the expense of your users. Okay, I know next to nothing about CMake. All I know is that it is extremely frustrating when I get the source to a project that uses CMake and then have to modify the CFLAGS or figure out why it can't find some include file. Of course, the same applies to makefiles generated by automake. Let's just write our makefiles by hand, people.

CMake honours the CFLAGS and CXXFLAGS environment variables, but only on the initial generation of CMakeCache.txt (first call to cmake in a new build directory). You can also edit them later using the GUI (but only by enabling advanced options) or by editing CMakeCache.txt.

But I can see why this is annoying to users.

Re: Why Use Make

#100
post #85

I think what you were looking for here is actually a shell script, rather than a Makefile. A shell script is much more suitable for general purpose programming. Or better yet, use Python ;-) And, let's admit it, for small projects dependency analysis is overrated (although it can be implemented easily enough in a real programming language).

One thing make allows you to do is incremental runs. For example, if the first step in your shell script costs 1/2 hour, you really don't want to run the shell script over and over again when you are debugging the next step. Yes, you can implement your own caching logic in your shell script, but its usually much better to use a tool specifically designed for that job.
Post reply on HN