This repository has been archived by the owner on Jan 18, 2023. It is now read-only.
forked from gavinlyonsrepo/SSD1306_OLED_RPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (77 loc) · 2.38 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
# Gavin lyons 06-2021
# Makefile to install library for SSD1305_OLED library.
# URL: https://github.com/gavinlyonsrepo/SSD1305_OLED_RPI
# Library is installed to /usr/lib and include files are placed at /usr/include.
# Uninstall and clean options provided
# Options
# 1. make = install library
# 2. clean = deletes .o files generated by step 1 from build directory
# 3. make uninstall = uninstalls library
# Where you want it installed
PREFIX=/usr
# where to place the libray
LIBDIR=$(PREFIX)/lib
# library name
LIB=libSSD1305_OLED_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= -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Iinclude/
LDFLAGS= -lbcm2835
# make all
# reinstall the library after each recompilation
all: pre-build SSD1305_OLED_RPI install
pre-build:
@echo
@echo "*****************"
@echo "[START!]"
@echo
$(MD) -vp $(OBJ)
# Make the library
SSD1305_OLED_RPI: $(OBJS)
$(CXX) -shared -Wl,-soname,$(LIB).so.1 $(CCFLAGS) $(LDFLAGS) -o ${LIBNAME} $^
# 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
@echo "[INSTALL HEADERS]"
@if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
@cp -vf include/SSD1305_OLED.h $(PREFIX)/include
@cp -vf include/SSD1305_OLED_graphics.h $(PREFIX)/include
@cp -vf include/SSD1305_OLED_Print.h $(PREFIX)/include
@cp -vf include/SSD1305_OLED_font.h $(PREFIX)/include
@echo "[DONE!]"
# Uninstall the library
uninstall:
@echo "******************"
@echo "[UNINSTALL LIBRARY]"
@rm -vf ${LIBDIR}/${LIB}.*
@echo "[UNINSTALL HEADERS]"
@rm -rvf $(PREFIX)/include/SSD1305_OLED.h
@rm -rvf $(PREFIX)/include/SSD1305_OLED_graphics.h
@rm -rvf $(PREFIX)/include/SSD1305_OLED_Print.h
@rm -rvf $(PREFIX)/include/SSD1305_OLED_font.h
@echo "[DONE!]"
# clear build files
clean:
@echo "******************"
@echo "[CLEAN OBJECT FILES]"
rm -rvf $(OBJ)/*.o ${LIB}.*
@echo "[DONE!]"