Makefile: fix warnings when linking with clang++
[experiments/opencv_trail_effect.git] / Makefile
1 CXXFLAGS = -ansi -pedantic -pedantic-errors -Wall -g3 -O2 -D_ANSI_SOURCE_
2 CXXFLAGS += -fno-common \
3             -fvisibility=hidden \
4             -Wall \
5             -Wextra \
6             -Wformat=2 \
7             -Winit-self \
8             -Winline \
9             -Wpacked \
10             -Wpointer-arith \
11             -Wlarger-than-65500 \
12             -Wmissing-declarations \
13             -Wmissing-format-attribute \
14             -Wmissing-noreturn \
15             -Wredundant-decls \
16             -Wsign-compare \
17             -Wstrict-aliasing=2 \
18             -Wswitch-enum \
19             -Wundef \
20             -Wunreachable-code \
21             -Wwrite-strings \
22             -Wp,-D_FORTIFY_SOURCE=2 \
23             -fstack-protector \
24             --param=ssp-buffer-size=4
25
26 ifneq ($(CXX),clang++)
27   CXXFLAGS += -Wunsafe-loop-optimizations \
28               -Wunused-but-set-variable
29 endif
30
31 ifeq ($(CXX),clang++)
32   LDFLAGS += -Qunused-arguments
33 endif
34
35 CXXFLAGS += $(shell pkg-config --cflags opencv)
36 LDLIBS += $(shell pkg-config --libs opencv)
37
38 LINK.o = $(LINK.cpp)
39 opencv_trail_effect:
40
41 opencv_trail_effect.o: $(wildcard *.hpp)
42
43 # Some command lines to imitate different trail styles
44
45 blame_it_on_the_boogie: opencv_trail_effect
46         ./opencv_trail_effect -l 12 -s background -d fadeaccumulate
47
48 wtf: opencv_trail_effect
49         ./opencv_trail_effect -l -1 -s background -d copy
50
51 l_anima_vola: opencv_trail_effect
52         ./opencv_trail_effect -l 30 -s background -d copy -r
53
54 average: opencv_trail_effect
55         ./opencv_trail_effect -l 10 -s background -d average -B
56
57 clean:
58         rm -f *.o opencv_trail_effect vgdump gtk.suppression
59
60 test: opencv_trail_effect
61         [ -f gtk.suppression ] || wget -nv https://people.gnome.org/~johan/gtk.suppression
62         G_DEBUG=gc-friendly G_SLICE=always-malloc \
63                 valgrind --tool=memcheck --leak-check=full --leak-resolution=high \
64                 --num-callers=20 --log-file=vgdump \
65                 --suppressions=gtk.suppression ./opencv_trail_effect