News for hackers. Stuff that matters.
Re:Why I Prefer Makefiles over Package.json Scripts by slaymaker1907 on Monday March 14, 2022 @02:21PM (#30676023)
The only bad part about Make is that it doesn't provide even the most basic utilities for doing cross platform work like removing a directory. It mostly works with Unix, but writing a Makefile that works on Windows and Unix is really hard.

If Make had just a few more batteries included, it would be perfect. However, maybe adding those batteries would take away from its other qualities.

Re:Why I Prefer Makefiles over Package.json Scripts by Izkata on Monday March 14, 2022 @04:05PM (#30677506)
Make is a file-based dependency tree that only defaults to a specific shell. If you really want to go crazy, you could actually change it to anything that can be invoked with "<executable> <file>", such as python, and use that language instead.

As a really crude example:

  SHELL := python
  .ONESHELL:

  out.csv:
      import csv
      with open("$@", "w") as f:
          writer = csv.writer(f)
          writer.writerow(["header1", "header2"])
and so:

  $ make
  import csv
  with open("out.csv", "w") as f:
      writer = csv.writer(f)
      writer.writerow(["header1", "header2"])
  $ cat out.csv 
  header1,header2
I get that this doesn't exactly solve your "cross-platform work" gripe, but my point is that a lot of what people perceive as make providing isn't actually make in the first place.
Re:Why I Prefer Makefiles over Package.json Scripts by pqb on Monday March 14, 2022 @05:25PM (#30678559)
Thank you for reminding me it! Awesome finding.

Worth noting, each recipe can have its very own SHELL[0] (e.g., ruby recipe, that uses ruby command with -e flag):

  ruby: .SHELLFLAGS := -e
  ruby: SHELL := ruby
  ruby:
   greeting = "labas"
   puts "#{greeting}, ruby!"

[0]: http://agdr.org/2020/05/14/Polyglot-Makefiles.html
Re:Why I Prefer Makefiles over Package.json Scripts by Izkata on Monday March 14, 2022 @08:14PM (#30680203)
Nice, being able to mix them is new to me. I thought SHELL could only be set once.
Re:Why I Prefer Makefiles over Package.json Scripts by andreineculau on Monday March 14, 2022 @03:06PM (#30676745)
Nowadays there's Windows Subsystem for Linux. There's no excuse not to successfully run "Linux" scripts on Windows.

I've been running very complex build systems via https://github.com/ysoftwareab/yplatform (disclaimer: author here) since 2016 on Linux, Mac and Windows without a problem.

Re:Why I Prefer Makefiles over Package.json Scripts by mekster on Tuesday March 15, 2022 @06:02AM (#30683483)
Do we not have modern alternatives for make?
Re:Why I Prefer Makefiles over Package.json Scripts by metaltyphoon on Monday March 14, 2022 @03:07PM (#30676766)
That’s why you always provide an nmake for the project :)