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
47 # When cross-compiling, CPU_ARCH should already be defined as the target
48 # architecture, set to powerpc or i386.
49 CPU_ARCH
:= $(shell uname
-p
)
52 ifeq (,$(filter-out i
%86,$(CPU_ARCH
)))
53 OS_REL_CFLAGS
= -Di386
58 ifneq (,$(MACOS_SDK_DIR
))
59 GCC_VERSION_FULL
:= $(shell $(CC
) -v
2>&1 | grep
"gcc version" | sed
-e
"s/^.*gcc version[ ]*//" | awk
'{ print $$1 }')
60 GCC_VERSION_MAJOR
:= $(shell echo
$(GCC_VERSION_FULL
) | awk
-F.
'{ print $$1 }')
61 GCC_VERSION_MINOR
:= $(shell echo
$(GCC_VERSION_FULL
) | awk
-F.
'{ print $$2 }')
62 GCC_VERSION
= $(GCC_VERSION_MAJOR
).
$(GCC_VERSION_MINOR
)
64 ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR
)))
66 DARWIN_SDK_FRAMEWORKS
= -F
$(MACOS_SDK_DIR
)/System
/Library
/Frameworks
67 ifneq (,$(shell find
$(MACOS_SDK_DIR
)/Library
/Frameworks
-maxdepth
0))
68 DARWIN_SDK_FRAMEWORKS
+= -F
$(MACOS_SDK_DIR
)/Library
/Frameworks
70 DARWIN_SDK_CFLAGS
= -nostdinc
-isystem
$(MACOS_SDK_DIR
)/usr
/include/gcc
/darwin
/$(GCC_VERSION
) -isystem
$(MACOS_SDK_DIR
)/usr
/include $(DARWIN_SDK_FRAMEWORKS
)
71 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
72 DARWIN_SDK_SHLIBFLAGS
= $(DARWIN_SDK_LDFLAGS
) $(DARWIN_SDK_FRAMEWORKS
)
73 NEXT_ROOT
= $(MACOS_SDK_DIR
)
77 DARWIN_SDK_CFLAGS
= -isysroot
$(MACOS_SDK_DIR
)
78 ifneq (4.0.0,$(GCC_VERSION_FULL
))
79 # gcc > 4.0.0 passes -syslibroot to ld based on -isysroot.
80 # Don't add -isysroot to DARWIN_SDK_LDFLAGS, because the programs
81 # that are linked with those flags also get DARWIN_SDK_CFLAGS.
82 DARWIN_SDK_SHLIBFLAGS
= -isysroot
$(MACOS_SDK_DIR
)
84 # gcc 4.0.0 doesn't pass -syslibroot to ld, it needs to be
86 DARWIN_SDK_LDFLAGS
= -Wl
,-syslibroot
,$(MACOS_SDK_DIR
)
87 DARWIN_SDK_SHLIBFLAGS
= $(DARWIN_SDK_LDFLAGS
)
91 LDFLAGS
+= $(DARWIN_SDK_LDFLAGS
)
94 # "Commons" are tentative definitions in a global scope, like this:
96 # The meaning of a common is ambiguous. It may be a true definition:
98 # or it may be a declaration of a symbol defined in another file:
100 # Use the -fno-common option to force all commons to become true
101 # definitions so that the linker can catch multiply-defined symbols.
102 # Also, common symbols are not allowed with Darwin dynamic libraries.
104 OS_CFLAGS
= $(DSO_CFLAGS
) $(OS_REL_CFLAGS
) -Wmost
-fpascal-strings
-fno-common
-pipe
-DDARWIN
-DHAVE_STRERROR
-DHAVE_BSD_FLOCK
$(DARWIN_SDK_CFLAGS
)
107 ifeq (11,$(ALLOW_OPT_CODE_SIZE
)$(OPT_CODE_SIZE
))
117 # May override this with -bundle to create a loadable module.
118 DSO_LDOPTS
= -dynamiclib
-compatibility_version
1 -current_version
1 -install_name @executable_path
/$(notdir $@
) -headerpad_max_install_names
120 MKSHLIB
= $(CC
) $(DSO_LDOPTS
) $(DARWIN_SDK_SHLIBFLAGS
)
122 PROCESS_MAP_FILE
= grep
-v
';+' $< | grep
-v
';-' | \
123 sed
-e
's; DATA ;;' -e
's,;;,,' -e
's,;.*,,' -e
's,^,_,' > $@
125 G
++INCLUDES
= -I
/usr
/include/g
++