Basic Makefile created

This commit is contained in:
Louis Burke 2023-03-29 17:34:41 -04:00
parent 7628a5e2c1
commit be4f1a44ea
3 changed files with 51 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# Documents
*.pdf
*.html

37
Makefile Normal file
View file

@ -0,0 +1,37 @@
.PHONY: default docs clean
# Adapted from https://dev.to/eugenebabichenko/generating-pretty-version-strings-including-nightly-with-git-and-makefiles-48p3
DIRTY=$(shell git status --porcelain | head -1 | sed 's/.*/-dirty/g')
COMMIT=$(shell git rev-parse --short HEAD)
DATE=$(shell git log -1 --format=%cd --date=format:"%Y%m%d")
LAST_TAGGED_COMMIT=$(shell git rev-list --abbrev-commit --tags --max-count=1)
LAST_TAG=$(shell git describe --abbrev=0 --tags $(LAST_TAGGED_COMMIT) 2>/dev/null || true)
PATCH=$(patsubst %,-%-$(DATE),$(filter-out $(COMMIT),$(LAST_TAGGED_COMMIT)))
VERSION=$(LAST_TAG:v%=%)$(PATCH)$(DIRTY)
default: all
# List of documents to produce from markdown
DOCUMENTS=README
HTML_DOCS=$(patsubst %,%.html,$(DOCUMENTS))
PDF_DOCS=$(patsubst %,%.pdf,$(DOCUMENTS))
all: docs
docs: $(HTML_DOCS) $(PDF_DOCS)
%.html: %.md
sed 's/%VERSION%/$(VERSION)/g' $^ | multimarkdown -t html > $@
%.pdf: %.md
sed 's/%VERSION%/$(VERSION)/g' $^ | multimarkdown -t latex > $*.tex
pdflatex $*.tex
pdflatex $*.tex
-rm $*.aux $*.toc $*.log $*.tex $*.out
clean:
-rm $(HTML_DOCS) $(PDF_DOCS)
print-%:
@echo '$*: $($*)'

View file

@ -1 +1,12 @@
vi: spell:spelllang=en:tw=72
Author: Louis A. Burke
Affiliation: labprogramming.net
Title: FLIT -- README
CSS: ./flit.css
Language: en
LaTeX Leader: flit-leader.tex
LaTeX Begin: flit-begin.tex
LaTeX Footer: flit-footer.tex
LaTeX Header Level: 3
# Four-Letter Interleaved T(ask/est) Protocol