56 lines
1.7 KiB
Makefile
56 lines
1.7 KiB
Makefile
export PATH:=/usr/local/texlive/2015/bin/x86_64-linux:$(PATH)
|
|
|
|
OUTPUT:=build
|
|
DOC:=$(wildcard *.tex)
|
|
DOCTYPE:=$(shell echo $(DOC) | cut -c1-3)
|
|
FIGURES:=$(wildcard figures/*)
|
|
PDF:=$(OUTPUT)/$(subst .tex,.pdf,$(DOC))
|
|
DEPS:=$(wildcard */*.tex)
|
|
DEPS+=$(wildcard */*/*.tex)
|
|
PDFLATEX_FLAGS:=--output-directory=$(OUTPUT) --shell-escape --file-line-error
|
|
|
|
all: $(PDF)
|
|
|
|
$(PDF): $(DOC) $(DEPS) $(FIGURES) $(OUTPUT)
|
|
@echo " [GEN] pdflatex $<"
|
|
@pdflatex $(PDFLATEX_FLAGS) -interaction=batchmode $< > $(OUTPUT)/pdflatex.log
|
|
@pdflatex $(PDFLATEX_FLAGS) -interaction=batchmode $< >> $(OUTPUT)/pdflatex.log
|
|
@pdflatex $(PDFLATEX_FLAGS) -interaction=nonstopmode $< >> $(OUTPUT)/pdflatex.log
|
|
|
|
copy: $(PDF)
|
|
@echo " [COPY] $^ -> /mnt/copydrive/$(USER)"
|
|
@mkdir -p /mnt/copydrive/$(USER)
|
|
@cp $^ /mnt/copydrive/$(USER)
|
|
|
|
check: $(DOC) $(DEPS)
|
|
@echo " [CHECK] lacheck"
|
|
@lacheck $<
|
|
|
|
# Populate PWD folders to build folder because pdflatex not creates itself
|
|
$(OUTPUT):
|
|
@mkdir -p $@
|
|
@rsync -a -f "+ */" -f "- *" ./ $(OUTPUT)/
|
|
|
|
clean:
|
|
@echo " [CLEAN]"
|
|
@rm -rf release
|
|
@rm -rf $(OUTPUT)
|
|
@rm -rf *.pdf *.log *.lof *.lot *.lol *.aux *.toc *.bbl *.blg *.out
|
|
@rm -rf contents/*.aux
|
|
@rm -rf appendix/*.aux
|
|
|
|
RELEASE_ZIPFILE=$(basename $(DOC)).zip
|
|
release: build/release
|
|
build/release: $(BUILD) $(PDF) copy
|
|
@echo " [GEN] Git tag $(VERSION)"
|
|
@git tag -a "$(VERSION)" -m "New release $(VERSION)"
|
|
@mkdir -p $@
|
|
@echo " [GEN] $(RELEASE_ZIPFILE)"
|
|
@git archive --format zip --output $@/$(RELEASE_ZIPFILE) master
|
|
@echo " [GEN] Git push tag $(VERSION)"
|
|
@git push origin "$(VERSION)"
|
|
@echo " [COPY] $@/$(RELEASE_ZIPFILE) /mnt/copydrive/$(USER)"
|
|
@cp $@/$(RELEASE_ZIPFILE) /mnt/copydrive/$(USER)
|
|
|
|
.PHONY: all copy clean
|