Live data from Hacker News

Why Use Make

bost.ocks.org

21–30 of 248 posts

Re: Why Use Make

#22
Most systems I use have GNU make 3.81 installed. GNU make 3.81 added the special target .ONESHELL which makes code like the following possible. I'm not sure if it is a good idea, but it does remove the dependency that make has on shell programming.

    .ONESHELL:

    SHELL = /usr/bin/python

    VAR := lorem ipsum

    all:
        @
        import re
        
        n = 3
        
        print('make variable: $(VAR)')
        print('local variable n: {}'.format(n))
        
        rx = re.compile('\d+')
        s = 'foo 17'

        m = rx.search(s)
        if m:
          print('has number: {}'.format(s))
        else:
          print('no number: {}'.format(s))

Re: Why Use Make

#24
scons is a good alternative to make. Make is ok for small projects, but it gets ugly pretty quick...and it allows you to make mistakes easily...

Re: Why Use Make

#25
post #14
post #5

You should use CMake.

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.

Re: Why Use Make

#26
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 the post is "use a build system". I agree completely. In fact, script everything. Then script your scripts. Then refactor your scripts because they are getting messy. But don't give impressionable souls the idea that "make" is anywhere near an acceptable (generalised, default) choice today.

Re: Why Use Make

#27
post #16
post #8

Earlier quoted context omitted.

Have you tried Waf? http://code.google.com/p/waf/ Seems like it might be a good fit.

How does Waf compare to SCons? I'm a big fan of SCons, although it annoyingly does not have transitive dependency resolution for libraries. Waf has this functionality, correct?

I haven't used Waf either, but some information is here:

www.scons.org/wiki/SconsVsOtherBuildTools

Re: Why Use Make

#28
To everyone with alternatives to make:

Make is easy to learn.

It simplifies a slightly complex task.

Other build tools have a steeper learning curve. If they're more complex than the problem being solved, people won't want to adopt them.

When things get complex, there's the GNU make manual and libraries.

When you have to target multiple platforms, there's autotools, which is really complex and intimidating, but less complex than targeting multiple platforms.

Alternatives to make seem to fit in between make and autotools.

Make sucks. I've also heard that Unix sucks, and C sucks, too. Despite this alleged suckyness, these things not only persist, but accumulate improvements over the years.

Re: Why Use Make

#29
post #15

If your project sports auto-generated code, or any sort of build targets that depend on inputs only known after generation -- Make simply cannot handle this. There are ugly workarounds but they don't work well. Make is: * Slow (e.g: when compared with tup[1]) * Very easy to get it wrong (under-specify dependencies), with cryptic bugs (or over-building) as a result. Pretty difficult to get it right (e.g: doing proper…

Have you used tup? I have encountered on the web, and it looks very well done. But I never hear about anyone using it. Is it just under-publicized?

People sometimes talk about waf as an alternative. I took a look at waf awhile aback and I felt disappointed, I forget why. I think node.js switched off waf for some reason I don't recall; either that or they didn't like it.

Post reply on HN