README.md: use https for URLs, except for sgnlr.com where it doesn't work
[experiments/cyclabile.git] / Makefile
1 CFLAGS = -std=c99 -pedantic -pedantic-errors -Wall -g3 -O2 -D_ANSI_SOURCE_
2 CFLAGS += -fno-common \
3           -Wall \
4           -Wdeclaration-after-statement \
5           -Wextra \
6           -Wformat=2 \
7           -Winit-self \
8           -Winline \
9           -Wpacked \
10           -Wp,-D_FORTIFY_SOURCE=2 \
11           -Wpointer-arith \
12           -Wlarger-than-65500 \
13           -Wmissing-declarations \
14           -Wmissing-format-attribute \
15           -Wmissing-noreturn \
16           -Wmissing-prototypes \
17           -Wnested-externs \
18           -Wold-style-definition \
19           -Wredundant-decls \
20           -Wsign-compare \
21           -Wstrict-aliasing=2 \
22           -Wstrict-prototypes \
23           -Wundef \
24           -Wunreachable-code \
25           -Wunsafe-loop-optimizations \
26           -Wunused-but-set-variable \
27           -Wwrite-strings
28
29 LDLIBS = -llept -lturbojpeg -lam7xxx
30
31 # For clock_nanosleep()
32 CFLAGS += -D_POSIX_C_SOURCE=200112L
33
34 # for clock_gettime()
35 LDLIBS += -lrt
36
37 # Some compiler optimizations
38 CFLAGS += -O3 \
39             -fno-strict-aliasing \
40             -ftree-vectorize \
41             -ffast-math \
42             -funroll-loops \
43             -funsafe-math-optimizations \
44             -fsingle-precision-constant
45
46 # NEON optimizations
47 ifeq ($(NEON), 1)
48   CFLAGS += -march=armv7-a \
49             -mtune=cortex-a8 \
50             -mfpu=neon \
51             -mfloat-abi=hard \
52             -DUSE_NEON
53 endif
54
55 # Use the BBB eQEP unit
56 ifeq ($(EQEP), 1)
57   CFLAGS += -DUSE_EQEP
58 endif
59
60
61 cyclabile: cyclabile.o projective_split.o
62
63 clean:
64         rm -rf *~ *.o cyclabile cyclabile.service
65
66 run:
67         ./cyclabile -P 2 -f images/bike_lane.png -e /dev/input/event1
68
69 install_service:
70         cp 90-projector.rules $(DESTDIR)/lib/udev/rules.d/
71         sed -e 's!@@CYCLABILE_SOURCE_PATH@@!$(shell pwd)!' < cyclabile.service.in > cyclabile.service
72         cp cyclabile.service $(DESTIR)/lib/systemd/system/
73
74 uninstall_service:
75         systemctl enable cyclabile.service
76         rm $(DESTIR)/lib/systemd/system/cyclabile.service
77         rm $(DESTDIR)/lib/udev/rules.d/90-projector.rules
78         udevadm control --reload
79
80 enable_service: install_service
81         udevadm control --reload
82         systemctl enable cyclabile.service
83
84 test: cyclabile
85         valgrind --suppressions=contrib/libusb-udev.supp \
86         --leak-check=full --show-reachable=yes \
87         ./cyclabile -f images/bumpy_road.png -e /dev/input/event1