Make is great, and I wish more people would use it in place of whatever monstrosity is en vogue this week. However, there is one thing which Make absolutely cannot handle, and that is file names with spaces . If you have any risk of encountering these without any possibility of renaming them, you’ll sadly have to give up on using Make; it just won’t work.
I agree, and the solution to this problem is to forbid filenames with spaces. The convenience of make and similar tools is much more important than spaces in filenames. File names with spaces should not be allowed in modern filesystems. When the user types a filename with spaces, the GUI should encode the space as a non-breaking space character, that does not cause havoc in scripts.
Filenames in most Unix derivatives is an arbitrary bag of bytes only excluding '/' and '\0', they don't even have to have a valid encoding. If you can handle that spaces are the least of your concerns. Tools should be able to handle them by now, one would think.
I use Makefiles when I'm learning the ropes of a new system build tool. E.g. "I want to do , so I run `make `", and the make target named has all the commands to build what I want. I did this when I was learning how Docker worked. I put the incantation to build a new image into a Makefile, as well as how to run the container and exec into it. Not the best system, but works for me as a kind of living notebook.
Make is great as a dependency resolution engine. For everything else, it is absolutely horrible. What I typically do is use make only for what it is good: as a dependency resolution back-end. All the build logic for my projects is written in Python, in an executable file stored in the project root directory and called "make" (I have "." in my PATH). The Python script, when it runs, generates on the fly a clean, lean,…
pyinvoke can be used to define Makefile-like tasks in Python. http://www.pyinvoke.org/ http://fabfile.org allows to execute the commands remotely via ssh
Do either of these solve dependencies and partially executed dependency graph rebuild like make does?
Make is great, and I wish more people would use it in place of whatever monstrosity is en vogue this week. However, there is one thing which Make absolutely cannot handle, and that is file names with spaces . If you have any risk of encountering these without any possibility of renaming them, you’ll sadly have to give up on using Make; it just won’t work.
I agree, and the solution to this problem is to forbid filenames with spaces. The convenience of make and similar tools is much more important than spaces in filenames. File names with spaces should not be allowed in modern filesystems. When the user types a filename with spaces, the GUI should encode the space as a non-breaking space character, that does not cause havoc in scripts.
The human friendly name should really be metadata on the file anyway. Regular users don't need to deal with raw filesystem internals, we can just say that filenames are identifiers that are always lower case, in the C locale, encoded as utf8 or 16. Any whitespace is not allowed.
This kind of projects always makes me sad: you've got to read and debug through an impenetrable wall of custom python code to understand why the build fails.
I guess you didn't read the part that says it generates a simple unrolled Makefile. That's way more debuggable than the crap that ie configure generates.
I guess you didn't read my comment at all.
When it fails it doesn't. And if you need to bring up Autotools that weren't brought up by anyone in this thread then that justification isn't sound at all.
Unlike a target, .PHONY can be populated incrementally. For example, this: .PHONY: serve live-reload serve: init deps compile db-setup db-migrate rails server live-reload: yarn ./bin/webpack-dev-server --host 127.0.0.1 can become this, making things a tiny bit easier to maintain when there are many targets: .PHONY: serve serve: init deps compile db-setup db-migrate rails server .PHONY: live-reload live-reload: yarn .…
> If a commonly used tool changes its call in a new version, with README it’s a documentation issue, but with Makefile it’s broken software. ie. the Makefile will be kept up-to-date
Perhaps I did not express that well. This is how things may go:
(1) I need to build this, but the Makefile is broken. (2) I invoke the build directly by asking colleague for help. (3) Can I be bothered to update the docs? Maybe. Can I be bothered to fix Makefile targets? Much less likely.
As a facade, Make is great. Anything more, and it's not. You can express so much in Make, and so quickly; but the expression is horrible and basically confusing.
This describes my Makefiles - they all run some other Bash or Python script.
Too bad shell does not have a “tasklet mode” where you can readily define some commands to call.
I've used make extensively. I wish it had a little python in it. After using pathnames in awk/sed/perl I find using os.path in python gets rid of all the special cases due to quoting and escaping. Python has nice lists and dicts and sets too. For OO, I wish rules were a bit like python classes. It would be wonderful for say 10 c files compiling one way, and the 11th having a different option. Or overriding a few opti…
> It would be wonderful for say 10 c files compiling one way, and the 11th having a different option. You can do this by combining implicit and explicit rules: target: $(OBJ) # default rule %.o: %.c cc -o $@ $^ # special case special.o: special.c specialc -o $@ $^
Another way, with target-specific variables (might be a GNUism):
pyinvoke can be used to define Makefile-like tasks in Python. http://www.pyinvoke.org/ http://fabfile.org allows to execute the commands remotely via ssh
Do either of these solve dependencies and partially executed dependency graph rebuild like make does?
It is not about specific building scheme for dependencies that make uses. It is more about "all-purpose" stuff: automate tasks that you run manually or via CI in a general purpose language.