1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/coreconf/Darwin.mk Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,118 @@ 1.4 +# 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +include $(CORE_DEPTH)/coreconf/UNIX.mk 1.10 + 1.11 +DEFAULT_COMPILER = gcc 1.12 + 1.13 +CC = gcc 1.14 +CCC = g++ 1.15 +RANLIB = ranlib 1.16 + 1.17 +ifndef CPU_ARCH 1.18 +# When cross-compiling, CPU_ARCH should already be defined as the target 1.19 +# architecture, set to powerpc or i386. 1.20 +CPU_ARCH := $(shell uname -p) 1.21 +endif 1.22 + 1.23 +ifeq (,$(filter-out i%86,$(CPU_ARCH))) 1.24 +ifdef USE_64 1.25 +CC += -arch x86_64 1.26 +override CPU_ARCH = x86_64 1.27 +else 1.28 +OS_REL_CFLAGS = -Di386 1.29 +CC += -arch i386 1.30 +override CPU_ARCH = x86 1.31 +endif 1.32 +else 1.33 +ifeq (arm,$(CPU_ARCH)) 1.34 +# Nothing set for arm currently. 1.35 +else 1.36 +OS_REL_CFLAGS = -Dppc 1.37 +CC += -arch ppc 1.38 +endif 1.39 +endif 1.40 + 1.41 +ifneq (,$(MACOS_SDK_DIR)) 1.42 + GCC_VERSION_FULL := $(shell $(CC) -dumpversion) 1.43 + GCC_VERSION_MAJOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$1 }') 1.44 + GCC_VERSION_MINOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$2 }') 1.45 + GCC_VERSION = $(GCC_VERSION_MAJOR).$(GCC_VERSION_MINOR) 1.46 + 1.47 + ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR))) 1.48 + # GCC <= 3 1.49 + DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks 1.50 + ifneq (,$(shell find $(MACOS_SDK_DIR)/Library/Frameworks -maxdepth 0)) 1.51 + DARWIN_SDK_FRAMEWORKS += -F$(MACOS_SDK_DIR)/Library/Frameworks 1.52 + endif 1.53 + DARWIN_SDK_CFLAGS = -nostdinc -isystem $(MACOS_SDK_DIR)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(MACOS_SDK_DIR)/usr/include $(DARWIN_SDK_FRAMEWORKS) 1.54 + DARWIN_SDK_LDFLAGS = -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin/$(GCC_VERSION_FULL) -L$(MACOS_SDK_DIR)/usr/lib 1.55 + DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS) $(DARWIN_SDK_FRAMEWORKS) 1.56 + NEXT_ROOT = $(MACOS_SDK_DIR) 1.57 + export NEXT_ROOT 1.58 + else 1.59 + # GCC >= 4 1.60 + DARWIN_SDK_CFLAGS = -isysroot $(MACOS_SDK_DIR) 1.61 + ifneq (4.0.0,$(GCC_VERSION_FULL)) 1.62 + # gcc > 4.0.0 passes -syslibroot to ld based on -isysroot. 1.63 + # Don't add -isysroot to DARWIN_SDK_LDFLAGS, because the programs 1.64 + # that are linked with those flags also get DARWIN_SDK_CFLAGS. 1.65 + DARWIN_SDK_SHLIBFLAGS = -isysroot $(MACOS_SDK_DIR) 1.66 + else 1.67 + # gcc 4.0.0 doesn't pass -syslibroot to ld, it needs to be 1.68 + # explicit. 1.69 + DARWIN_SDK_LDFLAGS = -Wl,-syslibroot,$(MACOS_SDK_DIR) 1.70 + DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS) 1.71 + endif 1.72 + endif 1.73 + 1.74 + LDFLAGS += $(DARWIN_SDK_LDFLAGS) 1.75 +endif 1.76 + 1.77 +# "Commons" are tentative definitions in a global scope, like this: 1.78 +# int x; 1.79 +# The meaning of a common is ambiguous. It may be a true definition: 1.80 +# int x = 0; 1.81 +# or it may be a declaration of a symbol defined in another file: 1.82 +# extern int x; 1.83 +# Use the -fno-common option to force all commons to become true 1.84 +# definitions so that the linker can catch multiply-defined symbols. 1.85 +# Also, common symbols are not allowed with Darwin dynamic libraries. 1.86 + 1.87 +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK $(DARWIN_SDK_CFLAGS) 1.88 + 1.89 +ifdef BUILD_OPT 1.90 +ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE)) 1.91 + OPTIMIZER = -Oz 1.92 +else 1.93 + OPTIMIZER = -O2 1.94 +endif 1.95 +ifdef MOZ_DEBUG_SYMBOLS 1.96 + ifdef MOZ_DEBUG_FLAGS 1.97 + OPTIMIZER += $(MOZ_DEBUG_FLAGS) 1.98 + else 1.99 + OPTIMIZER += -gdwarf-2 -gfull 1.100 + endif 1.101 +endif 1.102 +endif 1.103 + 1.104 +ARCH = darwin 1.105 + 1.106 +DSO_CFLAGS = -fPIC 1.107 +# May override this with different compatibility and current version numbers. 1.108 +DARWIN_DYLIB_VERSIONS = -compatibility_version 1 -current_version 1 1.109 +# May override this with -bundle to create a loadable module. 1.110 +DSO_LDOPTS = -dynamiclib $(DARWIN_DYLIB_VERSIONS) -install_name @executable_path/$(notdir $@) -headerpad_max_install_names 1.111 + 1.112 +MKSHLIB = $(CC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS) 1.113 +DLL_SUFFIX = dylib 1.114 +ifdef MAPFILE 1.115 + MKSHLIB += -exported_symbols_list $(MAPFILE) 1.116 +endif 1.117 +PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \ 1.118 + sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,_,' > $@ 1.119 + 1.120 +USE_SYSTEM_ZLIB = 1 1.121 +ZLIB_LIBS = -lz