-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile.unix-user
174 lines (149 loc) · 5.75 KB
/
Makefile.unix-user
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
# $Id: Makefile.unix-user 1.28 Broadcom SDK $
# $Copyright: Copyright 2011 Broadcom Corporation.
# This program is the proprietary software of Broadcom Corporation
# and/or its licensors, and may only be used, duplicated, modified
# or distributed pursuant to the terms and conditions of a separate,
# written license agreement executed between you and Broadcom
# (an "Authorized License"). Except as set forth in an Authorized
# License, Broadcom grants no license (express or implied), right
# to use, or waiver of any kind with respect to the Software, and
# Broadcom expressly reserves all rights in and to the Software
# and all intellectual property rights therein. IF YOU HAVE
# NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE
# IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
# ALL USE OF THE SOFTWARE.
#
# Except as expressly set forth in the Authorized License,
#
# 1. This program, including its structure, sequence and organization,
# constitutes the valuable trade secrets of Broadcom, and you shall use
# all reasonable efforts to protect the confidentiality thereof,
# and to use this information only in connection with your use of
# Broadcom integrated circuit products.
#
# 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS
# PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
# REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
# OR OTHERWISE, WITH RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY
# DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
# NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
# ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
# CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
# OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
#
# 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
# BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL,
# INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER
# ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY
# TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF
# THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00,
# WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING
# ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.$
#
# Build rules for Linux user mode support
# When using GDB on Linux, you may want to use "setenv GDB 1" to disable
# editline. For best results put "set environment GDB 1" in your .gdbinit.
# Get cross tools and platform specific settings
ifneq (,$(platform))
include ${SDK}/make/Makefile.linux-$(platform)
endif
# Filter out features that cannot or should not be supported in Linux
ifdef ESW_CHIPS
_FEATURE_EXCLUDE_LIST += OOB_RCPU
endif
FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST))
# User-Linux Configuration Flags
CC = $(LSRUN) $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
ARFLAGS = -rc
STRIP = $(CROSS_COMPILE)strip
RANLIB = $(CROSS_COMPILE)ranlib
OBJCOPY = $(CROSS_COMPILE)objcopy
OPTFLAGS_DEFAULT = -O2
# Configuration Variable
# OSType Defines: This defines the type of RTOS or microkernel which you
# are compiling the SAL (and its associated driver) for. New platforms
# can be created by porting the routines (system.c) to your platform and
# adding the define in this Makefile.
OSTYPE = LINUX
# Linux
LIBS= -lnsl -lpthread -lm -lrt
#
# ORIGIN is used to Optionally select different CFLAGS. It is used to import
# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added
# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT
# added.
#
# Default specifies Broadcom
#
ifndef ORIGIN
ORIGIN = Broadcom
endif
#
# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations
# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files
# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of
# this Makefile, to define local "Extra" flags.
#
STD_CFLAGS = $(OPTFLAGS) -D_REENTRANT -D${OSTYPE} ${CFGFLAGS} \
-D$(ENDIAN) -D__BSD_SOURCE -DUNIX
ifeq ($(LINUX_MAKE_SHARED_LIB),1)
STD_CFLAGS += -fPIC
endif
STD_CPPFLAGS = ${STD_CFLAGS}
STD_CXXFLAGS = ${STD_CFLAGS}
BCM_CFLAGS = -Wall -Werror -fno-strict-aliasing
ifeq ($(platform), robo-bsp-2_6)
ifeq (2.0,$(WRS_LINUX_VERSION))
BCM_CFLAGS = -Wall -Werror -fno-strict-aliasing -Wno-pointer-sign
endif
endif
BCM_CPPFLAGS = ${BCM_CFLAGS}
BCM_CXXFLAGS = ${BCM_CFLAGS}
ifeq (${ORIGIN}, Broadcom)
CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS}
CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS}
CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS}
else
CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS}
CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS}
CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS}
endif
#
# Add flags required for running on linux.
#
ifneq ($(LINUX_MAKE_SHARED_LIB),1)
ifndef LINK_STATIC
LINK_STATIC = 1
endif
endif
ifeq (${LINK_STATIC},1)
LDFLAGS += -static
endif
LDFLAGS += ${LIBS}
#
# DEPEND is used as a command to generate the list of dependencies.
# The format of the output must be
# "file.o : file.c a/b/c.h d/e/f.h ...",
# if it is on multiple lines, each line must end in a backslash.
# The output MUST be on standard out.
#
DEPEND = ${CC} -M $(CFLAGS) $<
#
# Optionally link against different library versions.
#
ifneq (,${LIB_OVERRIDE})
CFLAGS += -B${LIB_OVERRIDE} -nostdinc -I`$(CC) --print-file-name=include` -I${LIB_OVERRIDE}/../usr/include
LDFLAGS += -Wl,-rpath-link,${LIB_OVERRIDE}
endif
#
# Optionally use the linker --relax flag to enable linking larger
# images on the GTO platform (currently only needed for
# SBX+TCL+optimization disabled for debugging)
#
ifneq (,${LINKER_RELAX})
LDFLAGS += -Wl,--relax
endif