5 ms·
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 ca
by teddyh 7y ago
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.
- umvi 7y agoMake is my default. However, as the project grows, I find myself wanting to organize modules by directory and I find it cleaner to switch to CMake which then generates the Makefiles for me.
- enriquto 7y agoI 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.
- jobigoud 7y ago> the GUI should encode the space as a non-breaking space character At this rate, why can't the tool itself escape the spaces from the filenames into non-breaking-spaces before processing?
- emiliobumachar 7y agoAmbiguity. Two file names with the single difference that one has a breaking space and another a non- breaking space.
- colordrops 7y agoI can't tell if you are being sarcastic.
- enriquto 7y agoi am dead serious about that. Allowing the separator character in filenames is a nightmarish error.
- int_19h 7y agoThe vast majority of users never even see the command line - why should they be dealing with the limitations imposed by it?
- enriquto 7y agoThese users would never notice if their filenames are encoded using one type of space or the other inside the filesystem. That's a win-win!
- pjmlp 7y agoOnly for tools that are stupid for not being able to handle any kind of filename.
- enriquto 7y agoYes, like filenames with multiple dots, for example. I agree that filesystems must allow almost arbitrary filenames. But some characters should definitely be forbidden, like '/', '\n' and ' '.
- deleted 7y ago[deleted]
- ajdlinux 7y agoYou're over 20 years too late to propose this.
- enriquto 7y agoWe can move gradually towards this, not that there's anything lost besides a lot of time writing absurd quotes so that your script "supports spaces"
- kryptiskt 7y agoFilenames 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.
- Asooka 7y agoThe 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.
- enriquto 7y agomy point exactly!
- m463 7y agoMake is useful and the concept is sound. However, the implementation is dated. Just off the top of my head, it could be object oriented (rules could be subclassed), the language could have more sophisticated statements, it could have debugging, etc
- a3n 7y agoIt could have non-significant whitespace.
- lokedhs 7y agoThat would be great, but significant whitespace doesn't seem to stop all the Python users out there.
- m463 7y agoI will say I like how python uses whitespace syntactically. The whitespace is consistent, makes programs readable and much more compact. make seems to be less consistent. I think it distinguishes between a space and a tab, which isn't clear without editor help.
- a3n 7y agoYeah, I wasn't specific here. Tabs and spaces in Make are different specific things. I also like Python's significant whitespace. It's easy to mess up whitespace in Make and it might not complain about it. Mixed whitespace in Python will either work without problem, or it will tell you when it doesn't. Make's whitespace is unnecessarily clever.
- kjs3 7y agoWhy is old bad? I can't tell you how often one of my team shows me some clever, non-trivial Python script that I solve in a couple of lines of awk/sed/perl. Or a small makefile. Why in the world would I want an OOP make? What do I need 'more sophisticated' in make statements that wouldn't really mean that I needed to be using a different tool that undoubtedly wasn't solving the problem make solves? OK...debugging could be better. Got me there.
- upc031901 7y agoSpaces in filenames break most of make's builtin functions such as $(sort), and break the $?, $^ and $+ automatic variables. But they're OK in target names as long as you escape the spaces with backslashes. In some cases you can also use them in source file names -- you have to hard code the names in the build rules since $^ won't work (but for targets built from a single source file, $< still does work). This applies to GNU make; not sure about AT&T make.
- imglorp 7y agoAnd are we gonna talk about case-insensitive filesystems? cringe
- adiabatty 7y agoI can't imagine why. I run make on case-insensitive-but-case-preserving HFS+ and APFS-formatted disks all the time.
- chrisweekly 7y agoThe thing I cringe at is the notion that it is ever helpful to manage files with names that differ only in case. Who does this? Why?
- imglorp 7y agoIt's not always intentional. Make itself, for example, allows Makefile and makefile. What if you've got both in a project you unpack on OSX. Uhoh. https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html https://www.gnu.org/software/make/manual/html_node/Makefile-...
- chrisweekly 7y agoYeah, I know it's not always intentional, and I understand the need to be able to distinguish between such files. It's just annoying that there isn't a better solution than "all filesystems, forever, must support a problematic use case that serves no good purpose". To be clear, naive solutions would likely be a slippery slope w/ worse side effects. So, on a certain level I feel obliged to apologize for complaining given I can't think of what a solution I'd prefer might look like.
- draw_down 7y agoStuff like this (and .phony) is why I can’t believe people take it seriously.
- spc476 7y agoA way around that is to convert any spaces in a filename to non-breaking spaces (if you can). That will not only fix problems in Make, but also ease use in the command line.
- unwind 7y agoFor very low values of "ease use", in my opinion. Spaces in filenames are a bad idea; non-breaking spaces would be an anti-pattern or an attack, in my opinion. How do you portably type a non-breaking space, if you don't have tab-completion?
- chrisweekly 7y agoHuh? If you can rename the files why keep any kind of whitespace in them at all?
- pif 7y agoFile names with spaces is a sign of lousy developers and IT technicians. If you have file names with spaces you have already lost.
- gimboland 7y agoBwahahahahahaha! Good one!
- deleted 7y ago[deleted]
- mmjaa 7y agoThis is why I find detox to be such a handy tool: http://detox.sourceforge.net/ http://detox.sourceforge.net/ Detox has solved endless amounts of hassle...
- kazinator 7y agoGood thing! Make serves as a gatekeeper from stupid spaces in paths from creeping into a project at the very source code level. Let the users of the software do that at run-time, if they are so inclined.