ninja - a simple way to do builds

https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/

  • This looks like a more intuitive make, which I still find myself having to look up (basic) documentation for. This might be a good replacement for dotfile management (unless I change things more significantly and use stow instead).
  • https://ninja-build.org/

ninja is an EXTREMELY SIMPLE build system. ninja is not complicated! Here is literally everything I know about ninja build file syntax: how to create a rule and a build:

a rule has a command and description (the description is just for humans to read so you can tell what it’s doing when it’s building your code)

rule svg2pdf  
  command = inkscape $in --export-text-to-path --export-pdf=$out  
  description = svg2pdf $in $out  

the syntax for build is build output_file: rule_name input_files. Here’s one using the svg2pdf rule. The output goes in $out in the rule and the input goes in $in.

build pdfs/variables.pdf: svg2pdf variables.svg  

That’s it! If you put those two things in a file called build.ninja and then run ninja, ninja will run inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf.

And then if you run it again, it won’t run anything (because it can tell that you’ve already built pdfs/variables.pdf and you’re up to date)

Edit