Last active
October 24, 2018 11:34
-
-
Save HeMe2/7f7691678e19f27629d07da8471ed7b4 to your computer and use it in GitHub Desktop.
makefile to compile latex files in linux environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# insert preferred tools here | |
CC = pdflatex | |
BIB = bibtex | |
READER = xreader | |
# name of your main tex file without file extension | |
NAME = my_document | |
# files your document depends on, eg. bibliography or pictures | |
ADD = | |
SRC = $(NAME).tex | |
BIN = $(NAME).pdf | |
$(BIN): $(SRC) $(ADD) | |
$(CC) $(SRC) | |
$(BIB) $(NAME).aux | |
makeglossaries $(NAME) | |
$(CC) $(SRC) | |
$(CC) $(SRC) | |
# open your compiled file in a viewer | |
visible: $(BIN) | |
make $(BIN) | |
$(READER) $(BIN) & | |
.PHONY: clean tidy touch one | |
# delete all build files | |
clean: tidy | |
rm $(BIN)& | |
# delete all auxiliary build files, but not the final pdf | |
tidy: | |
rm `ls |grep -P -e '$(NAME)\.((?!(pdf)|(tex))(.*)|.{3}\..*)'`& | |
# build everything (useful if you forgot any document in the ADD variable) | |
touch: | |
make -B $(BIN) | |
# rebuild everything | |
rebuild: | |
make clean | |
make $(BIN) | |
# just compile once (useful for typo correction etc.) | |
one: | |
$(CC) $(SRC) | |
# just compile the bibliography | |
bib: | |
$(BIB) $(NAME) | |
# just refresh the glossaries | |
glossaries: | |
makeglossaries $(NAME) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment