1#############################################################################
3# Makefile for RF24Mesh on Raspberry Pi
10# use make all and make install to install the library
11# You can change the install directory by editing the LIBDIR line
21LIBNAME_RFN=$(LIB_RFN).so.1.0
23HEADER_DIR=${PREFIX}/include/RF24Mesh
25# Which compiler to use
29ifeq "$(shell uname -m)" "armv7l"
33# Detect the Raspberry Pi from cpuinfo
34#Count the matches for BCM2708 or BCM2709 in cpuinfo
35RPI=$(shell cat /proc/cpuinfo | grep Hardware | grep -c BCM2708)
37RPI=$(shell cat /proc/cpuinfo | grep Hardware | grep -c BCM2709)
41# The recommended compiler flags for the Raspberry Pi
42CCFLAGS=-Ofast -mfpu=vfp -mfloat-abi=hard -march=$(ARCH) -mtune=arm1176jzf-s -std=c++0x
46# reinstall the library after each recompilation
50librf24mesh: RF24Mesh.o
51 $(CC) -shared -Wl,-soname,$@.so.1 ${CCFLAGS} -o ${LIBNAME_RFN} $^
54RF24Mesh.o: RF24Mesh.cpp
55 $(CC) -Wall -fPIC ${CCFLAGS} -c $^
59 rm -rf *.o ${LIB_RFN}.*
61install: all install-libs install-headers
63# Install the library to LIBPATH
67 @if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
68 @install -m 0755 ${LIBNAME_RFN} ${LIBDIR}
69 @ln -sf ${LIBDIR}/${LIBNAME_RFN} ${LIBDIR}/${LIB_RFN}.so.1
70 @ln -sf ${LIBDIR}/${LIBNAME_RFN} ${LIBDIR}/${LIB_RFN}.so
74 @echo "[Installing Headers]"
75 @if ( test ! -d ${HEADER_DIR} ) ; then mkdir -p ${HEADER_DIR} ; fi
76 @install -m 0644 *.h ${HEADER_DIR}