4 ms·
Wow if you consider Makefiles easy to read...
by IshKebab 9y ago
Wow if you consider Makefiles easy to read...
- gnclmorais 9y agoI’ve written about Makefiles for the web before, you can’t say they can’t be readable: http://blog.gnclmorais.com/makefiles-are-for-the-web http://blog.gnclmorais.com/makefiles-are-for-the-web
- jorams 9y agoSomething about the Makefile in your post is a bit weird though: You only declare "test" as a PHONY target, but every other target in the file is just as PHONY. And since you don't even explain that line, it could be a bit confusing.
- bpicolo 9y agoSimple makefiles couldn't be more simple. task: dependency list of commands That's about as easy as it gets.
- bitwize 9y agoUntil a stray space finds its way into your command list indentation...
- bpicolo 9y agoEvery popular text editor handles this already. People manage make, python and other whitespace-specified languages just fine.
- emmelaich 9y agoThey don't though. Vanilla Vim/Vi doesn't for instance. Regardless of whether the editor can or not, I just don't see how insisting on tab and not space is remotely defensible.
- bpicolo 9y agohttps://stackoverflow.com/a/29787362 https://stackoverflow.com/a/29787362 > remotely defensible Feel free to write your own make superset that supports spaces. It's an irrelevant factor to the usability of make as a whole.
- deathanatos 9y ago> Vanilla Vim/Vi doesn't for instance. Vim does handle this. Here is Vim (and I've removed my .vimrc file, so this is not a setting I have set personally), on a Makefile where the third line erroneously uses spaces: https://i.imgur.com/xMHXeL4.png https://i.imgur.com/xMHXeL4.png > I just don't see how insisting on tab and not space is remotely defensible. This is like insisting that people haven't been having religious wars over this sort topic for years. You can see the Wiki[1] page on it (which starts "This is one of the eternal Holy Wars") for arguments as to why someone might prefer tabs. I personally like them because they allow the reader of the code to choose the visual layout of the indentation. Now, while I love tabs, I work in Python all day. But good editors, like Vim, allow you to customize the indentation settings sufficiently to handle both cases like Python (spaces for indent) and Makefile (tabs) gracefully. So "Indent" and "Dedent" just do The Right Thing™ and it mostly never matters. [1]: http://wiki.c2.com/?TabsVersusSpaces http://wiki.c2.com/?TabsVersusSpaces
- travmatt 9y agoIf someone is really paranoid about white space issues in a file you’re editing on vim, you can can always use `:set list` to display those characters.
- swsieber 9y agoFWIW, the more experienced a programmer is, the more likely they are to prefer spaces over tabs. My pet theory is that the more experience you have, the more likely you are to have worked with Python, which is a lot easier to work with if you just always s/\t/ / (replace tabs with spaces).
- deleted 9y ago[deleted]
- matheusmoreira 9y agoReal world makefiles are not simple like this. The simplest makefile I can think of is still hundreds of lines long: https://git.musl-libc.org/cgit/musl/tree/Makefile https://git.musl-libc.org/cgit/musl/tree/Makefile
- creatornator 9y agoMaybe this isn't "real-world" but I've made this cookiecutter template which generates projects with Makefiles less than 100 lines. It works decently well for my personal projects and for playing around. https://github.com/MatanSilver/cookiecutter-cproj https://github.com/MatanSilver/cookiecutter-cproj
- tachyoff 9y agoIt's certainly better than the 200+ lines of JavaScript something like Webpack spits out when you statr a new project. I had to debug some of our project's build files and realized halfway through that my teammates didn't write this Webpack config monstrosity, Webpack generated it by /default/.
- acemarke 9y agoWebpack, by itself, doesn't generate configs, unless you're referring to the Webpack CLI tool. FWIW, Webpack 4 (which just went final a few days ago) now has "zero-config" defaults out of the box. You may want to give that a shot.
- tachyoff 9y agoEh, I tend towards “let’s not touch this if it works”. I’ve already had to upgrade from Webpack 1 to 2, and 2 to 3. If it ain’t broke, don’t fix it.
- acemarke 9y agoSure, I can sympathize. That said, I've seen a bunch of "here's my results after upgrading to Webpack 4" tweets going around, and they all indicate much faster builds and somewhat smaller bundle sizes, with very minimal config changes needed.
- megaman22 9y agoNext to a non-toy webpack or gulp configuration, makefiles are pretty clean and simple.