News for hackers. Stuff that matters.
Re:GNU make insanity: finding the value of the -j parameter by jwatte on Saturday March 28, 2015 @04:31PM (#9282651)
Those who don't learn make are doomed to reimplement it. Poorly.

Also: never, ever, build a make system that relies on recursive make invocations.

Automake is a particularly egregious violator is this rule (and other sanity rules) and has probably hurt make more than anything else.

Re:GNU make insanity: finding the value of the -j parameter by pdkl95 on Saturday March 28, 2015 @06:32PM (#9283004)
Thankfully, you can now use automake without recursion if you set the "subdir-objects" option:

    AM_INIT_AUTOMAKE([subdir-objects])
and reference your source with their relative path in the (only) Makefile.am in $(top_srcdir)

    bin_PROGRAMS = foo

    foo_SOURCES = src/main.c                    \
                  src/foo.c      src/foo.h      \
                  src/quux/bar.c src/quux/bar.h \
                  src/quux/baz.c src/quux/baz.h
You can use relative paths like in most places automake accepts file names. The only time I've run into trouble using non-recursive automake (1.13.4) is adding flex+bison source. This requires BUILT_SOURCES, which is confusing, and automake is very picky and non-obvious about the names of the generated source files. I think it may not have been updated to support relative paths yet? It required some heavy workarounds:

    AM_YFLAGS = -d

    # this was VERY important
    # (must be abs_top_srcdir, not top_srcdir)
    foo_LFLAGS = --header-file=$(abs_top_srcdir)/src/xyzzy_lexer.h

    foo_SOURCES += src/xyzzy_lexer.l src/xyzzy_parser.y
    EXTRA_DIST  += src/xyzzy_lexer.h

    # note the inconsistency here
    BUILT_SOURCES += src/foo-xyzzy_lexer.c \
                     src/xyzzy_parser.h

    # ...and this doesn't match BUILT_SOURCES
    MAINTAINERCLEANFILES += src/foo-xyzzy_lexer.c \
                            src/xyzzy_lexer.h \
                            src/xyzzy_parser.h
Even with this annoyance, I would still highly recommend using this style instead of the traditional (recursive) automake. Autotools Mythbuster has more information on this other modern-autotools features:

https://autotools.io/automake/nonrecursive.html

Re:GNU make insanity: finding the value of the -j parameter by santaclaus on Saturday March 28, 2015 @05:01PM (#9282753)
Someone should implement make without the silly tabs.
Re:GNU make insanity: finding the value of the -j parameter by kryptiskt on Saturday March 28, 2015 @05:56PM (#9282886)
"Why the tab in column 1? Yacc was new, Lex was brand new. I hadn't tried either, so I figured this would be a good excuse to learn. After getting myself snarled up with my first stab at Lex, I just did something simple with the pattern newline-tab. It worked, it stayed. And then a few weeks later I had a user population of about a dozen, most of them friends, and I didn't want to screw up my embedded base. The rest, sadly, is history."

-- Stuart Feldman

Re:GNU make insanity: finding the value of the -j parameter by JoshTriplett on Saturday March 28, 2015 @06:45PM (#9283062)
If you don't care about compatibility with existing Makefiles, you can do this already with GNU make; just set ".RECIPEPREFIX" to some other character.
Re:GNU make insanity: finding the value of the -j parameter by babuskov on Saturday March 28, 2015 @05:09PM (#9282777)
And I thought I was the only one burned by this ;)
Re:GNU make insanity: finding the value of the -j parameter by burstmode on Sunday March 29, 2015 @08:14AM (#9284587)
At least every 2nd C programmer working on a non-unix platform has been burned by this at least once. It's like a 10ft deep pothole on Broadway that won't get fixed because traditionalists see it as a 'national monument'.
Re:GNU make insanity: finding the value of the -j parameter by atilaneves on Saturday March 28, 2015 @09:15PM (#9283504)
Except for tup and ninja.