Skip to content

Commit

Permalink
Detect distribution and platform on setup and add status messages. Ad…
Browse files Browse the repository at this point in the history
…dresses #49
  • Loading branch information
jpbarraca committed Jun 13, 2024
1 parent 3781d95 commit c748079
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c748079

Please sign in to comment.