Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Fabric 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.


You 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.


Sure, 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.


It starts to look ugly when your script's purpose is for writing make rules. Like dependency generation with gcc.


> [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.


Well 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.


No 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.


Honest question: what was hard to understand in this code?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: