-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
222 lines (185 loc) · 7.52 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#
# Makefile to build edgeai components
#
APPS_UTILS_PATH = edgeai-apps-utils/
DL_INFERER_PATH = edgeai-dl-inferer/
TIOVX_KERNELS_PATH = edgeai-tiovx-kernels/
TIOVX_MODULES_PATH = edgeai-tiovx-modules/
GST_PLUGINS_PATH = edgeai-gst-plugins/
GST_APPS_PATH = edgeai-gst-apps/
TIOVX_APPS_PATH = edgeai-tiovx-apps/
CROSS_COMPILER_PATH = $(shell pwd)/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-linux-gnu/
CROSS_COMPILER_PREFIX = aarch64-none-linux-gnu-
TARGET_FS = $(shell pwd)/targetfs
INSTALL_PATH = $(shell pwd)/targetfs
SOC ?= none
MAKE = make -j$(shell nproc)
export CROSS_COMPILER_PATH
export CROSS_COMPILER_PREFIX
export TARGET_FS
export SOC
all: check_paths gst_apps
install: apps_utils_install dl_inferer_install tiovx_kernels_install tiovx_modules_install gst_plugins_install gst_apps_install tiovx_apps_install
clean: apps_utils_clean dl_inferer_clean tiovx_kernels_clean tiovx_modules_clean gst_plugins_clean gst_apps_clean tiovx_apps_clean
check_paths:
@if [ ! -d $(APPS_UTILS_PATH) ]; then echo 'ERROR: $(APPS_UTILS_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(DL_INFERER_PATH) ]; then echo 'ERROR: $(DL_INFERER_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(TIOVX_KERNELS_PATH) ]; then echo 'ERROR: $(TIOVX_KERNELS_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(TIOVX_MODULES_PATH) ]; then echo 'ERROR: $(TIOVX_MODULES_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(GST_PLUGINS_PATH) ]; then echo 'ERROR: $(GST_PLUGINS_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(GST_APPS_PATH) ]; then echo 'ERROR: $(GST_APPS_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(TIOVX_APPS_PATH) ]; then echo 'ERROR: $(TIOVX_APPS_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(TARGET_FS) ]; then echo 'ERROR: $(TARGET_FS) not found !!!'; exit 1; fi
@if [ ! -d $(INSTALL_PATH) ]; then echo 'ERROR: $(INSTALL_PATH) not found !!!'; exit 1; fi
@if [ ! -d $(CROSS_COMPILER_PATH) ]; then echo 'ERROR: $(CROSS_COMPILER_PATH) not found !!!'; exit 1; fi
ifneq ("$(SOC)","$(filter $(SOC),j721e j721s2 j784s4 j722s am62a)")
@echo 'ERROR: SOC: "$(SOC)" is not supported !!!';
@exit 1
endif
help:
@echo "Below are targets available"
@echo ""
@echo "all - to build all components"
@echo "install - to install all components"
@echo "clean - to clean all components"
@echo ""
@echo "Below are the targets to build/install specific component"
@echo ""
@echo "--COMPONENT-- - to build the component"
@echo "--COMPONENT--_install - to install the component"
@echo "--COMPONENT--_clean - to clean the component"
@echo ""
@echo "Below are list of components"
@echo " apps_utils"
@echo " dl_inferer"
@echo " tiovx_kernels"
@echo " tiovx_modules"
@echo " gst_plugins"
@echo " gst_apps"
@echo " tiovx_apps"
########################### EDGEAI-APPS-UTILS ################################
apps_utils:
@echo "Building Apps utils"
cd $(APPS_UTILS_PATH); \
mkdir build; \
cd build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/cross_compile_aarch64.cmake ..; \
$(MAKE)
apps_utils_install: apps_utils
@echo "Install Apps utils"
cd $(APPS_UTILS_PATH); \
$(MAKE) install DESTDIR=$(INSTALL_PATH) -C build
apps_utils_clean:
@echo "Clean Apps utils"
cd $(APPS_UTILS_PATH); \
rm -rf build bin lib
########################### EDGEAI-DL-INFERER ##################################
dl_inferer: apps_utils_install
@echo "Building DL Inferer"
cd $(DL_INFERER_PATH); \
mkdir build; \
cd build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/cross_compile_aarch64.cmake ..; \
$(MAKE)
dl_inferer_install: dl_inferer
@echo "Install DL Inferer"
cd $(DL_INFERER_PATH); \
$(MAKE) install DESTDIR=$(INSTALL_PATH) -C build
dl_inferer_clean:
@echo "Clean DL Inferer"
cd $(DL_INFERER_PATH); \
rm -rf build bin lib
########################### EDGEAI-TIOVX-KERNELS ###############################
tiovx_kernels: apps_utils_install
@echo "Building TIOVX Kernels"
cd $(TIOVX_KERNELS_PATH); \
mkdir build; \
cd build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/cross_compile_aarch64.cmake ..; \
$(MAKE)
tiovx_kernels_install: tiovx_kernels
@echo "Install TIOVX Kernels"
cd $(TIOVX_KERNELS_PATH); \
$(MAKE) install DESTDIR=$(INSTALL_PATH) -C build
tiovx_kernels_clean:
@echo "Clean TIOVX Kernels"
cd $(TIOVX_KERNELS_PATH); \
rm -rf build bin lib
########################### EDGEAI-TIOVX-MODULES ###############################
tiovx_modules: tiovx_kernels_install
@echo "Building TIOVX Modules"
cd $(TIOVX_MODULES_PATH); \
mkdir build; \
cd build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/cross_compile_aarch64.cmake ..; \
$(MAKE)
tiovx_modules_install: tiovx_modules
@echo "Install TIOVX Modules"
cd $(TIOVX_MODULES_PATH); \
$(MAKE) install DESTDIR=$(INSTALL_PATH) -C build
tiovx_modules_clean:
@echo "Clean TIOVX Modules"
cd $(TIOVX_MODULES_PATH); \
rm -rf build bin lib
########################### EDGEAI-GST-PLUGINS #################################
gst_plugins: tiovx_modules_install dl_inferer_install apps_utils_install
@echo "Building GST Plugins"
cd $(GST_PLUGINS_PATH); \
cp pkgconfig/* $(TARGET_FS)/usr/lib/pkgconfig; \
echo [constants] > aarch64-none-linux-gnu.ini; \
echo "" >> aarch64-none-linux-gnu.ini; \
echo TOOLCHAIN = \'$(CROSS_COMPILER_PATH)/bin/$(CROSS_COMPILER_PREFIX)\' >> aarch64-none-linux-gnu.ini; \
echo SYSROOT = \'$(TARGET_FS)\' >> aarch64-none-linux-gnu.ini; \
echo PKG_CONFIG_LIBDIR = \'$(TARGET_FS)/usr/lib/pkgconfig\' >> aarch64-none-linux-gnu.ini; \
echo SYSTEM = \'linux-gnu\' >> aarch64-none-linux-gnu.ini; \
echo CPU_FAMILY = \'aarch64\' >> aarch64-none-linux-gnu.ini; \
echo CPU = \'aarch64-none\' >> aarch64-none-linux-gnu.ini; \
echo ENDIAN = \'little\' >> aarch64-none-linux-gnu.ini; \
echo PREFIX = \'/usr\' >> aarch64-none-linux-gnu.ini; \
echo LIBDIR = \'/usr/lib\' >> aarch64-none-linux-gnu.ini; \
PKG_CONFIG_PATH='' meson build --cross-file aarch64-none-linux-gnu.ini --cross-file crossbuild/crosscompile.ini; \
DESTDIR=$(TARGET_FS) ninja -C build
gst_plugins_install: gst_plugins
@echo "Install Gst Plugins"
cd $(GST_PLUGINS_PATH); \
DESTDIR=$(INSTALL_PATH) ninja -C build install
gst_plugins_clean:
@echo "Clean Gst Plugins"
cd $(GST_PLUGINS_PATH); \
rm -rf build
########################### EDGEAI-TIOVX-MODULES ###############################
gst_apps: dl_inferer_install gst_plugins_install apps_utils_install
@echo "Building Gst Apps"
cd $(GST_APPS_PATH)/apps_cpp; \
mkdir build; \
cd build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/cross_compile_aarch64.cmake ..; \
$(MAKE)
gst_apps_install: gst_apps
@echo "Install Gst Apps"
cd $(GST_APPS_PATH); \
mkdir -p $(INSTALL_PATH)/opt/edgeai-gst-apps-pc; \
cp -r * $(INSTALL_PATH)/opt/edgeai-gst-apps-pc/
gst_apps_clean:
@echo "Clean Gst Apps"
cd $(GST_APPS_PATH)/apps_cpp; \
rm -rf build bin lib
########################### EDGEAI-TIOVX-MODULES ###############################
tiovx_apps: tiovx_modules_install apps_utils_install
@echo "Building TIOVX Apps"
cd $(TIOVX_APPS_PATH); \
mkdir build; \
cd build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/cross_compile_aarch64.cmake ..; \
$(MAKE)
tiovx_apps_install: tiovx_apps
@echo "Install TIOVX Apps"
cd $(TIOVX_APPS_PATH); \
$(MAKE) install DESTDIR=$(INSTALL_PATH) -C build; \
mkdir -p $(INSTALL_PATH)/opt/edgeai-tiovx-apps-pc; \
cp -r bin $(INSTALL_PATH)/opt/edgeai-tiovx-apps-pc/
tiovx_apps_clean:
@echo "Clean TIOVX Apps"
cd $(TIOVX_APPS_PATH); \
rm -rf build bin lib
################################################################################