# Written by joe # Revision 66480b2b # Variables REVISION := "$(shell git describe --abbrev=8 --dirty --always --tags)" # Paths ROOT := "$(PWD)" BUILDDIR := $(ROOT)/_build SUBMITDIR := $(BUILDDIR)/Brightspace all: pdf submit # Move everything required to builddir copy: mkdir -p $(BUILDDIR) find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" ')' -exec cp {} $(BUILDDIR) \; # Build source in buildir into pdf pdf: copy cd $(BUILDDIR) && find . -name '*.tex' -exec latexmk --shell-escape -pdf {} \; # Package everything into a neat little zip + pdf submit: pdf rm -rvf $(SUBMITDIR) mkdir -p $(SUBMITDIR) find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" -o -name "Makefile" ')' -exec cp {} $(SUBMITDIR) \; cd $(SUBMITDIR) && zip $(REVISION)_source.zip * cp $(BUILDDIR)/*.pdf $(SUBMITDIR) echo "Auto generated using software written by Joe." > $(SUBMITDIR)/README.md echo "This build and all artifacts were built locally on this date: " >> $(SUBMITDIR)/README.md date >> $(SUBMITDIR)/README.md # cleanup cd $(SUBMITDIR) && find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" -o -name "Makefile" ')' -exec rm {} \; # Clean all clean: git clean -fdX rm -rvf $(SUBMITDIR)