-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
57 lines (42 loc) · 1.32 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
OBJs := $(patsubst %.cpp, %.o, $(wildcard *.cpp)) model_board/model_board.o
DEPs := $(OBJs:%.o=%.d)
BIN := ahrs-visualizer
# Use a modern language
CPPFLAGS += --std=c++11
# Turn on "all" warnings
CPPFLAGS += -Wall
# Generate .d files with dependency info
CPPFLAGS += -MD -MP
# Debuggable and optimized.
CPPFLAGS += -g -O2
# Weird stuff needed to do OpenGL ES 2 on a Raspberry Pi
CPPFLAGS += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux
LDFLAGS += -L/opt/vc/lib
LDLIBS += -lGLESv2 -lbcm_host -lEGL -lm -lstdc++
# Tell the cpp file where assets are stored.
CPPFLAGS += -DASSET_DIR="\"$(assetdir)\""
# libpng for reading in textures
LDLIBS += $(shell libpng-config --libs)
# boost_program_options library for reading command-line arguments.
LDLIBS += -lboost_program_options
.PHONY: all
all: $(BIN)
$(BIN): $(OBJs)
.PHONY: clean
clean:
@rm -fv $(BIN) $(OBJs) $(DEPs) *.o
-include $(DEPs)
prefix = $(DESTDIR)/usr/local
bindir = $(prefix)/bin
sharedir = $(prefix)/share
assetdir = $(sharedir)/$(BIN)
mandir = $(sharedir)/man
man1dir = $(mandir)/man1
.PHONY: install_assets
install_assets:
install -d $(assetdir)
install -m 0644 $(wildcard assets/*.png) $(assetdir)
.PHONY: install
install: $(BIN) install_assets
install $(BIN) $(bindir)
install -m 0644 $(BIN).1 $(man1dir)