RF24Mesh - Automated Networking for nrf24L01 & nrf52x radios v2.0.0
2024 - A user friendly mesh overlay for sensor neworks using RF24Network
Loading...
Searching...
No Matches
Makefile
Go to the documentation of this file.
1#############################################################################
2#
3# Makefile for RF24Mesh on Raspberry Pi
4#
5# Author: TMRh20
6# Date: 2014/09
7#
8# Description:
9# ------------
10# use make all and make install to install the library
11# You can change the install directory by editing the LIBDIR line
12#
13PREFIX=/usr/local
14
15# Library parameters
16# where to put the lib
17LIBDIR=$(PREFIX)/lib
18# lib name
19LIB_RFN=librf24mesh
20# shared library name
21LIBNAME_RFN=$(LIB_RFN).so.1.0
22
23HEADER_DIR=${PREFIX}/include/RF24Mesh
24
25# Which compiler to use
26CC=g++
27
28ARCH=armv6zk
29ifeq "$(shell uname -m)" "armv7l"
30ARCH=armv7-a
31endif
32
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)
36ifneq "${RPI}" "1"
37RPI=$(shell cat /proc/cpuinfo | grep Hardware | grep -c BCM2709)
38endif
39
40ifeq "$(RPI)" "1"
41# The recommended compiler flags for the Raspberry Pi
42CCFLAGS=-Ofast -mfpu=vfp -mfloat-abi=hard -march=$(ARCH) -mtune=arm1176jzf-s -std=c++0x
43endif
44
45# make all
46# reinstall the library after each recompilation
47all: librf24mesh
48
49# Make the library
50librf24mesh: RF24Mesh.o
51 $(CC) -shared -Wl,-soname,$@.so.1 ${CCFLAGS} -o ${LIBNAME_RFN} $^
52
53# Library parts
54RF24Mesh.o: RF24Mesh.cpp
55 $(CC) -Wall -fPIC ${CCFLAGS} -c $^
56
57# clear build files
58clean:
59 rm -rf *.o ${LIB_RFN}.*
60
61install: all install-libs install-headers
62
63# Install the library to LIBPATH
64
65install-libs:
66 @echo "[Install]"
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
71 @ldconfig
72
73install-headers:
74 @echo "[Installing Headers]"
75 @if ( test ! -d ${HEADER_DIR} ) ; then mkdir -p ${HEADER_DIR} ; fi
76 @install -m 0644 *.h ${HEADER_DIR}
77