-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
47 lines (34 loc) · 1.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
CC = gcc
AR = ar rc
RANLIB = ranlib
CFLAGS = -Wall -Wextra -std=c99 -pedantic
LDFLAGS =
LIBS = -lm
CHECK_SCRIPT = tests/test.fh
TARGETS = debug release ubsan
.PHONY: $(TARGETS) build clean check test dump_exported_symbols
all: debug
debug:
$(MAKE) build TARGET_CFLAGS="-O1 -g" TARGET_LDFLAGS=""
release:
$(MAKE) build TARGET_CFLAGS="-O2" TARGET_LDFLAGS="-s"
ubsan:
$(MAKE) build TARGET_CFLAGS="-O1 -g -fsanitize=undefined" TARGET_LDFLAGS="-fsanitize=undefined"
clean:
rm -f *~
$(MAKE) -C src clean
build:
$(MAKE) -C src CFLAGS="$(CFLAGS) $(TARGET_CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS) $(TARGET_LDFLAGS)" LIBS="$(LIBS)" AR="$(AR)" RANLIB="$(RANLIB)"
@echo
@echo "Compilation successful! Try these examples:"
@echo
@echo " src/fh tests/test.fh"
@echo " src/fh tests/mandelbrot.fh"
@echo " src/fh tests/mandel_color.fh"
@echo
check: debug
valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all src/fh -d $(CHECK_SCRIPT) arg1 arg2
test: debug
src/fh tests/mandel_color.fh
dump_exported_symbols: debug
nm src/lib/libfh.a | grep " [A-TV-Zuvw] "