-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (80 loc) · 2.51 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
# Gavin lyons 06-2021
# Makefile to install library for ERM19264_UC1609_RPI library.
# URL: https://github.com/gavinlyonsrepo/ERM19264_UC1609_RPI
# Library is installed to /usr/lib and include files are placed at /usr/include.
# == Options ==
# 1. make = compile library
# 2. make install = install library to filesystem (may need sudo)
# 3. clean = deletes .o files generated by step 1 from build directory
# 4. make uninstall = uninstalls library (may need sudo)
# =============
# Where you want it installed
PREFIX=/usr
# where to place the library
LIBDIR=$(PREFIX)/lib
# library name
LIB=libERM19264_UC1609_RPI
# shared library name
LIBNAME=$(LIB).so.1.0
MD=mkdir
SRC=src
OBJ=obj
SRCS = $(wildcard $(SRC)/*.cpp)
OBJS = $(patsubst $(SRC)%.cpp, $(OBJ)/%.o, $(SRCS))
CXX=g++
CCFLAGS= -march=native -mtune=native -mcpu=native -Iinclude/
LDFLAGS= -lbcm2835
# make
all: clean pre-build ERM19264_UC1609_RPI
pre-build:
@echo
@echo "*****************"
@echo "[START!]"
@echo
$(MD) -vp $(OBJ)
# Make the library
ERM19264_UC1609_RPI: $(OBJS)
$(CXX) -shared -Wl,-soname,$(LIB).so.1 $(CCFLAGS) $(LDFLAGS) -o ${LIBNAME} $^
@echo "*****************"
@echo "[DONE!]"
# Library parts
$(OBJ)/%.o: $(SRC)/%.cpp
$(CXX) -Wall -fPIC -c $(CCFLAGS) $< -o $@
# Install the library to LIBPATH
install:
@echo
@echo "*****************"
@echo "[INSTALL LIBRARY]"
@if ( test ! -d $(PREFIX)/lib ) ; then mkdir -vp $(PREFIX)/lib ; fi
@install -vm 0755 ${LIBNAME} ${LIBDIR}
@ln -svf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so.1
@ln -svf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so
@ldconfig
@rm -rvf ${LIB}.*
@echo
@echo "[INSTALL HEADERS]"
@if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
@cp -vf include/ERM19264_UC1609.hpp $(PREFIX)/include
@cp -vf include/ERM19264_UC1609_Print.hpp $(PREFIX)/include
@cp -vf include/ERM19264_graphics.hpp $(PREFIX)/include
@cp -vf include/ERM19264_font.hpp $(PREFIX)/include
@cp -vf include/ERM19264_gfxfont.hpp $(PREFIX)/include
@echo "[DONE!]"
# Uninstall the library
uninstall:
@echo "******************"
@echo "[UNINSTALL LIBRARY]"
@rm -vf ${LIBDIR}/${LIB}.*
@echo "[UNINSTALL HEADERS]"
@rm -rvf $(PREFIX)/include/ERM19264_UC1609.hpp
@rm -rvf $(PREFIX)/include/ERM19264_UC1609_Print.hpp
@rm -rvf $(PREFIX)/include/ERM19264_graphics.hpp
@rm -rvf $(PREFIX)/include/ERM19264_font.hpp
@rm -rvf $(PREFIX)/include/ERM19264_gfxfont.hpp
@echo "[DONE!]"
# clear build files
clean:
@echo "******************"
@echo "[CLEAN OBJECT FILES]"
rm -rvf $(OBJ)/*.o ${LIB}.*
@echo "[DONE!]"