-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
74 lines (54 loc) · 2.26 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This file is essentially a copy of the Makefile in the agda-categories library by Jacques Carette.
# The only difference is that this version works with .lagda files instead of .agda files.
# The original Makefile from agda-categories is https://github.com/agda/agda-categories/blob/master/Makefile
.PHONY: test Everything.agda clean md html profile latex pandoc
OTHEROPTS=
RTSARGS = +RTS -M6G -A128M ${OTHEROPTS} -RTS
# Locations
SRCDIR := src
TEXDIR := tex
LATEXDIR := latex
HTMLDIR := html
INCLDIR := _includes
# File names
SRC := $(shell find $(SRCDIR) -name "*.lagda")
MODULES := $(shell find $(SRCDIR) -name "*.lagda" | sed -e 's|^src/[/]*||' -e 's|/|.|g')
TEXFILES = $(shell find . -name "*.tex")
TEXMDFILES = $(wildcard $(HTMLDIR)/*.tex)
MDFILES = $(TEXMDFILES:.tex=.md)
LINKFILE = $(INCLDIR)/UALib.Links.md
default: Everything.agda
all: html Everything.agda md $(MDFILES)
@echo "target: $@ prereq: $<"
test: Everything.agda
@echo "target: $@ prereq: $<"
agda ${RTSARGS} $(SRCDIR)/Everything.agda
Everything.agda:
@echo "target: $@ prereq: $<"
git ls-tree --full-tree -r --name-only HEAD | grep '^src/[^\.]*.lagda' | sed -e 's|^src/[/]*|import |' -e 's|/|.|g' -e 's/.lagda//' -e '/import Everything/d' | LC_COLLATE='C' sort > $(SRCDIR)/Everything.agda
# Make markdown files for html documentation served by jekyll
md: html $(MDFILES)
@echo "target: $@ prereq: $<"
docs: html $(HTMLDIR)/index.markdown $(TEXDIR)/agda-algebras.tex
@echo "target: $@ prereq: $<"
html: Everything.agda
@echo "target: $@ prereq: $<"
@echo $@
agda ${RTSARGS} --html --html-highlight=code $(SRCDIR)/Everything.agda
$(HTMLDIR)/index.markdown: $(HTMLDIR)/agda-algebras.md
@echo "target: $@ prereq: $<"
cp $< $@
## Rule for converting all the agda generated markdown files from .tex to .md
$(MDFILES): $(TEXMDFILES)
@echo "target: $@ prereq: $<"
mv $< $@
clean:
find . -name '*.agdai' -exec rm \{\} \;
profile: Everything.agda
@echo "target: $@ prereq: $<"
agda ${RTSARGS} -v profile:7 -v profile.definitions:15 $(SRCDIR)/Everything.agda
# ## default rule for converting a markdown file to a latex file
# %.tex: %.md
# @echo "target: $@ prereq: $<"
# cat $(LINKFILE) >> $< ## first add links to bottom of md so pandoc can insert them as \hrefs
# pandoc -f markdown -t latex $< -o $@