gdritter repos lib-static / 87de888
Cleaning up Makefile Getty Ritter 9 years ago
1 changed file(s) with 15 addition(s) and 16 deletion(s). Collapse all Expand all
1 # basic pages that will always exist:
2
3 # Maybe we want to override this?
4 OUTDIR=output
5 DATADIR=/home/getty/projects/lib-data
6
1 # The set of basic pages we want to generate
72 pages=$(OUTDIR)/quotes/index.html $(OUTDIR)/quips/index.html \
83 $(OUTDIR)/links/index.html $(OUTDIR)/category/index.html \
94 $(OUTDIR)/index.html
105
6 # The static files we just need to copy
117 static_tgt=$(OUTDIR)/static/jquery.js \
128 $(OUTDIR)/static/main.css \
139 $(OUTDIR)/static/quotes.js
10
11 # (We should generate this list another way, but it's unlikely to
12 # change with any regularity)
13 cats_src=comics fascicles poems stories
1414
1515 # We find all the stuff we want to generate...
1616 quotes_src=$(wildcard $(DATADIR)/quotes/*)
1717 quips_src=$(wildcard $(DATADIR)/quips/*)
1818 links_src=$(wildcard $(DATADIR)/links/*)
1919 works_src=$(notdir $(wildcard $(DATADIR)/works/*/*))
20 cats_src=comics fascicles poems stories
2120
2221 # and figure out what the $(OUTDIR) file will be called by matching
2322 # on the input file.
2625 links_tgt=$(links_src:$(DATADIR)/links/%=$(OUTDIR)/links/%/index.html)
2726 cats_tgt=$(cats_src:%=$(OUTDIR)/category/%/index.html)
2827
29 # I'm doing this manually for now.
30
31 # this is kind of gross---the problem is that I do want to store
32 # 'works' (other writing) inside directories that correspond to their
33 # kind, but don't want that in the output, so I can't straightforwardly
34 # use patsubst like above: I'd have to write something like
35 # works_src:$(DATADIR)/works/*/%=$(OUTDIR)/%/index.html
36 # which doesn't work. I could also filter out all the known kinds of
37 # works through other wildcard magic. instead, I just shell out to sed.
3828 works_tgt=$(works_src:%=$(OUTDIR)/%/index.html)
3929
30 # ------------------------------------------------------------------------------
4031
4132 all: $(pages) $(quotes_tgt) $(quips_tgt) $(links_tgt) $(works_tgt) \
4233 $(cats_tgt) $(static_tgt)
34
35 # ------------------------------------------------------------------------------
4336
4437 # A lot of these are boringly similar: probably should come up with a way of abstracting
4538 # this common pattern, but, y'know, Make...
5649 mkdir -p `dirname $@`
5750 bin/link.sh $(DATADIR) all >$@
5851
52 # ------------------------------------------------------------------------------
53
5954 $(OUTDIR)/quotes/%/index.html: $(DATADIR)/quotes/% templates/quote.mustache templates/main.mustache
6055 mkdir -p `dirname $@`
6156 bin/quote.sh $(DATADIR) $< >$@
6762 $(OUTDIR)/links/%/index.html: $(DATADIR)/links/% templates/link.mustache templates/main.mustache
6863 mkdir -p `dirname $@`
6964 bin/link.sh $(DATADIR) $< >$@
65
66 # ------------------------------------------------------------------------------
7067
7168 $(OUTDIR)/%/index.html: $(DATADIR)/works/*/% templates/textpage.mustache templates/main.mustache
7269 mkdir -p `dirname $@`
8077 mkdir -p `dirname $@`
8178 bin/all-categories.sh $(DATADIR) >$@
8279
80 # ------------------------------------------------------------------------------
81
8382 $(OUTDIR)/index.html: $(OUTDIR)/index/index.html
8483 cp $< $@
8584