CMake is so nice compared to vanilla makefiles. I wonder if it can be used this way with Javascript.
Make may seem crude these days but has manageable complexity, I've never run across a build issue I could not debug. Its model is so simple, I can have it fully in my mind and be confident this is how it works. Moreover, this model simplicity allows me to build reliable systems on top of it. CMake is a nightmare of implied complexity. I've run into multiple situations (usually but not always involving cross-compilati…
The Makefile I use with JavaScript projects
101–110 of 525 posts
Re: The Makefile I use with JavaScript projects
#102A long time ago, in a developer's paradise called the 1970's there was an automated build tool called "make". It had this and only this syntax: If a line begins at character 0, that is a list of files whose timestamps should be checked, if any are 'old', then execute the series of command lines beneath, identifying them as starting with a tab character. That was it, the entire syntax of "make", and it was complete. T…
not sure which make you are criticizing here..
BSD Make (aka PMake) is imho light years beyond GnuMake in terms of coherence of the extensions to the base language and usability..
unfortunately most people in linux land think make==gnumake, and so it is hardly used outside of the base build system of BSD systems..
Re: The Makefile I use with JavaScript projects
#103Anyone here uses makefiles for anything other than compilation and build? One can use it to add some level of concurrency to shell scripts.
all: data.loaded data2.loaded
data.csv: wget 'some url'
%.sql: %.csv sed/awk/custom-python-script $ $@
%.loaded: %.sql psql < $< && touch $@
Re: The Makefile I use with JavaScript projects
#104Make's interface is horrible. Significant tabs. Syntax which relies on bizarre punctuation... If only whoever authored Make 40 years ago had had the design acumen of a Ken Thompson or a Dennis Ritchie! We're stuck with Make because of network effects. I wish that it could just become "lost" forever and a different dependency-based-programming build tool could replace it... but that's just wishful thinking. The pace o…
Maybe I'm in the minority, but I've always found its syntax to be quite nice (though admittedly a departure from most modern languages). Then again, I find using JSON or not-quite-ruby to configure a build incredibly bizarre and confusing, so I guess I'm just set in my ways... In all seriousness, what's wrong with it? Significant tabs aren't great, but I feel like that's a relatively minor wart. The simple things are…
1. Claiming a rule makes a target, but then fails to make that target, ought to be a runtime fatal error in the makefile. I can hardly even guess at how much time this one change alone would have saved people.
2. String concatenation as the fundamental composition method is a cute hack for the 1970s... no sarcasm, it really is... but there's better known ways to make "templates" nowadays. It's hard to debug template-based code, it's hard to build a non-trivial system without templates.
3. Debugging makefiles is made much more difficult than necessary by make's default expansion of every target to about 30 different extensions for specific C-based tools (many of which nobody uses anymore), so make -d output is really hard to use. Technically once you learn to read the output it tends to have all the details you need to figure out what's going wrong, but it is simply buried in piles of files that have never and will never be found in my project.
4. The distinction between runtime variables and template-time variables is really difficult and annoying.
5. I have read the description of what INTERMEDIATE does at least a dozen times and I still don't really get it. I'm pretty sure it's basically a hack on the fact the underlying model isn't rich enough to do what people want.
6. Sort of related to 2, but the only datatype being strings makes a lot of things harder than it needs to be.
7. Make really needs a debugger so I can step through the build, see the final expansions of templates and commands, etc. It's a great example of a place where printf debugging can be very difficult to make work, but it's your only choice.
That said, I'd sort of like "a fixed-up make" myself, but there's an effect I wish I had a name for where new techs that are merely improvements on an old one almost never succeed, as if they are overshadowed by the original. Make++ is probably impossible to get anybody to buy in to, so if you don't want make you pretty much have to make something substantially different just to get people to look at you at all.
Also, obviously, many of the preceding comments still apply to a lot of other build tools, too.
Re: The Makefile I use with JavaScript projects
#105Earlier quoted context omitted.
For that, I don't know what the term is (or if there even is one). Transpiler? Transpiler has been around as a term in CS for a while now. Initially it was used for compilers that compiled from one dialect of assembly to another.
That was retconned. They didn't call it a 'transpiler' at the time.
Re: The Makefile I use with JavaScript projects
#106Earlier quoted context omitted.
It's not like C is famous for having particularly good syntax. If anything, it's the worst thing about it.
They must have got something good though. Else why would there entire families of C-like languages ? Plus, to me C syntax is particularly good. You're writing real words and the computers does the things you tell it to. To the letter.
C became popular because Unix became popular, and when designing a language that intends to become popular one aims for a ratio of 10% novelty and 90% familiarity. Like, ever wonder why Javascript's date format numbers the months starting from zero and the days starting from one? It's because Eich was told to make JS as much like Java as he could, and java.util.Date numbers the months from zero and the days from one, which Java itself got from C's time.h. (Not coincidentally, Java and JS are both in the C-like language family.)
> You're writing real words
In C? Not compared to ALGOL, COBOL, Pascal, and Ada, you're not. :)
> the computers does the things you tell it to. To the letter.
As long as you're not using a modern compiler, whose optimizations will gleefully translate your code into whatever operations it pleases. And even if one were to bypass C and write assembly code manually, that still doesn't give you complete control over modern CPUs, who are free to do all sorts of opaque silliness in the background for the sake of performance.
Re: The Makefile I use with JavaScript projects
#107Re: The Makefile I use with JavaScript projects
#108Earlier quoted context omitted.
Make is such a horrifically awful thing to work with that I just end up using a regular scripting language for building. Why learn another language with all its eccentricities and footguns when I already know several others?
Because, like many other things in programming, you'll end up with a half-baked and buggy implementation of make anyways. Incremental builds by looking for changed dependencies, a configuration file with its own significant identifiers (i.e. a build DSL shoehorned into JSON or YAML), generalized target rules, shelling out commands, sub-project builds, dry runs, dependencies for your own script, parallelization, and a…
I'd argue that make is a half-baked and buggy implementation of make - so that's not really a drawback so much as the status quo.
E.g. I have scripts that exist mainly to carefully select the "correct" version of make for a given project to deal with path normalization and bintools selection issues on windows - and none of these ~3 versions of make work on all our Makefiles. One of those versions appears to have some kind of IO bug - it'll invoke commands with random characters missing for sufficiently large Makefiles, which I've already gone over with a hex editor to make sure there wasn't some weird control characters or invisible whitespace that were to blame. So, buggy and brittle.
Re: The Makefile I use with JavaScript projects
#109A long time ago, in a developer's paradise called the 1970's there was an automated build tool called "make". It had this and only this syntax: If a line begins at character 0, that is a list of files whose timestamps should be checked, if any are 'old', then execute the series of command lines beneath, identifying them as starting with a tab character. That was it, the entire syntax of "make", and it was complete. T…
This does seem to happen in our industry over and over, another example is the way we turn every small, well designed language into Java.
Re: The Makefile I use with JavaScript projects
#110Earlier quoted context omitted.
Maybe I'm in the minority, but I've always found its syntax to be quite nice (though admittedly a departure from most modern languages). Then again, I find using JSON or not-quite-ruby to configure a build incredibly bizarre and confusing, so I guess I'm just set in my ways... In all seriousness, what's wrong with it? Significant tabs aren't great, but I feel like that's a relatively minor wart. The simple things are…
I've been writing Makefiles regularly for maybe 15 years and I always end up on this page every time I need to write a new one: https://www.gnu.org/software/make/manual/html_node/Automatic... $ $* $^ ... Not particularly explicit. You also have the very useful substitution rules, like $(SRC:.c=.o) which are probably more arcane than they ought to be. You can make similar complaints about POSIX shell syntax but at lea…
manual: ('make' on a bsd is PMake)
https://www.freebsd.org/cgi/man.cgi?query=make&apropos=0&sek...
but most linux flavors have a package somewhere..