forked from pimoroni/mlx90640-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (68 loc) · 2.99 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
I2C_MODE = LINUX
I2C_LIBS =
#I2C_LIBS = -lbcm2835
SRC_DIR = examples/src/
BUILD_DIR = examples/
LIB_DIR = $(SRC_DIR)lib/
HEADERS = headers
examples = test rawrgb step fbuf interp video hotspot sdlscale rawdata
examples_objects = $(addsuffix .o,$(addprefix $(SRC_DIR), $(examples)))
examples_output = $(addprefix $(BUILD_DIR), $(examples))
#PREFIX is environment variable, but if it is not set, then set default value
ifeq ($(PREFIX),)
PREFIX = /usr/local
endif
ifeq ($(I2C_MODE), LINUX)
I2C_LIBS =
endif
all: libMLX90640_API.a libMLX90640_API.so examples
examples: $(examples_output)
libMLX90640_API.so: functions/MLX90640_API.o functions/MLX90640_$(I2C_MODE)_I2C_Driver.o
$(CXX) -fPIC -shared $^ -o $@ $(I2C_LIBS)
libMLX90640_API.a: functions/MLX90640_API.o functions/MLX90640_$(I2C_MODE)_I2C_Driver.o
ar rcs $@ $^
ranlib $@
functions/MLX90640_API.o functions/MLX90640_RPI_I2C_Driver.o functions/MLX90640_LINUX_I2C_Driver.o : CXXFLAGS+=-fPIC -I headers -shared $(I2C_LIBS)
$(examples_objects) : CXXFLAGS+=-std=c++11
$(examples_output) : CXXFLAGS+=-I$(HEADERS) -std=c++11
examples/src/lib/interpolate.o : CC=$(CXX) -std=c++11
examples/src/sdlscale.o : CXXFLAGS+=`sdl2-config --cflags --libs`
$(BUILD_DIR)sdlscale: $(SRC_DIR)sdlscale.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS) `sdl2-config --libs`
$(BUILD_DIR)hotspot: $(SRC_DIR)hotspot.o $(LIB_DIR)fb.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)test: $(SRC_DIR)test.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)rawrgb: $(SRC_DIR)rawrgb.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)rawdata: $(SRC_DIR)rawdata.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)step: $(SRC_DIR)step.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)fbuf: $(SRC_DIR)fbuf.o $(LIB_DIR)fb.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)interp: $(SRC_DIR)interp.o $(LIB_DIR)interpolate.o $(LIB_DIR)fb.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS)
$(BUILD_DIR)video: $(SRC_DIR)video.o $(LIB_DIR)fb.o libMLX90640_API.a
$(CXX) -L/home/pi/mlx90640-library $^ -o $@ $(I2C_LIBS) -lavcodec -lavutil -lavformat
bcm2835-1.55.tar.gz:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.55.tar.gz
bcm2835-1.55: bcm2835-1.55.tar.gz
tar xzvf bcm2835-1.55.tar.gz
bcm2835: bcm2835-1.55
cd bcm2835-1.55; ./configure; make; sudo make install
clean:
rm -f $(examples_output)
rm -f $(SRC_DIR)*.o
rm -f $(LIB_DIR)*.o
rm -f functions/*.o
rm -f *.o
rm -f *.so
rm -f *.a
install: libMLX90640_API.a libMLX90640_API.so
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 libMLX90640_API.a $(DESTDIR)$(PREFIX)/lib/
install -m 644 libMLX90640_API.so $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/MLX90640/
install -m 644 headers/*.h $(DESTDIR)$(PREFIX)/include/MLX90640/
ldconfig