-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_bela_cross
126 lines (98 loc) · 3.88 KB
/
Makefile_bela_cross
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Makefile for cross compilation bela
# path to xcBela
# clone from https://github.com/thetechnobear/xcBela
XCBELA = ...path/to/xcBela
# NOTE:
# Compiling rcp with SSL support fails on a Bela Mini due to too less memory.
#
# One strategy is to cross-compile the classes, copy the object-files from './sources'
# to your 'rcp-flext/sources' folder on the bela-board and link on the bela-board running 'make'
#
#
# To successfully link rcp on your host-machine additional liberaries are needed:
# Create the following directories:
# ...path/to/xcBela/sysroot/usr/local/lib
# ...path/to/xcBela/sysroot/usr/xenomai
#
# Then use rsync to get the libraries from the bela-board:
# rsync -av root@bela.local:/usr/local/lib ...path/to/xcBela/sysroot/usr/local/
# rsync -av root@bela.local:/usr/xenomai/lib ...path/to/xcBela/sysroot/usr/xenomai/
# ssl
NO_SSL = false
# output name
LIBRARY_NAME = rcp
#
# rcp external
RCP_LIB_EXT = $(shell find sources -name *.cpp)
# libraries
DEPENDENCIES_BASE = dependencies
# rcp-c
RCP_SRC = $(shell find $(DEPENDENCIES_BASE)/rcp-c -name *.c)
RCP_INCLUDE = $(DEPENDENCIES_BASE)/rcp-c
# 3rd party
FLEXT_INCLUDE = $(DEPENDENCIES_BASE)/flext/source
ASIO_INCLUDE = $(DEPENDENCIES_BASE)/asio/asio/include
WEBSOCKETPP_INCLUDE = $(DEPENDENCIES_BASE)/websocketpp
UNAME_S := $(shell uname -s)
FUNCTION_SECTIONS=-fdata-sections -ffunction-sections
ADDITIONAL_cflags = --target=arm-linux-gnueabihf -fPIC
ADDITIONAL_cflags += --sysroot=$(XCBELA)/sysroot
ADDITIONAL_cflags += -isysroot $(XCBELA)/sysroot
ADDITIONAL_cflags += -isystem $(XCBELA)/sysroot/usr/include/c++/6.3.0
ADDITIONAL_cflags += -isystem $(XCBELA)/sysroot/usr/include/arm-linux-gnueabihf/c++/6.3.0
ADDITIONAL_cflags += -B$(XCBELA)/sysroot/usr/lib/gcc/arm-linux-gnueabihf/6.3.0
ADDITIONAL_cflags += --gcc-toolchain=TOOLCHAIN/arm-linux-gnueabihf-binutils
ADDITIONAL_cflags += -I$(XCBELA)/sysroot/root/Bela
ADDITIONAL_cflags += -I$(XCBELA)/sysroot/root/Bela/include
ADDITIONAL_cflags += -I$(XCBELA)/sysroot/usr/xenomai/include
# ld flags
ADDITIONAL_ldflags = --sysroot=$(XCBELA)/sysroot
ADDITIONAL_ldflags += -L$(XCBELA)/sysroot/usr/local/lib
ADDITIONAL_ldflags += -L$(XCBELA)/sysroot/usr/xenomai/lib
ADDITIONAL_ldflags += -L$(XCBELA)/sysroot/usr/lib/arm-linux-gnueabihf
ADDITIONAL_ldflags += -L$(XCBELA)/sysroot/usr/lib/gcc/arm-linux-gnueabihf/6.3.0
ADDITIONAL_ldflags += -lpd
ADDITIONAL_ldflags += -target arm-linux-gnueabihf -shared -fpic
OPENSSL_ldflags = -L$(XCBELA)/sysroot/usr/lib
OPENSSL_ldflags += -lssl -lcrypto -lpthread -ldl -lcobalt -lmodechk -lrt
#PLATFORM = arm-linux-gnueabihf
CC = /usr/local/opt/llvm/bin/clang
CXX = /usr/local/opt/llvm/bin/clang++
CPP = /usr/local/opt/llvm/bin/clang++
FLEXT_CPPFLAGS = -DFLEXT_INLINE -DFLEXT_USE_CMEM -DFLEXT_ATTRIBUTES=1
ADDITIONAL_cflags += -DLIBRARY_NAME=$(LIBRARY_NAME)
CPPFLAGS = $(FLEXT_CPPFLAGS) $(FUNCTION_SECTIONS)
cflags = -I$(RCP_INCLUDE) -I$(FLEXT_INCLUDE) -I$(ASIO_INCLUDE) -I$(WEBSOCKETPP_INCLUDE) $(ADDITIONAL_cflags)
# use c++11 for STL in ASIO and websocketpp
CXXFLAGS = -std=c++11
ldflags = $(REMOVE_DEAD) $(ADDITIONAL_ldflags)
ifeq ($(NO_SSL),false)
cflags += -I$(OPENSSL_INCLUDE)
ldflags += $(OPENSSL_ldflags)
else
# turn off ssl
cflags += -DRCP_NO_SSL
endif
#################################
# PD
#################################
CPPFLAGS += -DPD
# using lib-pd-builder
# figure out compilation targets etc
# lib-pd-builder
lib.name = $(LIBRARY_NAME)
# NOTE: usign a modified version of Makefile.pflibbuilder
# introducing: depcheck.ignore to ignore dependency check
# ignore depcheck (c++11 not defined in depcheck, so asio fails)
depcheck.ignore = true
cxx.flags = $(CXXFLAGS)
lib.setup.sources = $(RCP_LIB_EXT)
common.sources = $(RCP_SRC)
# compile as lib
make-lib-executable = yes
suppress-wunused = yes
PDINCLUDEDIR = $(DEPENDENCIES_BASE)/pd
target.triplet = arm linux gnueabihf
extension = pd_linux
# include pd-lib-builder
include pd-lib-builder/Makefile.pdlibbuilder