forked from hallard/ArduiPi_OLED
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
98 lines (77 loc) · 2.79 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
94
95
96
#*********************************************************************
# This is the makefile for the ArduiPi OLED library driver
#
# 02/18/2013 Charles-Henri Hallard (http://hallard.me)
# Modified for compiling and use on Raspberry ArduiPi Board
# LCD size and connection are now passed as arguments on
# the command line (no more #define on compilation needed)
# ArduiPi project documentation http://hallard.me/arduipi
#
# 07/26/2013 Charles-Henri Hallard
# modified name for generic library using different OLED type
#
# 08/26/2015 Lorenzo Delana ([email protected])
# added bananapi specific CCFLAGS and conditional macro BANANPI
#
# *********************************************************************
# Makefile itself dir
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# hw platform as from autogen.sh choose
HWPLAT:=$(shell cat $(ROOT_DIR)/hwplatform)
# sets CCFLAGS hw platform dependant
ifeq ($(HWPLAT),BananaPI)
CCFLAGS=-Wall -Ofast -mfpu=vfpv4 -mfloat-abi=hard -march=armv7 -mtune=cortex-a7 -DBANANAPI
else # fallback to raspberry
# The recommended compiler flags for the Raspberry Pi
CCFLAGS=-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s
endif
# Where you want it installed when you do 'make install'
PREFIX=/usr/local
# Library parameters
# where to put the lib
LIBDIR=$(PREFIX)/lib
# lib name
LIB=libArduiPi_OLED
# shared library name
LIBNAME=$(LIB).so.1.0
CXX=g++
CC=gcc
CFLAGS=$(CCFLAGS)
# make all
all: ArduiPi_OLED
# Make the library
ArduiPi_OLED: ArduiPi_OLED.o Adafruit_GFX.o Wrapper.o dev_io.o
$(CXX) -shared -Wl,-soname,$(LIB).so.1 $(CFLAGS) $(LDFLAGS) -o ${LIBNAME} $^
# Library parts (use -fno-rtti flag to avoid link problem)
ArduiPi_OLED.o: ArduiPi_OLED.cpp
$(CXX) -Wall -fPIC -fno-rtti $(CFLAGS) -c $^
Adafruit_GFX.o: Adafruit_GFX.cpp
$(CXX) -Wall -fPIC -fno-rtti $(CFLAGS) -c $^
dev_io.o: dev_io.c
$(CC) -Wall -fPIC -fno-rtti $(CFLAGS) -c $^
Wrapper.o: Wrapper.cpp
$(CC) -Wall -fPIC -fno-rtti $(CFLAGS) -c $^
# Install the library to LIBPATH
install:
@echo "[Install Library]"
@if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
@install -m 0755 ${LIBNAME} ${LIBDIR}
@ln -sf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so.1
@ln -sf ${LIBDIR}/${LIBNAME} ${LIBDIR}/${LIB}.so
@ldconfig
@rm -rf ${LIB}.*
@echo "[Install Headers]"
@if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
@cp -f Adafruit_*.h $(PREFIX)/include
@cp -f ArduiPi_*.h $(PREFIX)/include
@cp -f dev_io.h $(PREFIX)/include
# Uninstall the library
uninstall:
@echo "[Uninstall Library]"
@rm -f ${LIBDIR}/${LIB}.*
@echo "[Uninstall Headers]"
@rm -rf $(PREFIX)/include/ArduiPi_OLED*
@rm -rf $(PREFIX)/include/dev_io.h
# clear build files
clean:
rm -rf *.o ${LIB}.* ${LIBDIR}/${LIB}.*