Betting_id012/paper/Makefile

38 lines
1.3 KiB
Makefile

.PHONY: all pdf clean
# name of the main TeX file and the output PDF
TARGET = main
# Where to find the paper's stuff
BUILD_PATH = build
FIGS_PATH = figures
BIB_PATH = bib
SOURCE_FILES = $(shell find . -type f -name "*.tex" -print)
CLASS_FILES = $(shell find . -type f -name "*.cls" -print)
BIB_FILES = $(shell find $(BIB_PATH) -type f -name "*.bib" -print)
FIGURES = $(shell find $(FIGURES_PATH) -type f -print)
BUILD_FILES = $(shell find $(BUILD_PATH) -type f -print)
BIB_PROCESSOR := biber
all: pdf
pdf: $(TARGET).pdf
$(TARGET).pdf: $(SOURCE_FILES) $(BIB_FILES) $(CLASS_FILES) $(FIGURES)
@mkdir -p $(BUILD_PATH) > /dev/null 2>&1 || exit 0
@pdflatex -interaction=nonstopmode -jobname=$(TARGET) -output-directory $(BUILD_PATH) $(TARGET).tex
@#if $(BIB_PROCESSOR) == biber
@$(BIB_PROCESSOR) --output-directory $(BUILD_PATH) $(TARGET)
@#elif $(BIB_PROCESSOR) == bibtex
@#@cd $(BUILD_PATH) && $(BIB_PROCESSOR) $(TARGET)
@#fi
@pdflatex -interaction=nonstopmode -jobname=$(TARGET) -output-directory $(BUILD_PATH) $(TARGET).tex # For biber
@pdflatex -interaction=nonstopmode -jobname=$(TARGET) -output-directory $(BUILD_PATH) $(TARGET).tex # For biber
@ln -fs $(BUILD_PATH)/$(TARGET).pdf $(TARGET).pdf
clean:
@rm $(TARGET).pdf $(BUILD_FILES) > /dev/null 2>&1 || exit 0