Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cfgnunes committed Aug 5, 2023
1 parent 08bd72d commit 48b947d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cefetmg.cls
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% -----------------------------------------------------------------------------

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cefetmg}[2021/05/04 v9.0]
\ProvidesClass{cefetmg}[2023/08/05 v9.0.1]

% Captura a opção 'nomecapitulo' para imprimir a palavra "Capítulo" no início
\providecommand{\flagnomecapitulo}{false}
Expand Down
44 changes: 19 additions & 25 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,54 @@ SVG_FILES = $(shell find . -type f -iname "*.svg")

.PHONY: default help compile compress clean

default: compress
default: compile

help:
@echo "'make': Gera o documento em PDF."
@echo "'make compress': Gera o documento em PDF (compactado)."
@echo "'make clean': Remove os arquivos gerados."
@echo
@echo "Usage:"
@echo " make : Create the PDF document."
@echo " make compress : Create the compressed PDF document."
@echo " make clean : Remove generated files."
@echo ""

compile: $(OUTPUT_DIR)/$(SRC).pdf

$(OUTPUT_DIR)/$(SRC).pdf: $(TEX_FILES) $(IMG_FILES) $(PDF_FILES) $(SVG_FILES:.svg=.pdf)
@echo "Compilando o projeto..."
@echo "Building the project..."
@mkdir -p $(OUTPUT_DIR)
@latexmk \
-pdf \
-synctex=1 \
-output-directory=$(OUTPUT_DIR) \
$(SRC).tex 2>/dev/null
-output-directory=$(OUTPUT_DIR) $(SRC).tex
@touch $(OUTPUT_DIR)/$(SRC).pdf
@echo "Pronto!"
@echo "Done!"
@echo

%.pdf: %.svg
@echo "Convertendo imagem SVG para PDF..."
@echo " > convertendo '$<'..."
@inkscape \
--without-gui \
--export-area-drawing \
--export-pdf-version=1.5 \
--export-margin=1 \
--file=$< \
--export-pdf=$@ 2>/dev/null
@echo "Pronto!"
@echo "Converting SVG files to PDF format..."
@echo " > converting '$<'..."
@inkscape --export-area-drawing --export-margin=1 --export-filename=$@ $<
@echo "Done!"
@echo

compress: $(OUTPUT_DIR)/$(SRC_COMP).pdf

$(OUTPUT_DIR)/$(SRC_COMP).pdf: $(OUTPUT_DIR)/$(SRC).pdf
@echo "Compactando o arquivo final..."
@echo "Compressing the document..."
@gs \
-q \
-dNOPAUSE \
-dBATCH \
-dSAFER \
-dFastWebView \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/printer \
-sOutputFile=$(OUTPUT_DIR)/$(SRC_COMP).pdf \
$(OUTPUT_DIR)/$(SRC).pdf 2>/dev/null
$(OUTPUT_DIR)/$(SRC).pdf
@touch $(OUTPUT_DIR)/$(SRC_COMP).pdf
@echo "Pronto!"
@echo "Done!"
@echo

clean:
@echo "Limpando arquivos gerados..."
@echo "Cleaning up generated files..."
@rm -rf $(OUTPUT_DIR)
@echo "Pronto!"
@echo "Done!"
@echo

0 comments on commit 48b947d

Please sign in to comment.