2 ms·
I avoid Make at all costs now if I can. Makefiles are far too difficult to read and write compared to alternatives in my opinion when you're automating anythin
by seanwilson 12y ago
I avoid Make at all costs now if I can.
Makefiles are far too difficult to read and write compared to alternatives in my opinion when you're automating anything beyond a few simple tasks. You'll inevitably have tasks that require several lines of code, complex logic, different settings for production, staging and development environments, common code that has to be shared between build steps etc. I find it difficult to make shell scripts robust and maintainable.
I'd much rather use JavaScript's Gulp (especially if my project was using Node like in the post) or Python's Fabric if possible.
- noir_lord 12y agoFabric is the tool I use since it handles all the routine stuff but if you need it you have all the power of python and its excellent pip tools.
- davexunit 12y agoYou know that you could keep the make tasks simple and have them invoke external scripts that are written in the language of your choosing, right? Building a mound of spaghetti shell code in a single file isn't the only way to construct a Makefile.
- seanwilson 12y agoSure, but once you want to start sharing code between your external scripts and the Makefile, it makes a lot more sense to me to write it all in a single more maintainable language.
- leni536 12y agoIt starts to look ugly when your script's purpose is for writing make rules. Like dependency generation with gcc.
- empthought 12y ago> [My] Makefiles are far too difficult to read and write compared to alternatives in my opinion Corrected for accuracy. > when you're automating anything beyond a few simple tasks. This is why, historically, so few projects of any scale or complexity have used Make.
- seanwilson 12y agoWell I did say "in my opinion". I didn't find this code from the post readable for example (and this comment is directed at Make and not the script writer): BIN := ./node_modules/.bin UGLIFY ?= $(BIN)/uglify-js UGLIFY_FLAGS ?= --screw-ie8 build/%.min.js: build/%.js @$(UGLIFY) $(UGLIFY_FLAGS) $< > $@ I find all Makefiles end up containing code like this where it makes sense when you write it but when returning to it a few weeks later you don't understand what it does anymore.
- empthought 12y agoNo code is readable if you don't bother to understand the language. That code right there is pretty bog-standard and frankly much easier to read than the Grunt equivalent.
- golergka 12y agoHonest question: what was hard to understand in this code?