Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

301–310 of 525 posts

Re: The Makefile I use with JavaScript projects

#301
post #189

Earlier quoted context omitted.

Like, for example? To be serious, those are sort of contrived. "Sending a notification" isn't something you want to be managing as state at all. What you probably mean is that you want to send that notification once, on an "official" build. And that requires storing the fact that the notification was sent and a timestamp somewhere (like, heh, a file). And as for building into a database... that just seems weird to me…

I need to send an email every time a log file updates, just the tail, simple make file: send: foo.log tail foo.log | email watch make send Crap, it keeps sending it. Ok, so you work out some scheme involving temporary files which act as guards against duplicate processing. Or you write a script which conditionally sends the email by storing the hash of the previous transmission and comparing it against the hash of th…

just make "send" not be a phony target.

How about "touch send"?

Now "touch -t" will allow you to control the timestamp.

md5sum, diff would be your friends.

Anyway, my C compiler doesn't provide that info, anyway.

Re: The Makefile I use with JavaScript projects

#302
post #190

Earlier quoted context omitted.

You _could_ do something like this: make -f- But for the sake of compatibility I wouldn't.

No need for ugly sed error-prone trickery. Use on the Makefile: MAKE_TARGET := /some/path And invoke $ make MAKE_TARGET=/other/path

His point was that all of $@, $%, $? have more descriptive names as well, you don't need to use these single character macros.

Also you probably meant ?= instead of := as the command you gave would still use /some/path instead of /other/path if you use :=.

Re: The Makefile I use with JavaScript projects

#303

I’ve had a lot of fun recently writing a Makefile for a Go and Lambda app: https://github.com/nzoschke/gofaas/blob/master/Makefile It started very verbose, one target for every Go program, until I figured out target patterns. I’m also enjoying the -j flag to do things in parallel. Now it’s 3 lines of Make to build 10 go programs in parallel in seconds. Parallel is also enough job control to run the development server…

Looks good, I think you need to add PHONY targets

Re: The Makefile I use with JavaScript projects

#305

I used make heavily in the 80s and 90s, but haven't much since then. Recently I started a project that had source files getting processed into PDF files, for use by humans. Since this is the 21st century, those files have spaces in their names. At a certain point, I realized that I should be managing this processing somehow, so I thought of using a simple Makefile. A little searching reveals that the consensus on usi…

Demanding the support of spaces in filenames significantly complicates code as simple space delimination no longer works and other delimination schemes are much more error prone -- forgetting balancing quotes, any one? While you are allowing spaces, you probabaly are allowing all possible code points or maybe even a null byte? Thinking about it gives me headaches. I hate hearing people using 21st century or modern as…

>Demanding the support of spaces in filenames significantly complicates code as simple space delimination no longer works

Wow.

So human beings should stop using allowed file names because it's too hard for you?

Re: The Makefile I use with JavaScript projects

#306
post #291
post #241

Earlier quoted context omitted.

I'm bemused by this repeated insistence that supporting spaces in file names is somehow difficult.

I'm bemused by this repeated insistence that supporting colon in file names is somehow difficult.

Who on earth insists that? Only Windows programmers, I expect! But it's easy: make sure they're expressible in your syntax, then pass them through as part of the file name. Just like spaces. If there's a problem, you'll get an error back from the OS.

Re: The Makefile I use with JavaScript projects

#307

Earlier quoted context omitted.

Demanding the support of spaces in filenames significantly complicates code as simple space delimination no longer works and other delimination schemes are much more error prone -- forgetting balancing quotes, any one? While you are allowing spaces, you probabaly are allowing all possible code points or maybe even a null byte? Thinking about it gives me headaches. I hate hearing people using 21st century or modern as…

What does the merit of spaces in file names matter? You still will need to deal with files with spaces in the real world. If your tooling doesn't support it, it's a non-starter for many.

Your tools support filenames with tabs? With any unicode char?

A real world possibility.

Re: The Makefile I use with JavaScript projects

#308
post #241

Earlier quoted context omitted.

What about real world is that in real world, it is not context-free. There are real world situations -- such as selling a word processor to general public (especially) including clueless -- you need to deal with files with spaces, period. But there are real world situations -- such as Makefiles -- requires users to learn the tool, to be able to handle certain tricky situations themselves and excludes incompetents. An…

I'm bemused by this repeated insistence that supporting spaces in file names is somehow difficult.

And nulls? And quotes? And dollars? And any unicode char?

Re: The Makefile I use with JavaScript projects

#309

Earlier quoted context omitted.

What about, for example, a source file that needs to be downloaded and diffed from the web? What about when you need to pull stuff from a database? You can hack your way around but it's not the most fun.

WRT the web file, curl can be run and only download a file if the file has been modified after the file on disk. DB are harder (yet possible) but not a common request that I’ve seen.

curl -z only works if the server has the proper headers set - good luck with that. The point is, it's great to be able to have custom conditions for determining "needs to be updated", for example.

Re: The Makefile I use with JavaScript projects

#310
post #283

Earlier quoted context omitted.

Demanding the support of spaces in filenames significantly complicates code as simple space delimination no longer works and other delimination schemes are much more error prone -- forgetting balancing quotes, any one? While you are allowing spaces, you probabaly are allowing all possible code points or maybe even a null byte? Thinking about it gives me headaches. I hate hearing people using 21st century or modern as…

You solution is a “boil the oceans” one typically proposed by engineers. You can re-program computers. You can’t re-program millions of people. Every natural language uses spaces to separate things. You can accept that or you can keep tilting at windmills. In every branch of science, reality wins. If your model can’t accomodate reality it’s either completely wrong or it needs adjustments, at least.

You can prevent your tools from having to deal with the fact, by preprocessing.
Post reply on HN