2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
15 # The Original Code is the Netscape security libraries.
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1994-2000
20 # the Initial Developer. All Rights Reserved.
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
38 include $(CORE_DEPTH
)/coreconf
/UNIX.mk
41 # The default implementation strategy for Linux is now pthreads
45 ifeq ($(USE_PTHREADS
),1)
53 DEFAULT_COMPILER
= gcc
55 ifeq ($(OS_TEST
),ppc64
)
61 ifeq ($(OS_TEST
),alpha
)
62 OS_REL_CFLAGS
= -D_ALPHA_
65 ifeq ($(OS_TEST
),x86_64
)
69 OS_REL_CFLAGS
= -Di386
74 ifeq ($(OS_TEST
),sparc64
)
77 ifeq (,$(filter-out arm
% sa110
,$(OS_TEST
)))
80 ifeq (,$(filter-out parisc
%,$(OS_TEST
)))
83 ifeq (,$(filter-out i
%86,$(OS_TEST
)))
84 OS_REL_CFLAGS
= -Di386
87 ifeq ($(OS_TEST
),sh4a
)
90 # $(OS_TEST) == m68k, ppc, ia64, sparc, s390, s390x, mips, sh3, sh4
104 ifeq ($(OS_RELEASE
),2.0)
105 OS_REL_CFLAGS
+= -DLINUX2_0
106 MKSHLIB
= $(CC
) -shared
-Wl
,-soname
-Wl
,$(@
:$(OBJDIR
)/%.so
=%.so
) $(RPATH
)
108 MKSHLIB
+= -Wl
,--version-script
,$(MAPFILE
)
110 PROCESS_MAP_FILE
= grep
-v
';-' $< | \
111 sed
-e
's,;+,,' -e
's; DATA ;;' -e
's,;;,,' -e
's,;.*,;,' > $@
115 ifeq (11,$(ALLOW_OPT_CODE_SIZE
)$(OPT_CODE_SIZE
))
120 ifdef MOZ_DEBUG_SYMBOLS
121 ifdef MOZ_DEBUG_FLAGS
122 OPTIMIZER
+= $(MOZ_DEBUG_FLAGS
)
124 OPTIMIZER
+= -gdwarf-2
130 ifeq ($(USE_PTHREADS
),1)
131 OS_PTHREAD
= -lpthread
134 # See bug 537829, in particular comment 23.
135 # Place -ansi and *_SOURCE before $(DSO_CFLAGS) so DSO_CFLAGS can override
136 # -ansi on platforms like Android where the system headers are C99 and do
137 # not build with -ansi.
138 STANDARDS_CFLAGS
= -ansi
-D_POSIX_SOURCE
-D_BSD_SOURCE
-D_XOPEN_SOURCE
139 OS_CFLAGS
= $(STANDARDS_CFLAGS
) $(DSO_CFLAGS
) $(OS_REL_CFLAGS
) $(ARCHFLAG
) -Wall
-Werror-implicit-function-declaration
-Wno-switch
-pipe
-DLINUX
-Dlinux
-DHAVE_STRERROR
140 OS_LIBS
= $(OS_PTHREAD
) -ldl
-lc
143 DEFINES
+= -D_REENTRANT
149 DSO_LDOPTS
= -shared
$(ARCHFLAG
)
150 # The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
151 # incorrectly reports undefined references in the libraries we link with, so
152 # we don't use -z defs there.
153 ZDEFS_FLAG
= -Wl
,-z
,defs
154 DSO_LDOPTS
+= $(if
$(findstring 2.11.90.0.8,$(shell ld -v
)),,$(ZDEFS_FLAG
))
155 LDFLAGS
+= $(ARCHFLAG
)
157 # On Maemo, we need to use the -rpath-link flag for even the standard system
158 # library directories.
160 LDFLAGS
+= -Wl
,-rpath-link
,/usr
/lib
:/lib
163 # INCLUDES += -I/usr/include -Y/usr/include/linux
164 G
++INCLUDES
= -I
/usr
/include/g
++
167 # Always set CPU_TAG on Linux, WINCE.
169 CPU_TAG
= _
$(CPU_ARCH
)
172 # On Linux 2.6 or later, build libfreebl3.so with no NSPR and libnssutil3.so
173 # dependencies by default. Set FREEBL_NO_DEPEND to 0 in the environment to
176 ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE
))))
177 ifndef FREEBL_NO_DEPEND
185 # The -rpath '$$ORIGIN' linker option instructs this library to search for its
186 # dependencies in the same directory where it resides.
187 ifeq ($(BUILD_SUN_PKG
), 1)
189 RPATH
= -Wl
,-rpath
,'$$ORIGIN:/opt/sun/private/lib64:/opt/sun/private/lib'
191 RPATH
= -Wl
,-rpath
,'$$ORIGIN:/opt/sun/private/lib'