summaryrefslogtreecommitdiff
path: root/gstreamer_ti/Makefile.common
blob: 775009b2662bad128a1b97aefd8c89331cc4ad8d (plain)
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# Makefile.common
#
# Specifies common settings for all build scripts.
#
# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/
#
# This program is free software; you can redistribute it and/or modify 
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation version 2.1 of the License.
#
# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind,
# whether express or implied; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

#------------------------------------------------------------------------------
# User specified paths:
#    DVSDK_INSTALL_DIR 
#        location of DVSDK installation directory; settings from the DVSDK's
#        Rules.make will be used for the build.
#    TARGET_ROOT_DIR 
#        root directory of target filesystem on host machine
#    GSTREAMER_DIR
#        location of gstreamer installation on target filesystem.  This setting
#        should assume that "/" is the root file system of the target, not the
#        host.
#    CROSS_COMPILER
#        Cross compiler being used.  A default is chosen based on the platform
#        you are building for, but you can set it explicitly to one of these
#        values:
#            MVL_5_0:    MontaVista   v5.0
#            CS_2008Q1:  CodeSourcery v2008q1
#            CS_2009Q1:  CodeSourcery v2009q1
#    GST_TI_PLATFORM
#         In most cases this variable will be automatically set to be the same
#         as the PLATFORM variable in the Rules.make for the DVSDK.  Currently
#         the only time it must be set here is when building for dm6467 or
#         dm6467t.
#
# These paths must be specified or the build will fail.
#------------------------------------------------------------------------------
DVSDK_INSTALL_DIR    = 
TARGET_ROOT_DIR      = 
GSTREAMER_DIR        = /opt/gstreamer
CROSS_COMPILER       = 
GST_TI_PLATFORM      =

#------------------------------------------------------------------------------
# Build configuration:
#
#    VERBOSE 
#        Set to "true" to see all build commands.     
#------------------------------------------------------------------------------
VERBOSE = false

#------------------------------------------------------------------------------
# Pull in build settings from the DVSDK, and error-check the settings we get.
#------------------------------------------------------------------------------
ifndef DVSDK_INSTALL_DIR
   $(error DVSDK_INSTALL_DIR must be set in Makefile before building)
endif

include $(DVSDK_INSTALL_DIR)/Rules.make

# Set GST_TI_PLATFORM from the DVSDK's variable if it hasn't been set already
ifndef GST_TI_PLATFORM
   # Ensure the PLATFORM variable was set
   ifndef PLATFORM
      $(error expected Rules.make from DVSDK to set the PLATFORM variable -- this variable must be set to the build target)
   endif
   ifeq ($(PLATFORM), dm6467)
      $(error when building for dm6467 or dm6467t, the platform type must be specified explicity at the top of Makefile.commom with GST_TI_PLATFORM=dm6467 or GST_TI_PLATFORM=dm6467t)
   endif
   GST_TI_PLATFORM=$(PLATFORM)
endif

# DVSDK 1.30 doesn't include DMAI, so make sure it gets added to the Rules.make
ifndef DMAI_INSTALL_DIR
   $(error please add setting for DMAI_INSTALL_DIR to the Rules.make in the DVSDK)
endif

# Ensure the target root directory is set.
ifndef TARGET_ROOT_DIR
   $(error TARGET_ROOT_DIR must be set in Makefile before building)
endif

# Export Rules.make variables so they are visible to the sub-makes
export BIOS_INSTALL_DIR
export CE_INSTALL_DIR
export CMEM_INSTALL_DIR
export CODEC_INSTALL_DIR
export DMAI_INSTALL_DIR
export FC_INSTALL_DIR
export LINK_INSTALL_DIR
export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)/packages
export LINUXLIBS_INSTALL_DIR
export LINUXKERNEL_INSTALL_DIR
export LPM_INSTALL_DIR
export MVTOOL_DIR
export MVTOOL_PREFIX
export GST_TI_PLATFORM
export XDAIS_INSTALL_DIR
export XDC_INSTALL_DIR
export EDMA3_LLD_INSTALL_DIR
export USER_XDC_PATH

#------------------------------------------------------------------------------
# Location of gstreamer installation on target
#------------------------------------------------------------------------------
TARGET_GSTREAMER_DIR = $(TARGET_ROOT_DIR)/$(GSTREAMER_DIR)

#------------------------------------------------------------------------------
# Set a default cross compiler if one has not been specified
#------------------------------------------------------------------------------
ifndef CROSS_COMPILER
    ifeq ($(GST_TI_PLATFORM), dm355)
        CROSS_COMPILER=CS_2009Q1
    endif
    ifeq ($(GST_TI_PLATFORM), dm6446)
        CROSS_COMPILER=MVL_5_0
    endif
    ifeq ($(GST_TI_PLATFORM), dm6467)
        CROSS_COMPILER=MVL_5_0
    endif
    ifeq ($(GST_TI_PLATFORM), dm6467t)
        CROSS_COMPILER=CS_2009Q1
    endif
    ifeq ($(GST_TI_PLATFORM), dm365)
        CROSS_COMPILER=CS_2009Q1
    endif
    ifeq ($(GST_TI_PLATFORM), dm368)
        CROSS_COMPILER=CS_2009Q1
    endif
    ifeq ($(GST_TI_PLATFORM), omap3530)
        CROSS_COMPILER=CS_2008Q1
    endif
    ifeq ($(GST_TI_PLATFORM), omapl138)
        CROSS_COMPILER=CS_2009Q1
    endif
    ifeq ($(GST_TI_PLATFORM), dm3730)
        CROSS_COMPILER=CS_2009Q1
    endif
endif

#------------------------------------------------------------------------------
# Set the CROSS_COMPILE_PREFIX variable, this is used by libtool while linking 
# the cross compiled libraries on MV platform
#------------------------------------------------------------------------------
# NOTE:  If you're using the MontaVista toolchain, CROSS_COMPILE_PREFIX must be
#        the location of the filesystem within the MontaVista directory, not
#        your custom filesystem.  MontaVista will sometimes fail to link
#        libraries such as -lpthread correctly if you specify a target
#        filesystem in a different location.
#------------------------------------------------------------------------------
export CROSS_COMPILE_PREFIX = $(TARGET_ROOT_DIR)

ifeq ($(CROSS_COMPILER), MVL_5_0)
    export CROSS_COMPILE_PREFIX = $(MVLTOOL_DIR)/target
endif  


#------------------------------------------------------------------------------
# Set XDC target and platform based on PLATFORM variable
#------------------------------------------------------------------------------
ifeq ($(GST_TI_PLATFORM), dm355)
    export XDC_TARGET    = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM  = ti.platforms.evmDM355
    export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
    export MVTOOL_DIR    = $(CSTOOL_DIR)
    export PLATFORM_XDC  = $(XDC_PLATFORM)
    export CROSS_COMPILE = $(CSTOOL_PREFIX)
endif

ifeq ($(GST_TI_PLATFORM), dm6446)
    export XDC_TARGET   = gnu.targets.MVArm9
    export XDC_PLATFORM = ti.platforms.evmDM6446
endif

ifeq ($(GST_TI_PLATFORM), dm365)
    export XDC_TARGET           = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM         = ti.platforms.evmDM365
    export MVTOOL_PREFIX        = $(CSTOOL_PREFIX)
    export MVTOOL_DIR           = $(CSTOOL_DIR)
    export PLATFORM_XDC         = $(XDC_PLATFORM)
    export CROSS_COMPILE        = $(CSTOOL_PREFIX)
    export LIBTOOL_SYSROOT_PATH = $(LINUXLIBS_INSTALL_DIR)/..
endif

ifeq ($(GST_TI_PLATFORM), dm368)
    export XDC_TARGET    = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM  = ti.platforms.evmDM365
    export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
    export MVTOOL_DIR    = $(CSTOOL_DIR)
    export PLATFORM_XDC  = $(XDC_PLATFORM)
    export CROSS_COMPILE = $(CSTOOL_PREFIX)
    export LIBTOOL_SYSROOT_PATH = $(LINUXLIBS_INSTALL_DIR)/..
endif

ifeq ($(GST_TI_PLATFORM), dm6467)
    export XDC_TARGET   = gnu.targets.MVArm9
    export XDC_PLATFORM = ti.platforms.evmDM6467
endif

ifeq ($(GST_TI_PLATFORM), dm6467t)
    export XDC_TARGET    = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM  = ti.platforms.evmDM6467
    export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
    export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
    export MVTOOL_DIR    = $(CSTOOL_DIR)
    export PLATFORM_XDC  = $(XDC_PLATFORM)
    export CROSS_COMPILE = $(CSTOOL_PREFIX)
endif

ifeq ($(GST_TI_PLATFORM), omap3530)
    export XDC_TARGET    = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM  = ti.platforms.evm3530
    export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
    export MVTOOL_DIR    = $(CSTOOL_DIR)
    export PLATFORM_XDC  = $(XDC_PLATFORM)
    export CROSS_COMPILE = $(CSTOOL_PREFIX)
    export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
    export C6ACCEL_INSTALL_DIR
    export ENABLE_C6ACCEL = true
    export C6ACCEL_PLATFORM = $(GST_TI_PLATFORM)
    export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/..
endif

ifeq ($(GST_TI_PLATFORM), dm3730)
    export XDC_TARGET    = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM  = ti.platforms.evm3530
    export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
    export MVTOOL_DIR    = $(CSTOOL_DIR)
    export PLATFORM_XDC  = $(XDC_PLATFORM)
    export CROSS_COMPILE = $(CSTOOL_PREFIX)
    export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
    export C6ACCEL_INSTALL_DIR
    export ENABLE_C6ACCEL = true
    export C6ACCEL_PLATFORM = omap3530
    export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/..
endif

ifeq ($(GST_TI_PLATFORM), omapl138)
    export XDC_TARGET    = gnu.targets.arm.GCArmv5T
    export XDC_PLATFORM  = ti.platforms.evmOMAPL138
    export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
    export MVTOOL_DIR    = $(CSTOOL_DIR)
    export PLATFORM_XDC  = $(XDC_PLATFORM)
    export CROSS_COMPILE = $(CSTOOL_PREFIX)
    export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
    export C6ACCEL_INSTALL_DIR
    export ENABLE_C6ACCEL = true
    export C6ACCEL_PLATFORM = $(GST_TI_PLATFORM)
    export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/..
endif

#------------------------------------------------------------------------------
# CPPFLAGS/CFLAGS/LDFLAGS that should be used when building packages.
#
#     CPPFLAGS_all        - Prerocessor flags used with all platforms
#     CPPFLAGS_<platform> - Additional preprocessor flags for <platform>
#
#     CFLAGS_all          - Compiler flags used with all platforms
#     CFLAGS_<platform>   - Additional compiler flags for <platform>
#
#     LDFLAGS_all         - Linker flags used with all platforms
#     LDFLAGS_<platform>  - Additional linker flags for <platform>
#
# Note on platforms that have "-I$(LINUXKERNEL_INSTALL_DIR)/include":
#
#    On MVL-based LSPs we need to include the LSP headers directly
#    in order to gain access to custom V4L2 ioctls.  This is ok on MVL-based
#    platforms, as we know the kernel headers in the PSP are in sync with
#    the kernel headers in the gcc toolset.  However, it is not safe to do
#    this on platforms that use non-MVL PSPs.  Fortunately, the new PSPs based
#    on the later GIT kernels do not have custom ioctls, so including the PSP
#    headers directly is not needed, and the headers that come with gcc should
#    be sufficient.
#------------------------------------------------------------------------------
CPPFLAGS_all       = -DPlatform_$(GST_TI_PLATFORM)
CPPFLAGS_all      += -I$(TARGET_GSTREAMER_DIR)/include
CPPFLAGS_dm6446    = -DMVL_LSP
CPPFLAGS_dm6446   += -I$(LINUXKERNEL_INSTALL_DIR)/include
CPPFLAGS_dm6467    = -DMVL_LSP
CPPFLAGS_dm6467   += -I$(LINUXKERNEL_INSTALL_DIR)/include
CPPFLAGS_dm355     = -I$(LINUXLIBS_INSTALL_DIR)/include
CPPFLAGS_dm365     = -I$(LINUXLIBS_INSTALL_DIR)/include
CPPFLAGS_dm365    += -I$(LINUXKERNEL_INSTALL_DIR)/include
CPPFLAGS_dm368     = -I$(LINUXLIBS_INSTALL_DIR)/include
CPPFLAGS_dm368    += -I$(LINUXKERNEL_INSTALL_DIR)/include
CPPFLAGS_dm6467t   = -I$(LINUXLIBS_INSTALL_DIR)/include
CPPFLAGS_omap3530  = -I$(LINUXLIBS_INSTALL_DIR)/include
CPPFLAGS_dm3730    = -I$(LINUXLIBS_INSTALL_DIR)/include
CPPFLAGS_omapl138  = -I$(LINUXLIBS_INSTALL_DIR)/include

CFLAGS_all         = -O2
CFLAGS_dm355       = -march=armv5te -mtune=arm926ej-s
CFLAGS_dm6446      = -march=armv5te -mtune=arm926ej-s
CFLAGS_dm365       = -march=armv5te -mtune=arm926ej-s
CFLAGS_dm368       = -march=armv5te -mtune=arm926ej-s
CFLAGS_dm6467      = -march=armv5te -mtune=arm926ej-s
CFLAGS_dm6467t     = -march=armv5te -mtune=arm926ej-s
CFLAGS_omapl138    = -march=armv5te -mtune=arm926ej-s
CFLAGS_omap3530    = -march=armv7-a -mtune=cortex-a8
CFLAGS_omap3530   += -mfpu=neon -mfloat-abi=softfp
CFLAGS_dm3730      = -march=armv7-a -mtune=cortex-a8
CFLAGS_dm3730     += -mfpu=neon -mfloat-abi=softfp

LDFLAGS_all        = -L$(TARGET_GSTREAMER_DIR)/lib
LDFLAGS_dm355      = -L$(LINUXLIBS_INSTALL_DIR)/lib
LDFLAGS_dm365      = -L$(LINUXLIBS_INSTALL_DIR)/lib
LDFLAGS_dm368      = -L$(LINUXLIBS_INSTALL_DIR)/lib
LDFLAGS_dm6467t    = -L$(LINUXLIBS_INSTALL_DIR)/lib
LDFLAGS_omap3530   = -L$(LINUXLIBS_INSTALL_DIR)/lib
LDFLAGS_dm3730     = -L$(LINUXLIBS_INSTALL_DIR)/lib
LDFLAGS_omapl138   = -L$(LINUXLIBS_INSTALL_DIR)/lib

#------------------------------------------------------------------------------
# Enable ALSA support based on the CROSS_COMPILER we're using
#------------------------------------------------------------------------------
ifeq ($(CROSS_COMPILER), MVL_5_0)
    export	ALSA_SUPPORT = --enable-alsa
endif 
ifeq ($(CROSS_COMPILER), CS_2008Q1)
    export ALSA_SUPPORT = --enable-alsa --with-alsa-inc-prefix=$(LINUXLIBS_INSTALL_DIR)/include --with-alsa-prefix=$(LINUXLIBS_INSTALL_DIR)/lib 
endif
ifeq ($(CROSS_COMPILER), CS_2009Q1)
    export ALSA_SUPPORT = --enable-alsa --with-alsa-inc-prefix=$(LINUXLIBS_INSTALL_DIR)/include --with-alsa-prefix=$(LINUXLIBS_INSTALL_DIR)/lib 
endif

#------------------------------------------------------------------------------
# Configure amount of output we will generate based on the VERBOSE variable
# setting.
#------------------------------------------------------------------------------
ifeq ($(VERBOSE), false)
    override CMD_PREFIX        = @
    override TAR_VERBOSE       = 
    override CONFIGURE_VERBOSE = -q
    override PATCH_VERBOSE     = -s
    override MAKE_VERBOSE      = -s
else
    override CMD_PREFIX        = 
    override TAR_VERBOSE       = v
    override CONFIGURE_VERBOSE =
    override PATCH_VERBOSE     =
    override MAKE_VERBOSE      =
endif

#------------------------------------------------------------------------------
# If the word "install" appears on the command line, we will invoke sub-make
# commands with "make install" instead of just "make".
#------------------------------------------------------------------------------
ifeq ($(findstring install,$(MAKECMDGOALS)),install)
    override BUILD_INSTALL = install
else
    override BUILD_INSTALL = 
endif

#------------------------------------------------------------------------------
# Configure command set up to do a cross-compile and install into the target
# filesystem.
#------------------------------------------------------------------------------
CC_CONFIGURE_OPTS  = --build=i686-linux --host=arm-linux
CC_CONFIGURE_OPTS += --prefix=$(TARGET_GSTREAMER_DIR)
CC_CONFIGURE_OPTS += NM=$(MVTOOL_PREFIX)nm
CC_CONFIGURE_OPTS += RANLIB=$(MVTOOL_PREFIX)ranlib
CC_CONFIGURE_OPTS += CPPFLAGS="$(CPPFLAGS_all) $(CPPFLAGS_$(GST_TI_PLATFORM))"
CC_CONFIGURE_OPTS += CFLAGS="$(CFLAGS_all) $(CFLAGS_$(GST_TI_PLATFORM))"
CC_CONFIGURE_OPTS += LDFLAGS="$(LDFLAGS_all) $(LDFLAGS_$(GST_TI_PLATFORM))"
        
export CC                = $(MVTOOL_PREFIX)gcc
export CXX               = $(MVTOOL_PREFIX)g++
export PKG_CONFIG_PATH   = $(TARGET_GSTREAMER_DIR)/lib/pkgconfig
export PKG_CONFIG_LIBDIR = $(PKG_CONFIG_PATH)