-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
37 lines (27 loc) · 824 Bytes
/
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
CC=g++
CFLAGS+=`pkg-config --cflags opencv`
LDFLAGS+=`pkg-config --libs opencv`
# Link UV4L and WiringPi libraries on ARM
ifneq ($(filter arm%,$(shell uname -m)),)
CFLAGS+=-I/usr/local/include
LDFLAGS+=-L/usr/lib/uv4l/uv4lext/armv6l -luv4lext -Wl,-rpath,'/usr/lib/uv4l/uv4lext/armv6l' -L/usr/local/lib -lwiringPi
endif
# Change this to the name of your main file
PROG=main
# Create a list of all object files
OBJS = $(addsuffix .o,$(basename $(notdir $(wildcard *.cpp))))
.PHONY: all clean run
$(PROG): $(OBJS)
mkdir -p bin
$(CC) -o bin/$(PROG) $(OBJS) $(LDFLAGS)
%.o: %.cpp
$(CC) -O3 -c $(CFLAGS) $<
all: $(PROG)
# Remove all objects and bin directory
clean:
rm -rf $(OBJS) bin
# Run executable inside bin directory
run: all
sudo ./bin/$(PROG)
# Rebuild everything when makefile changes.
$(OBJS): Makefile