diff --git a/Makefile b/Makefile index b578626..6d25a74 100644 --- a/Makefile +++ b/Makefile @@ -15,32 +15,53 @@ LATEXMK_FLAGS += -outdir=${OUT} LATEXMK_FLAGS += -pdflatex="pdflatex -file-line-error --shell-escape %O %S" # LATEXMK_FLAGS += -e '$$makeindex=q/sh -c "cd `dirname "%D"`" ; makeindex %O -o "`basename "%D"`" "`basename "%S"`";/' +DIST := $(shell lsb_release -si) +PLATFORM := $(shell uname) all: build setup: - @sudo apt update + @echo "Current Platform: $(PLATFORM)" + @echo "Current Distribution: $(DIST)" +ifeq ($(PLATFORM),Linux) +ifeq ($(DIST),$(shell echo -n "${DIST}" | grep "Ubuntu\|Debian\|Kali")) @sudo apt install texlive-latex-base texlive-lang-portuguese texlive-lang-english biber texlive-latex-extra texlive-science python3-pygments python3-proselint pandoc imagemagick latexmk ghostscript lacheck chktex +else + @echo "Distribution not supported. Currently we support setup for: Ubuntu, Debian and Kali" +endif +else + @echo "Platform not supported. Currently we support setup for: Linux" +endif build: + @echo "Building the document" @mkdir -p "${OUT}/chapters" cd "${OUT}" ; "${LATEXMK}" ${LATEXMK_FLAGS} -cd "${SRC}/cover.tex" "${SRC}/matter.tex" preview: build + @echo "Creating a preview PDF" ("${LATEXMK}" ${LATEXMK_FLAGS} -pvc -cd "${SRC}/cover.tex" & "${LATEXMK}" ${LATEXMK_FLAGS} -pvc -cd "${SRC}/matter.tex") print: build + @echo "Creating print PDF" gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile="${OUT}/thesis-print.pdf" "${OUT}/matter.pdf" "${SCRIPTS}/simplify-colors.sh" "${OUT}/thesis-print.pdf" ebook: build + @echo "Creating ebook PDF" gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="${OUT}/thesis-ebook.pdf" "${OUT}/matter.pdf" clean: + @echo "Deleting all files except PDFs in the build directory" @find "${OUT}" -type f ! -name '*.pdf' -delete @find "${OUT}"/* -type d -delete +clean_aux: + @echo "Deleting AUX files in the build directory" + @find "${OUT}" -type f -name '*.aux' -delete + cleanall: + @echo "Deleting all files in the build directory" @rm -rf "${OUT}/*" lint: