|
|
|
CC=clang
|
|
|
|
|
|
|
|
CFLAGS=-std=c99 -Wextra -pedantic -g -O0
|
|
|
|
|
|
|
|
CC_OPENMP=gcc # no OpenMP in our clang
|
|
|
|
CFLAGS_OPENMP=$(CFLAGS) -fopenmp
|
|
|
|
|
|
|
|
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs \
|
|
|
|
ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom \
|
|
|
|
wo-lernen lua-foo binsearch test-inline-assembly uiowa-threads-example \
|
|
|
|
mtrace-test av-variance undefined-behaviour \
|
|
|
|
multibrot-openmp hello-openmp mandelbrot-openmp \
|
|
|
|
positional-format-strings
|
|
|
|
EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s tags \
|
|
|
|
mtrace-test.trace mtrace-test.txt multibrot-openmp.png
|
|
|
|
VERYEXTRAS=cppcheck.txt
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: $(TARGETS)
|
|
|
|
|
|
|
|
.PHONY: really-all
|
|
|
|
really-all: all $(EXTRAS)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f $(TARGETS) $(EXTRAS) $(VERYEXTRAS) *.o *~
|
|
|
|
|
|
|
|
.PHONY: cppcheck
|
|
|
|
cppcheck: cppcheck.txt
|
|
|
|
|
|
|
|
cppcheck.txt: *.c *.h
|
|
|
|
cppcheck . 2> $@
|
|
|
|
cat $@
|
|
|
|
|
|
|
|
tags: *.c
|
|
|
|
ctags -R .
|
|
|
|
|
|
|
|
mandelbrot: mandelbrot.c
|
|
|
|
$(CC) $(CFLAGS) $(shell sdl-config --cflags) -o $@ $< $(shell sdl-config --libs) -lm
|
|
|
|
|
|
|
|
mandelbrot.bmp: mandelbrot
|
|
|
|
./mandelbrot
|
|
|
|
|
|
|
|
threads: threads.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< -pthread
|
|
|
|
|
|
|
|
ncurses-pong: ncurses-pong.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< -lncurses
|
|
|
|
|
|
|
|
checkcheck: checkcheck.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< -lcheck
|
|
|
|
|
|
|
|
multibrot: multibrot.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< -lm -lpng -pthread
|
|
|
|
|
|
|
|
multibrot.png: multibrot
|
|
|
|
./multibrot -j2
|
|
|
|
|
|
|
|
multibrot-openmp.png: multibrot-openmp
|
|
|
|
time ./multibrot-openmp
|
|
|
|
|
|
|
|
lua-foo: lua-foo.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< -llua -lm
|
|
|
|
|
|
|
|
test-inline-assembly: test-inline-assembly.c
|
|
|
|
$(CC) -Wall -o $@ $<
|
|
|
|
|
|
|
|
test-inline-assembly.s: test-inline-assembly.c
|
|
|
|
$(CC) -Wall -S -o $@ $<
|
|
|
|
|
|
|
|
mtrace-test.trace: mtrace-test
|
|
|
|
MALLOC_TRACE=$@ ./mtrace-test
|
|
|
|
|
|
|
|
mtrace-test.txt: mtrace-test.trace
|
|
|
|
-mtrace mtrace-test mtrace-test.trace > mtrace-test.txt
|
|
|
|
|
|
|
|
uiowa-threads-example: uiowa-threads.o uiowa-threads-example.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
av-variance: av-variance.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ $< -lm
|
|
|
|
|
|
|
|
hello-openmp: hello-openmp.c
|
|
|
|
$(CC_OPENMP) $(CFLAGS_OPENMP) -o $@ $<
|
|
|
|
|
|
|
|
multibrot-openmp: multibrot-openmp.c
|
|
|
|
$(CC_OPENMP) $(CFLAGS_OPENMP) -o $@ $< -lm -lpng
|
|
|
|
|
|
|
|
mandelbrot-openmp: mandelbrot-openmp.c
|
|
|
|
$(CC_OPENMP) $(CFLAGS_OPENMP) $(shell sdl-config --cflags) -o $@ $< $(shell sdl-config --libs) -lm
|