PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/security/coreconf/Linux.mk

http://github.com/zpao/v8monkey
Makefile | 207 lines | 122 code | 25 blank | 60 comment | 0 complexity | e315f1dae0ed4edc8ed944f551b49c8d MD5 | raw file
  1#
  2# ***** BEGIN LICENSE BLOCK *****
  3# Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4#
  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/
  9#
 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
 13# License.
 14#
 15# The Original Code is the Netscape security libraries.
 16#
 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.
 21#
 22# Contributor(s):
 23#
 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.
 35#
 36# ***** END LICENSE BLOCK *****
 37
 38include $(CORE_DEPTH)/coreconf/UNIX.mk
 39
 40#
 41# The default implementation strategy for Linux is now pthreads
 42#
 43USE_PTHREADS = 1
 44
 45ifeq ($(USE_PTHREADS),1)
 46	IMPL_STRATEGY = _PTH
 47endif
 48
 49CC			= gcc
 50CCC			= g++
 51RANLIB			= ranlib
 52
 53DEFAULT_COMPILER = gcc
 54
 55ifeq ($(OS_TEST),ppc64)
 56	CPU_ARCH	= ppc
 57ifeq ($(USE_64),1)
 58	ARCHFLAG	= -m64
 59endif
 60else
 61ifeq ($(OS_TEST),alpha)
 62        OS_REL_CFLAGS   = -D_ALPHA_
 63	CPU_ARCH	= alpha
 64else
 65ifeq ($(OS_TEST),x86_64)
 66ifeq ($(USE_64),1)
 67	CPU_ARCH	= x86_64
 68else
 69	OS_REL_CFLAGS	= -Di386
 70	CPU_ARCH	= x86
 71	ARCHFLAG	= -m32
 72endif
 73else
 74ifeq ($(OS_TEST),sparc64)
 75	CPU_ARCH        = sparc
 76else
 77ifeq (,$(filter-out arm% sa110,$(OS_TEST)))
 78	CPU_ARCH        = arm
 79else
 80ifeq (,$(filter-out parisc%,$(OS_TEST)))
 81	CPU_ARCH        = hppa
 82else
 83ifeq (,$(filter-out i%86,$(OS_TEST)))
 84	OS_REL_CFLAGS	= -Di386
 85	CPU_ARCH	= x86
 86else
 87ifeq ($(OS_TEST),sh4a)
 88	CPU_ARCH        = sh4
 89else
 90# $(OS_TEST) == m68k, ppc, ia64, sparc, s390, s390x, mips, sh3, sh4
 91	CPU_ARCH	= $(OS_TEST)
 92endif
 93endif
 94endif
 95endif
 96endif
 97endif
 98endif
 99endif
100
101
102LIBC_TAG		= _glibc
103
104ifeq ($(OS_RELEASE),2.0)
105	OS_REL_CFLAGS	+= -DLINUX2_0
106	MKSHLIB		= $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
107	ifdef MAPFILE
108		MKSHLIB += -Wl,--version-script,$(MAPFILE)
109	endif
110	PROCESS_MAP_FILE = grep -v ';-' $< | \
111         sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
112endif
113
114ifdef BUILD_OPT
115ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
116	OPTIMIZER = -Os
117else
118	OPTIMIZER = -O2
119endif
120ifdef MOZ_DEBUG_SYMBOLS
121	ifdef MOZ_DEBUG_FLAGS
122		OPTIMIZER += $(MOZ_DEBUG_FLAGS)
123	else
124		OPTIMIZER += -gdwarf-2
125	endif
126endif
127endif
128
129
130ifeq ($(USE_PTHREADS),1)
131OS_PTHREAD = -lpthread 
132endif
133
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.
138STANDARDS_CFLAGS	= -ansi -D_POSIX_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE
139OS_CFLAGS		= $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR
140OS_LIBS			= $(OS_PTHREAD) -ldl -lc
141
142ifdef USE_PTHREADS
143	DEFINES		+= -D_REENTRANT
144endif
145
146ARCH			= linux
147
148DSO_CFLAGS		= -fPIC
149DSO_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.
153ZDEFS_FLAG		= -Wl,-z,defs
154DSO_LDOPTS		+= $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
155LDFLAGS			+= $(ARCHFLAG)
156
157# On Maemo, we need to use the -rpath-link flag for even the standard system
158# library directories.
159ifdef _SBOX_DIR
160LDFLAGS			+= -Wl,-rpath-link,/usr/lib:/lib
161endif
162
163# INCLUDES += -I/usr/include -Y/usr/include/linux
164G++INCLUDES		= -I/usr/include/g++
165
166#
167# Always set CPU_TAG on Linux, WINCE.
168#
169CPU_TAG = _$(CPU_ARCH)
170
171#
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
174# override this.
175#
176ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE))))
177ifndef FREEBL_NO_DEPEND
178FREEBL_NO_DEPEND = 1
179FREEBL_LOWHASH = 1
180endif
181endif
182
183USE_SYSTEM_ZLIB = 1
184ZLIB_LIBS = -lz
185
186# The -rpath '$$ORIGIN' linker option instructs this library to search for its
187# dependencies in the same directory where it resides.
188ifeq ($(BUILD_SUN_PKG), 1)
189ifeq ($(USE_64), 1)
190RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib64:/opt/sun/private/lib'
191else
192RPATH = -Wl,-rpath,'$$ORIGIN:/opt/sun/private/lib'
193endif
194endif
195
196OS_REL_CFLAGS   += -DLINUX2_1
197MKSHLIB         = $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) $(RPATH)
198
199ifdef MAPFILE
200	MKSHLIB += -Wl,--version-script,$(MAPFILE)
201endif
202PROCESS_MAP_FILE = grep -v ';-' $< | \
203        sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
204
205ifeq ($(OS_RELEASE),2.4)
206DEFINES += -DNO_FORK_CHECK
207endif