# set latexfile to the name of the main file without the .tex latexfile = matmul TARGETDIR = ~/public_html/Courses/P2200_15F/downloads LATEX = pdflatex PDFVIEWER = evince EDITOR = /usr/bin/emacs -fn 9x15 -g 90x34+100+40 CC = clang GNUPLOT = gnuplot INDENT = indent LDFLAGS = -Ofast CFLAGS = -Weverything -Wextra -pedantic $(LDFLAGS) LIBS += -lopenblas -lpthread -lm .SUFFIXES: .SUFFIXES: .o .c .res .tex .PHONY: clean show pdf veryclean indent %.res: matmul-%-$(CC) ./$< > $@ & all: matmul-naive-$(CC) matmul-dgemm-$(CC) OBJS = matmul-driver.o matmul-dgemm-drv.o timer.o SRCS = $(OBJS:.o=.c) HDRS = $(OBJS:.o=.h) DEPS = $(OBJS:.o=.d) matmul-dgemm-$(CC): $(OBJS) $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ OBJS1 = matmul-driver.o matmul-naive-drv.o matmul-naive.o timer.o SRCS1 = $(OBJS1:.o=.c) HDRS1 = $(OBJS1:.o=.h) DEPS1 = $(OBJS1:.o=.d) matmul-naive-$(CC): $(OBJS1) $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ indent: $(INDENT) $(SRCS) $(SRCS1) show: naive.res dgemm.res performance.gp $(GNUPLOT) performance.gp evince performance.pdf >& /dev/null & pdf: $(latexfile).tex performance.pdf performance.gp matmul-naive.c while ($(LATEX) $(latexfile) ; \ grep -q "Rerun to get cross" $(latexfile).log ) do true ; \ done edit: $(latexfile).tex $(EDITOR) $(latexfile).tex 2> /dev/null & clean: rm -f matmul-dgemm-$(CC) $(OBJS) $(DEPS) rm -f matmul-naive-$(CC) $(OBJS1) $(DEPS1) rm -f $(latexfile).log rm -f $(latexfile).out rm -f $(latexfile).aux rm -f *.*~ veryclean: clean rm -f naive.res dgemm.res rm -f performance.pdf rm -f $(latexfile).pdf upload: pdf clean chmod go+r $(latexfile).pdf mv $(latexfile).pdf $(TARGETDIR)