Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created June 27, 2019 16:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpickering/a756ea7219f9e182c2e5f266a7fa80d4 to your computer and use it in GitHub Desktop.
Save mpickering/a756ea7219f9e182c2e5f266a7fa80d4 to your computer and use it in GitHub Desktop.
.PHONY: all $(SOURCE_NAMES) lhs compile build-dir
### Constants ###
BUILD := build
PAPER := implicits
OUTPUT := $(BUILD)/$(PAPER).pdf
LHS := $(shell find src -type f -name '*.lhs')
SOURCES := $(shell find src -type f -name 'Main.lhs')
SOURCE_NAMES := $(SOURCES:%.lhs=%)
all: $(OUTPUT)
build-dir:
mkdir -p $(BUILD)
### Final pdf ###
$(OUTPUT): $(SOURCE_NAMES) build-dir
texfot --no-stderr latexmk -interaction=nonstopmode -pdf -no-shell-escape -bibtex -jobname=$(BUILD)/$(PAPER) $(BUILD)/Main.tex
### lhs2tex ###
lhs: $(SOURCE_NAMES)
$(SOURCE_NAMES): build-dir $(LHS)
@echo "lhs2TEX: Compiling $@.lhs"
@lhs2TeX -P "src:" $@.lhs -o $(BUILD)/$(notdir $@).tex
compile:
cabal new-build generic-lens-paper
clean:
rm -rf $(BUILD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment