Add better variables and readability

This commit is contained in:
Kenwood 2022-02-08 11:50:35 -05:00
parent 2e1ebf7482
commit da9d81f2a0
3 changed files with 22 additions and 17 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
_build
*.*#
brightspace/

View File

@ -1,2 +1 @@
_build
brightspace/

View File

@ -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)