3 ms·
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
by jwatte 12y ago
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.
- santaclaus 12y agoSomeone should implement make without the silly tabs.
- babuskov 12y agoAnd I thought I was the only one burned by this ;)
- burstmode 12y agoAt 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'.
- kryptiskt 12y ago"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
- JoshTriplett 12y agoIf you don't care about compatibility with existing Makefiles, you can do this already with GNU make; just set ".RECIPEPREFIX" to some other character.
- pdkl95 12y agoThankfully, 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 https://autotools.io/automake/nonrecursive.html
- atilaneves 12y agoExcept for tup and ninja.