Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

111–120 of 525 posts

Re: The Makefile I use with JavaScript projects

#111

I think the reason make is both so controversial and also long-lived is that despite how everyone thinks of it, it isn't really a build tool. It actually doesn't know anything at all about how to build C, C++, or any other kind of code. (I know this is obvious to those of us that know make, but I often get the impression that a lot of people think of make as gradle or maven for C, which it really isn't.) It's really…

> It actually doesn't know anything at all about how to build C, C++, or any other kind of code.

I guess it depends on how you define "know", but there are implicit rules.

    $ cat foo.c
    #include 
    int main() {
      printf("Hello\n");
      return 0;
    }
    $ cat Makefile
    foo: foo.c
    $ make
    cc -O2 -pipe    foo.c  -o foo
    $ ./foo
    Hello

Re: The Makefile I use with JavaScript projects

#112
post #21

As a non-programer the only experience I have with makefiles are unpleasant ones of running ./configure then ./make only to go down an endless rabbit hole of missing dependencies. I am very grateful that yum/apt-get, etc. have come such a long way, they grab all your dependencies, you don't have to wait long periods of time for the code to compile. I am sure Make still has it's uses, but I am sure glad package manage…

This is not really a fair comparison though. Makefiles and package managers are orthogonal and the latter has not really replaced the former. Makefiles are like a recipe, package managers are food delivery. Somebody has still to cook the food.

> This is not really a fair comparison though.

I'd argue it's entirely fair with other examples (e.g. compare and contrast to, say, Rust's cargo build.) You can write a Makefile which fetches and builds your dependencies. Makefiles might be like a recipe - but these days we're building recipes for building entire OS images, including grabbing the dependencies in the first place. A single software project by comparison is trivial.

The problem is Makefiles are a jack of all trades, and master of none. You have to write or copy a distressing number of rules yourself, per project, per subproject, and know the underlying build chain in relative depth to do even some rather basic things. I'd argue makefile authors not automating their dependency fetching is a symptom of this.

As a programmer, I avoid them, because I'll end up stuck maintaining them and end up lowering the build system's bus factor. With perhaps the exception of a couple of simple rules that forward to a "proper" build system, because I've written enough of them in the past that "make" still feels like the right default action that should generally work. But if it all possible, never for the meat of the build system.

Re: The Makefile I use with JavaScript projects

#113

A 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…

I once (back in the mid-1980's) spent several weeks hunting down a makefile bug. In the end it turned out to be a SPACE character that preceded a TAB character.

It's some weeks of my life I will never get back.

I hate make and it's 'entire syntax'.

Re: The Makefile I use with JavaScript projects

#114

A 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…

>some smart people fucked it up 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.

You clearly were not there at the start. Java was a perfectly nice, well designed language.

Then some other people fucked it up...

Re: The Makefile I use with JavaScript projects

#115

A 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…

Nowadays there are build tools that can determine dependencies automatically, by running the compilers inside a sandbox (e.g. linux strace).

Re: The Makefile I use with JavaScript projects

#116
post #23

Make'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…

It's not like C is famous for having particularly good syntax. If anything, it's the worst thing about it.

Isn't C just following the syntax of ALGOL? Or are we referring to the parts specific to C?

Re: The Makefile I use with JavaScript projects

#117

We use make for standardizing the way docker containers are built, pushed, tested, and run (debug and production modes). I even prefer it to docker-compose at this point, because it is more programmable.

Do you handle dependencies (images, networks, volumes), and if you do - how?

I'm of an opinion that Makefiles with Docker are mostly a fancy way to write `case "$1" in build) ... run) ... esac` except that one needs to have make(1) installed to run them (in my experience, Bourne shell is much more commonly available than any make variant)

Re: The Makefile I use with JavaScript projects

#118
post #26

Anyone here uses makefiles for anything other than compilation and build? One can use it to add some level of concurrency to shell scripts.

I've built a batch job scheduling system out of 'make' and a handful of supporting tools.

It works surprisingly well, but it is definitely not the right tool for the job. After a number of years of adding/removing/changing jobs, maintaining it is turning into a nightmare.

Re: The Makefile I use with JavaScript projects

#119

A 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…

Nowadays there are build tools that can determine dependencies automatically, by running the compilers inside a sandbox (e.g. linux strace).

strace? I was under the impression strace is used to monitor system calls, how does this related to compilers inside a sandbox?

Re: The Makefile I use with JavaScript projects

#120
post #97

Tangential, but I cringe everytime I see the word "transpiler". A compiler is a compiler is a compiler. Previous discussion on this: https://news.ycombinator.com/item?id=15154994

Meh: Compiler: collects sources from various places, assembles the result into machine code. Transpiler: collects sources from various places, converts the source to another language. Personally I cringe at the newspeak you seem to imply we should all be applying to our lives. These words mean things - quite different things, it turns out. There's a difference between human-readable source code language, and machine-…

> newspeak you seem to imply we should all be applying to our lives.

http://foldoc.org/transpiler

^ no match.

transpiler is the newspeak.

Post reply on HN