5 ms·
> but it's not like Make syntax is ideal or consistent It's standardized in POSIX. "Ideal" is subjective.
by garmaine 9y ago
> but it's not like Make syntax is ideal or consistent
It's standardized in POSIX.
"Ideal" is subjective.
- jchw 9y agoFine. But most sane people would agree that Makefile generation is not a fun business. Autotools, anyone? OTOH, generating YAML documents is easy. I already write code that generates YAML documents. P.S.: POSIX make doesn't support concurrency. So, it's not fair to compare this purely to POSIX make.
- sirn 9y ago> OTOH, generating YAML documents is easy. On the topic of syntax, I'll say YAML is not the best format for configuration either. At a glance, it looks simple and easy to write, but YAML can bite its user in an unexpected ways due to its implicit typing[1]. For example this YAML: on: yes …will be parsed to: {true => true} …which cannot be serialized to JSON in a lossless way (since JSON spec specify that a key must be a string): {"true":true} …and translating this back to YAML would result in: 'true': true This is without considering other features such as anchor, aliases and tags[2], which further make the YAML spec incredibly complex. [1]: https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst#what-is-wrong-with-implicit-typing https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst... [2]: http://www.yaml.org/spec/1.2/spec.html http://www.yaml.org/spec/1.2/spec.html
- icebraining 9y agoI agree that the implicit typing is dangerous, but developers shouldn't expect to convert YAML to JSON losslessly. It's a superset, after all.
- nerdponx 9y agoMake isn't hierarchical and your build system probably doesn't need to be either. IMO ini/TOML format would be the way to go.
- stephenr 9y ago> But most sane people would agree that Makefile generation is not a fun business. Autotools, anyone? I use Make for a range of things (specifically, not c/c++/etc though) and I've never used Autotools/Automake etc (except compiling a project that uses it occasionally)
- jchw 9y agoI've used it a lot without autotools, but that doesn't change my opinion re: autogenerating makefiles.
- richardwhiuk 9y agoauto-generating Makefiles produces awful Makefiles in the same way auto-generating code produces awful code. If it was the only way of creating Makefiles, it might be a valid complaint against Makefiles, but it isn't. It's not even a useful thing to do.
- jchw 9y ago>auto-generating code produces awful code. I disagree with this notion. Code generation is limited by the approach, the input information and the output language. Make is (subjectively) an ugly language, text macros are a bad approach. That's why autotools sucks in my opinion. OTOH, approaches like Go's 'Stringer' are pretty clever and useful, and generate good code from many PoVs. >It's not even a useful thing to do. Look, if you write nice, minimal Makefiles, that's great. It's not what I was talking about. I know autogenerating Makefiles sucks. I prefer Makefiles like those from projects like musl. But some projects are too big and complicated. If I want to target a huge number of platforms while also supporting cross compiling, Make starts to break down rapidly. Out of tree builds are also a pain. Tools like qmake and autotools can alleviate this by autogenerating Makefiles and project files abstractly. That way, I don't have to make configuration decisions on every single invocation. This gets especially tedious if you need to run pkg-config many times or sdl-config, or maybe some platform dependent things, or what have you. Or if you want to do things Make isn't good with, like recursing or acting on a wildcard of files. Soon enough your Makefile is calling find and relying on the BSD or GNU version of find, someone tries to run it on MinGW and gets confused by the weird argument error with find. Lots of people use Make for it's ability to concurrently run tasks with dependencies. This program presents just that part of make with a declarative syntax that is easily generated programmatically. If you don't see a point, I can understand. Personally, I have no plans to use Cr. But if I was writing a kind of build system that generated a manifest, I'd rather generate a YAML manifest than a Makefile.
- panic 9y agoOne reason generating YAML is so easy is that there are libraries for it. Are there similar libraries for manipulating makefiles?