diff --git a/Makefile b/Makefile index b6ea5f9c..04b1ee0b 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,65 @@ -#SILENT:="-silent" -SILENT:=-interaction=batchmode -SYNCTEX:=1 +############################################################################# +# CUSTOMIZATION AREA HERE +############################################################################# +# If you want to force the name of the main file, uncomment the following command +# MF:="YOUR_MAIN_TEX_FILE" # without the ".tex" extension + +# Define V to the ommand to the name of your PDF viewer +V:=open -a skim + + +############################################################################# +# DO NOT TOUCH BELOW THIS POINT +############################################################################# + +# If a file "tempalte.tex" is found, use it as the main file +# otherwise, use the first (alphabetically) .tex file found as the main file +ifeq ($(MF),) +TEX:=$(patsubst %.tex,%,$(wildcard *.tex)) +MF:=$(findstring template,$(TEX)}) +ifeq ($(MF),) +MF:=$(word 1,$(TEX)) +endif +endif + +# Find out which versions of TeX live are available (works for macos) TEXVERSIONS=$(shell ls /usr/local/texlive/ | fgrep -v texmf-local) -TIMES=$(shell printf "TIMMINGS for last run:" ;\ - fgrep "TIME process" -A 1 *.log | while read a; do \ - read b; read c; \ - S=`echo $$a | cut -d ' ' -f3 | cut -d '=' -f 1`; \ - T=`echo $$b | cut -d ':' -f 2 | cut -d ' ' -f 2`; \ - printf "\n%12s = %7.2f s" "$$S" "$$T"; \ - done | tr '\n ' '\1\2') - -B:=template -F:=-time -shell-escape -synctex=$(SYNCTEX) -output-format=pdf -file-line-error $(FLAGS) -T:=$(B).pdf -S:=$(B).tex + +# Customize latex compilation +SILENT:=-interaction=batchmode #-silent +SYNCTEX:=1 +B:=$(MF) +T:=$(MF).pdf +S:=$(MF).tex + L:=latexmk $(F) -V:=open -a skim +F:=-time -shell-escape -synctex=$(SYNCTEX) -output-format=pdf -file-line-error $(FLAGS) + +# target and files to be incldued in "make zip" +ZIPFILES:=NOVAthesisFiles Bibliography Config Chapters LICENSE Makefile novathesis.cls README.md .gitignore template.tex +ZIPTARGET:=$(B)-$(VERSION)@$(DATE).zip -ZIPFILES:=NOVAthesisFiles Bibliography Config Chapters LICENSE Makefile novathesis.cls README.md .gitignore template.tex latexmkrc +# extract version and date of the template VERSION=$(shell head -1 NOVAthesisFiles/nt-version.sty | sed -e 's/.*{//' -e 's/\(.*\)./\1/') DATE:=$(shell tail -1 NOVAthesisFiles/nt-version.sty | sed -e 's/.*{//' -e 's/\(.*\)./\1/' | tr '\n' '@'m| sed -e 's/\(.*\)./\1/') -ZIPTARGET:=$(B)-$(VERSION)@$(DATE).zip -AUXFILES:=$(shell ls $(B)*.* | fgrep -v .tex | fgrep -v $(B).pdf | sed 's: :\\ :g' | sed 's:(:\\(:g' | sed 's:):\\):g') +# aux files +AUXFILES:=$(shell ls $(B)*.* | fgrep -v .tex | fgrep -v .pdf | sed 's: :\\ :g' | sed 's:(:\\(:g' | sed 's:):\\):g') + +# schools requiring XeLaTeX or LuaLaTeX (incompatible with pdfLaTeX) LUA="other/esep uminho/ea uminho/ec uminho/ed uminho/ee uminho/eeg uminho/elach uminho/em uminho/ep uminho/ese uminho/ics uminho/ie uminho/i3b" + +# Extract school being built SCHL=$(shell grep -v "^%" Config/1_novathesis.tex | grep "ntsetup{school=" | cut -d "=" -f 2 | cut -d "}" -f 1) ifeq ($(SCHL),) SCHL=nova/fct endif - - .PHONY: default default: - @$(shell git status | fgrep README.md && (Scripts/toc_readme.sh; git add README.md; git commit -m 'Updated README.md')) + # @$(shell if test -f Scripts/toc_readme.sh; then git status | fgrep README.md && (Scripts/toc_readme.sh; git add README.md; git commit -m 'Updated README.md'; fi)) @echo SCHL=$(SCHL) ifeq ($(findstring $(SCHL),$(LUA)),) make pdf @@ -44,95 +68,117 @@ else endif -$(T): $(S) - $(MAKE) +############################################################################# +# Main targets: +# pdf/xe/lua build with Tex-Live +# tl pdf/xe/lua build with Tex-Live +# mik pdf/xe/lua build with MikTeX +# year pdf/xe/lua build with Tex-Live release for (if available, otherwise defaults release) +# v/view build with pdfLaTeX +# zip build a ZIP archive with the source files +############################################################################# + +#———————————————————————————————————————————————————————————————————————————— +# TeX-Live +.PHONY: tl +tl: + hash -r + make $(filter-out $@,$(MAKECMDGOALS)) -.PHONY: pdf -pdf: $(S) - $(L) -pdf $(SILENT) $(B) - @echo $(TIMES) | tr '\1@\2' '\n\t ' +#———————————————————————————————————————————————————————————————————————————— +# MikTeX +.PHONY: mik +mik: + hash -r + PATH="$(HOME)/bin:$(PATH)" make $(filter-out $@,$(MAKECMDGOALS)) -.PHONY: xe lua -xe lua: $(S) - $(L) -pdf$@ $(SILENT) $(B) +#———————————————————————————————————————————————————————————————————————————— +# TL Release (e.g., 2022) +.PHONY: $(TEXVERSIONS) +$(TEXVERSIONS): + hash -r + PATH="$(wildcard /usr/local/texlive/$@/bin/*-darwin/):$(PATH)" make $(filter-out $@,$(MAKECMDGOALS)) + +#———————————————————————————————————————————————————————————————————————————— +.PHONY: pdf xe lua +pdf xe lua: $(S) + $(L) -pdf$(patsubst pdf%,%,$@) $(SILENT) $(B) @echo $(TIMES) | tr '\1@\2' '\n\t ' + @$(call times) +#———————————————————————————————————————————————————————————————————————————— .PHONY: v view v view: $(T) $(V) $(T) +#———————————————————————————————————————————————————————————————————————————— +$(T): $(S) + make default + +#———————————————————————————————————————————————————————————————————————————— .PHONY: vv verb verbose vv verb verbose: $(L) -pdf $(B) @echo $(TIMES) | tr '\1@\2' '\n\t ' -.PHONY: $(TEXVERSIONS) -$(TEXVERSIONS): - hash -r - PATH="$(wildcard /usr/local/texlive/$@/bin/*-darwin/):$(PATH)" make $(filter-out $@,$(MAKECMDGOALS)) - -.PHONY: mik -mik: - hash -r - # echo $(filter-out mik,$(MAKECMDGOALS)) - PATH="$(HOME)/bin:$(PATH)" make $(filter-out $@,$(MAKECMDGOALS)) - +#———————————————————————————————————————————————————————————————————————————— .PHONY: zip zip: rm -f "$(ZIPTARGET)" zip --exclude .github --exclude .git -r "$(ZIPTARGET)" $(ZIPFILES) + +#———————————————————————————————————————————————————————————————————————————— .PHONY: clean clean: @$(L) -c $(B) @rm -f $(AUXFILES) "*(1)*" @find . -name .DS_Store -o -name '_minted*' | xargs rm -rf +#———————————————————————————————————————————————————————————————————————————— +.PHONY: gclean gclean: git clean -fdx -e Scripts -e Fonts -.PHONY: rc -rc: - Scripts/latex-clean-temp.sh - -.PHONY: rcb -rcb: - Scripts/latex-clean-temp.sh +#———————————————————————————————————————————————————————————————————————————— +.PHONY: bclean +bclean: rm -rf `biber -cache` biber -cache + make clean +#———————————————————————————————————————————————————————————————————————————— .PHONY: publish publish: +ifneq (, $(shell ls Scripts/publish.sh)) Scripts/publish.sh +endif +#———————————————————————————————————————————————————————————————————————————— .PHONY: bump1 bump2 bump3 -bump1: - Scripts/newversion.sh 1 - @echo make mtp - # $(MAKE) publish - -bump2: - Scripts/newversion.sh 2 - @echo make mtp - # $(MAKE) publish - -bump3: - Scripts/newversion.sh 3 - @echo make mtp - # $(MAKE) publish - -.PHONY: times mtp -times: - @echo $(TIMES) | tr '\1@\2' '\n\t ' -# fgrep "TIME process" -A 1 *.log | while read a; do \ -# read b; read c; \ -# S=`echo $$a | cut -d ' ' -f3 | cut -d '=' -f 1`; \ -# T=`echo $$b | cut -d ':' -f 2`; \ -# echo TIME $$S =$$T; \ -# done +bump1 bump2 bump3: +ifneq (, $(shell ls Scripts/newversion.sh)) + Scripts/newversion.sh $(subst bump,,$@) + @$(call mtp) +endif + +############################################################################# +# FUNCTIONS +############################################################################# +#———————————————————————————————————————————————————————————————————————————— +define times + @printf "TIMES FROM THE LAST EXECUTION\n" + @declare TIMES="$(shell grep -e 'l3benchmark. + TOC' *.log | cut -d ' ' -f 4)";\ + declare PHASES="$(shell fgrep TIME *.log | cut -d ' ' -f 2-3 | cut -d '=' -f 1 | tr ' ' '_')";\ + declare -a TM=($${TIMES});\ + declare -a PH=($${PHASES});\ + for i in `seq 1 $$(($${#TM[@]}-1))`; do\ + printf "%20s = %6.2f\n" "$${PH[$$i]}" "$${TM[$$i]}";\ + done +endef # merge, tag and push -mtp: +define mtp make clean git cam "Version $(VERSION)." git checkout main @@ -142,3 +188,4 @@ mtp: git push --all git push --tags git checkout develop +endef diff --git a/NOVAthesisFiles/nt-version.sty b/NOVAthesisFiles/nt-version.sty index 17ad2693..389e29a7 100644 --- a/NOVAthesisFiles/nt-version.sty +++ b/NOVAthesisFiles/nt-version.sty @@ -1,2 +1,2 @@ -\newcommand*{\novathesisversion}{7.1.19} -\newcommand*{\novathesisdate}{2024-03-28} +\newcommand*{\novathesisversion}{7.1.21} +\newcommand*{\novathesisdate}{2024-04-08} diff --git a/novathesis.cls b/novathesis.cls index e52aa016..ba13a116 100644 --- a/novathesis.cls +++ b/novathesis.cls @@ -8,7 +8,7 @@ %% To view a copy of this license, visit %% https://www.latex-project.org/lppl/lppl-1-3c/ %% -%% Version 2024-03-28 [7.1.19] +%% Version 2024-04-08 [7.1.21] %% Departamento de Informática (www.di.fct.unl.pt) %% Faculdade de Ciências e Tecnologia (www.fct.unl.pt) %% Universidade NOVA de Lisboa (www.unl.pt) @@ -54,7 +54,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\ProvidesClass{novathesis}[2024-03-28 novathesis template] +\ProvidesClass{novathesis}[2024-04-08 novathesis template] \NeedsTeXFormat{LaTeX2e}[2020-02-02] diff --git a/template.tex b/template.tex index eeaa7cd9..78333abe 100644 --- a/template.tex +++ b/template.tex @@ -8,7 +8,7 @@ %% To view a copy of this license, visit %% https://www.latex-project.org/lppl/lppl-1-3c/ %% -%% Version 2024-03-28 [7.1.19] +%% Version 2024-04-08 [7.1.21] %% Departamento de Informática (www.di.fct.unl.pt) %% Faculdade de Ciências e Tecnologia (www.fct.unl.pt) %% Universidade NOVA de Lisboa (www.unl.pt)