by nneonneo · 10y ago · 0 comments
Despite being an obvious usability hole, this has never been fixed. Exacerbating the issue is the poor error message given upon encountering a space-indented line in Make:
Makefile:2: *** missing separator. Stop.
Make is ubiquitous and fairly easy to use, but it's warts like this that remind you that it is fundamentally a build system from the far past. Makefile:2: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
See 2c64fb221a265f9e7fc93374906b1e7540377561: 1998-09-04 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): If we hit the "missing separator" error,
check for the common case of 8 spaces instead of a TAB and give an
extra comment to help people out.
I guess you may have indented it in the modern way with 4 spaces of "tab". Either way, there's also help to be had from your other tools, e.g., vim highlights space-indented make recipes in glaring red error bars. au FileType make setlocal ts=4 sts=4 sw=4 noet
and have vim automatically use "hard" tabs when it detects that you're editing a Makefile. Of course, you can s/4/2/g or whatever your preferred tab width is.Thanks for mentioning, I had no idea this special case was here!
Well, which implementation of make should be fixed? The thing about these truly ubiquitous nix tools is that eventually people discover that there are unixes other than Linux.
…that said, a quick google found that this
is* fixed in GNU make; check the docs for .RECIPEPREFIX here: https://www.gnu.org/software/make/manual/html_node/Special-V...You can now change the prefix for your recipes by setting the .RECIPEPREFIX special variable (https://www.gnu.org/software/make/manual/html_node/Special-V...).
That being said, with a properly configured editor I've actually found that TAB is an ideal character for the recipe prefix.
[Makefile]
indent_style = tab
http://editorconfig.org/https://github.com/aaronbassett/EditorConfig/blob/master/.ed...
My personal preference for everything is spaces
You want a tool that has been around longer than you do stuff your way. I think it is better if learn to work with the tools and accept that there is a reason some things work in certain ways.And, not to sound harsh, but if you always "accept that there is a reason some things work in certain ways" without questioning if there may be a better way, well, you will always be stuck with the status quo!
Anyway, are you saying that accepting a tools established input format is to go with the status quo? I am all for breaking new grounds, but is this one really a priority?
Anyway, my point was, not everything needs to be customizable to your liking. Sometimes things have a set of simple rules you just have to follow. I for one like that we are limited to tabs, otherwise we would have problems with different number of spaces in the same file and by the way exactly how many spaces are a tab? I like 4 but maybe you like 8 or, god forbidden, 2?