- <http://makefiletutorial.com/>
- https://gromnitsky.users.sourceforge.net/articles/notes-for-new-make-users/
TARGET = yourprogrammtitlehere
LIBS = -lm
CC = gcc
CFLAGS = -g -Wall
.PHONY: default all clean
default: $(TARGET)
all: default
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
HEADERS = $(wildcard *.h)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@
clean:
-rm -f *.o
-rm -f $(TARGET)
TEX = $(wildcard *.tex)
PDF = $(TEX:.tex=.pdf)
TEMPFILES = *.fls *.aux *.log *.fdb_latexmk
LATEXMK = latexmk
LATEXMKFLAGS = -pdf -interaction=batchmode --shell-escape
all: $(PDF)
.PHONY: all
test:
echo $(TEX)
echo $(PDF)
%.pdf: %.tex
$(LATEXMK) $(LATEXMKFLAGS) $<
show:
zathura $(PDF) > /dev/null 2>&1 &
clean:
rm -f $(TEMPFILES) $(PDF)