4 ms·
Nope, to me it isn't cleaner. Also, make has "make -n" which is absolutely golden.
by xaduha 11y ago
Nope, to me it isn't cleaner. Also, make has "make -n" which is absolutely golden.
- exDM69 11y agoIt's not about which script file is considered to be "cleaner", aesthetic preferences don't matter here. The Makefile here almost certainly has some unexpected side-effects when used in a way that the original author didn't intend to. E.g. accidentally removing your PID files (e.g. with git clean) and then you have more than one dev server running. Make isn't intended for starting/stopping services or doing non-build tasks. It really sucks for that kind of tasks. It might work ok for the handful of workflows the author intended it for, but then spectacularly break down when someone else tries to do something outside of that or when new features get added. Sometimes I see people use Make for situations where some build platform (e.g. Windows or an embedded toolchain) doesn't have a proper shell at hand. But it's still not a great idea to use Makefiles as a replacement for shell scripts. There are much better alternatives for doing non-build tasks.
- to3m 11y agoWhat problems would there be doing things from GNU make, that there wouldn't be when doing the same thing from a shell script? My experience has been that you can totally use GNU make as a replacement for shell scripts, and it works fine. Why wouldn't it? It's just sequences of shell commands, where each sequence has a name. And in fact for this sort of situation, where you've got one of a pre-canned set of sequences to run, it works very well - because GNU make will handle the command line for you, and most shells will give you some kind of basic (but usable) tab completion for the sequences available, without any effort on your part. You do need to use phony targets, though. (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html https://www.gnu.org/software/make/manual/html_node/Phony-Tar...) This might seem like a ridiculous requirement, but I've seen plenty of bash scripts that just kept on going when a shell command failed; it's not like GNU make is unique in requiring a small amount of boilerplate to make things work nicely.
- xaduha 11y agoI was replying to this line > This is a lot cleaner. The PID stuff can be done with bash too. In any case, until there is a tool which is as ubiquitous and as declarative as make you're going to have hard time convincing those of use who use it this way to stop.
- napo 11y agoIt is... It's alway better to write code that shows the intent. When you add comments you force other dev to maintain them, and if they don't you will end up with obsolete or incorrect comments. Plus, you end up doing stupid stuff like: DoThat(); // It does that