Add better variables and readability
This commit is contained in:
@@ -1,35 +1,42 @@
|
||||
# Written by joe
|
||||
|
||||
|
||||
# Variables
|
||||
REVISION := "$(shell git describe --abbrev=8 --dirty --always --tags)"
|
||||
|
||||
# Paths
|
||||
ROOT := "$(PWD)"
|
||||
BUILDDIR := $(ROOT)/_build
|
||||
SUBMITDIR := $(BUILDDIR)/Brightspace
|
||||
|
||||
|
||||
|
||||
all: pdf submit
|
||||
|
||||
|
||||
# Move all files to the build dir
|
||||
# Move everything required to builddir
|
||||
copy:
|
||||
mkdir -p _build
|
||||
find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" ')' -exec cp {} _build \;
|
||||
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 _build && find . -name '*.tex' -exec latexmk --shell-escape -pdf {} \;
|
||||
cd $(BUILDDIR) && find . -name '*.tex' -exec latexmk --shell-escape -pdf {} \;
|
||||
|
||||
submit: pdf
|
||||
rm -rvf brightspace
|
||||
mkdir -p brightspace
|
||||
find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" ')' -exec cp {} brightspace \;
|
||||
cd brightspace && zip $(REVISION)_source.zip *
|
||||
cp _build/*.pdf brightspace
|
||||
rm -rvf $(SUBMITDIR)
|
||||
mkdir -p $(SUBMITDIR)
|
||||
find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" ')' -exec cp {} $(SUBMITDIR) \;
|
||||
cd $(SUBMITDIR) && zip $(REVISION)_source.zip *
|
||||
cp $(BUILDDIR)/*.pdf $(SUBMITDIR)
|
||||
|
||||
echo "Auto generated using software written by Joe." > brightspace/README.md
|
||||
echo "This build and all artifacts were built locally on this date: " >> brightspace/README.md
|
||||
date >> brightspace/README.md
|
||||
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 brightspace && find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" ')' -exec rm {} \;
|
||||
cd $(SUBMITDIR) && find -type f '(' -name "*.tex*" -o -name "*.sty*" -o -name "*.bib" ')' -exec rm {} \;
|
||||
|
||||
|
||||
clean:
|
||||
git clean -fdX
|
||||
rm -rvf brightspace
|
||||
rm -rvf $(SUBMITDIR)
|
||||
|
||||
Reference in New Issue
Block a user