forked from TarSens/RF24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.littlewire
68 lines (56 loc) · 1.74 KB
/
Makefile.littlewire
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
#############################################################################
#
# Makefile for librf24 via LittleWire
#
# License: GPL (General Public License)
# Author: Andreas Steinel
# Date: 2014/11/19
#
# Description:
# ------------
# use make all and make install to install the library
# You can change the install directory by editing the LIBDIR line
#
PREFIX=/opt/LittleWirePrefix
LIB=librf24
HEADER_DIR=${PREFIX}/include/RF24
LIB_DIR=$(PREFIX)/lib
DRIVER_DIR=utility/LittleWire
ifeq ($(shell uname), Linux)
DYN_SUFFIX=so
LINK_FORMAT=-shared -Wl,-soname,$@.$(DYN_SUFFIX)
else ifeq ($(shell uname), Darwin)
DYN_SUFFIX=dylib
LINK_FORMAT=-dynamiclib -install_name ${LIB_DIR}/${LIB}.${DYN_SUFFIX}
else
$(shell echo "Unknown System, please fix Makefile!")
$(shell false )
endif
LIBNAME=$(LIB).$(DYN_SUFFIX)
CCFLAGS=-O2 -Wall -g -DLITTLEWIRE -I$(PREFIX)/include
LIBS=-L$(PREFIX)/lib -llittlewire-spi
# make all
# reinstall the library after each recompilation
all: $(LIB)
# Make the library
$(LIB): RF24.o
g++ $(LINK_FORMAT) ${LIBS} -o ${LIBNAME} $^
# Library parts
RF24.o: RF24.cpp
g++ -Wall -fPIC ${CCFLAGS} -c $^
# clear build files
clean:
rm -rf *.o ${LIBNAME}
install: all install-libs install-headers
# Install the library to LIBPATH
install-libs:
@echo "[Installing Libs]"
@if ( test ! -d ${LIB_DIR} ) ; then mkdir -p ${LIB_DIR}; fi
@install -m 0755 ${LIBNAME} ${LIB_DIR}
@ln -sf ${LIB_DIR}/${LIBNAME} ${LIB_DIR}/${LIBNAME}.1
install-headers:
@echo "[Installing Headers]"
@if ( test ! -d ${HEADER_DIR} ) ; then mkdir -p ${HEADER_DIR} ; fi
@install -m 0644 *.h ${HEADER_DIR}
@if ( test ! -d ${HEADER_DIR}/${DRIVER_DIR} ) ; then mkdir -p ${HEADER_DIR}/${DRIVER_DIR} ; fi
@install -m 0644 ${DRIVER_DIR}/*.h ${HEADER_DIR}/${DRIVER_DIR}