Hacker Public Radio

HPR2107: Makefiles for Everyday Use


Listen Later

In this episode I talk about how I use Makefiles to ease the process of building complicated projects in Lilypond and HTML. You can use Makefiles to run any kinds of commands you want. It does not have to be building actual computer programs. In my case I use them to build musical scores and web pages. Keep in mind I'm not an expert on this, and I'm hoping I will make enough mistakes that it will prompt a series of follow-up episodes by people who actually know what they're talking about.
Here's an example. This is the Makefile for my Counterpoint workbook Gratis ad Parnassum, which I wrote in 2009. Written in a combination of LaTeX
and Lilypond, this requires very complicated and long commands to build the workbook, and I found that the only way to do this project in a sane manner was to create a Makefile that would keep track of changes in the files and only rebuild when necessary. It also meant that the only commands I would have to type were very simple, because the long command line options were all stored in the Makefile.
SHELL=/bin/bashFILE=workbook_mainOUTDIR=outWEBDIR=htmloutVIEWER=evinceBROWSER=firefoxLILYBOOK_PDF=lilypond-book --output=$(OUTDIR) --pdf $(FILE).lytexLILYBOOK_HTML=lilypond-book --output=$(WEBDIR) $(FILE).lytexPDF=cd $(OUTDIR) && pdflatex $(FILE)HTML=cd $(WEBDIR) && latex2html $(FILE)INDEX=cd $(OUTDIR) && makeindex $(FILE)PREVIEW=$(VIEWER) $(OUTDIR)/$(FILE).pdf >& /dev/nullall: pdf webpdf: $(LILYBOOK_PDF) $(PDF) $(INDEX) $(PDF) $(PREVIEW)web: $(LILYBOOK_HTML) $(HTML) cp -R $(WEBDIR)/$(FILE)/ ./ sleep 1 sh html-sed-fixes.sh $(BROWSER) $(FILE)/index.html &keep: pdf cp $(OUTDIR)/$(FILE).pdf gratis.pdf pdftk gratis.pdf update_info gratis.info output GratisAdParnassum.pdfclean: rm -rf $(OUTDIR)web-clean: rm -rf $(WEBDIR)archive: tar -cvvf free-counterpoint.tar  --exclude=out/*  --exclude=*.tar  --exclude=*.zip  --exclude=htmlout/*  --exclude=workbook_main/*  --exclude=*midi  --exclude=*pdf  --exclude=*~  ../FreeCounterpoint/* tar -xvvf free-counterpoint.tar zip -r free-counterpoint.zip FreeCounterpoint rm -R FreeCounterpoint
And here is the Makefile for my song collection called Canciones para niños, using Lilypond source files.
SHELL=/bin/bashpiece = lorca#CPU_CORES=`cat /proc/cpuinfo | grep -m1 "cpu cores" | sed s/".*: "//`LILY_CMD = lilypond -ddelete-intermediate-files                     -dno-point-and-click #-djob-count=$(CPU_CORES)notes = cancioncilla.ily cantada.ily caracola.ily 
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Infinite Monkey Cage by BBC Radio 4

The Infinite Monkey Cage

1,952 Listeners

Click Here by Recorded Future News

Click Here

418 Listeners

Hacker And The Fed by Chris Tarbell & Hector Monsegur

Hacker And The Fed

168 Listeners