|
1 # |
|
2 # Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. Sun designates this |
|
8 # particular file as subject to the "Classpath" exception as provided |
|
9 # by Sun in the LICENSE file that accompanied this code. |
|
10 # |
|
11 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 # version 2 for more details (a copy is included in the LICENSE file that |
|
15 # accompanied this code). |
|
16 # |
|
17 # You should have received a copy of the GNU General Public License version |
|
18 # 2 along with this work; if not, write to the Free Software Foundation, |
|
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 # |
|
21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 # have any questions. |
|
24 # |
|
25 |
|
26 # |
|
27 # Makefile to specify compiler flags for programs and libraries |
|
28 # targeted to Linux. Should not contain any rules. |
|
29 # |
|
30 |
|
31 # Warning: the following variables are overriden by Defs.gmk. Set |
|
32 # values will be silently ignored: |
|
33 # CFLAGS (set $(OTHER_CFLAGS) instead) |
|
34 # CPPFLAGS (set $(OTHER_CPPFLAGS) instead) |
|
35 # CXXFLAGS (set $(OTHER_CXXFLAGS) instead) |
|
36 # LDFLAGS (set $(OTHER_LDFAGS) instead) |
|
37 # LDLIBS (set $(EXTRA_LIBS) instead) |
|
38 # LDLIBS_COMMON (set $(EXTRA_LIBS) instead) |
|
39 |
|
40 # Get shared JDK settings |
|
41 include $(BUILDDIR)/common/shared/Defs.gmk |
|
42 |
|
43 # Part of INCREMENTAL_BUILD mechanism. |
|
44 # Compiler emits things like: path/file.o: file.h |
|
45 # We want something like: relative_path/file.o relative_path/file.d: file.h |
|
46 CC_DEPEND = -MM |
|
47 CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' |
|
48 |
|
49 ifndef PLATFORM_SRC |
|
50 PLATFORM_SRC = $(TOPDIR)/src/solaris |
|
51 endif # PLATFORM_SRC |
|
52 |
|
53 # platform specific include files |
|
54 PLATFORM_INCLUDE_NAME = $(PLATFORM) |
|
55 PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
|
56 |
|
57 # suffix used for make dependencies files. |
|
58 DEPEND_SUFFIX = d |
|
59 # The suffix applied to the library name for FDLIBM |
|
60 FDDLIBM_SUFFIX = a |
|
61 # The suffix applied to scripts (.bat for windows, nothing for unix) |
|
62 SCRIPT_SUFFIX = |
|
63 # CC compiler object code output directive flag value |
|
64 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! |
|
65 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! |
|
66 |
|
67 # |
|
68 # Default HPI libraries. Build will build only native, unless |
|
69 # overriden at the make command line. This makes it convenient for |
|
70 # people doing, say, a pthreads port -- they can create a posix |
|
71 # directory here, and say "gnumake HPIS=posix" at the top |
|
72 # level. |
|
73 # |
|
74 HPIS = native |
|
75 |
|
76 # |
|
77 # Default optimization |
|
78 # |
|
79 CC_HIGHEST_OPT = -O3 |
|
80 CC_HIGHER_OPT = -O3 |
|
81 CC_LOWER_OPT = -O2 |
|
82 CC_NO_OPT = |
|
83 |
|
84 ifeq ($(PRODUCT), java) |
|
85 _OPT = $(CC_HIGHER_OPT) |
|
86 else |
|
87 _OPT = $(CC_LOWER_OPT) |
|
88 CPPFLAGS_DBG += -DLOGGING |
|
89 endif |
|
90 |
|
91 # For all platforms, do not omit the frame pointer register usage. |
|
92 # We need this frame pointer to make it easy to walk the stacks. |
|
93 # This should be the default on X86, but ia64 and amd64 may not have this |
|
94 # as the default. |
|
95 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
|
96 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
|
97 CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
|
98 CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9 |
|
99 LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9 |
|
100 CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9 |
|
101 LDFLAGS_COMMON_sparc += -m32 -mcpu=v9 |
|
102 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
|
103 LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH)) |
|
104 |
|
105 # Add in platform specific optimizations for all opt levels |
|
106 CC_HIGHEST_OPT += $(_OPT_$(ARCH)) |
|
107 CC_HIGHER_OPT += $(_OPT_$(ARCH)) |
|
108 CC_LOWER_OPT += $(_OPT_$(ARCH)) |
|
109 |
|
110 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off |
|
111 ifdef NO_OPTIMIZATIONS |
|
112 CC_HIGHEST_OPT = $(CC_NO_OPT) |
|
113 CC_HIGHER_OPT = $(CC_NO_OPT) |
|
114 CC_LOWER_OPT = $(CC_NO_OPT) |
|
115 endif |
|
116 |
|
117 # |
|
118 # Selection of warning messages |
|
119 # |
|
120 GCC_INHIBIT = -Wno-unused -Wno-parentheses |
|
121 GCC_STYLE = |
|
122 GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT) |
|
123 |
|
124 # |
|
125 # Treat compiler warnings as errors, if warnings not allowed |
|
126 # |
|
127 ifeq ($(COMPILER_WARNINGS_FATAL),true) |
|
128 GCC_WARNINGS += -Werror |
|
129 endif |
|
130 |
|
131 # |
|
132 # Misc compiler options |
|
133 # |
|
134 ifeq ($(ARCH),ppc) |
|
135 CFLAGS_COMMON = -fsigned-char |
|
136 else # ARCH |
|
137 CFLAGS_COMMON = -fno-strict-aliasing |
|
138 endif # ARCH |
|
139 PIC_CODE_LARGE = -fPIC |
|
140 PIC_CODE_SMALL = -fpic |
|
141 GLOBAL_KPIC = $(PIC_CODE_LARGE) |
|
142 ifeq ($(ARCH), amd64) |
|
143 CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe |
|
144 else |
|
145 CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) |
|
146 endif |
|
147 |
|
148 # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1 |
|
149 DEBUG_FLAG = -g |
|
150 ifeq ($(FASTDEBUG), true) |
|
151 ifeq ($(ARCH_DATA_MODEL), 64) |
|
152 DEBUG_FLAG = -g1 |
|
153 endif |
|
154 endif |
|
155 |
|
156 CFLAGS_OPT = $(POPT) |
|
157 CFLAGS_DBG = $(DEBUG_FLAG) |
|
158 CFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
159 |
|
160 CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS) |
|
161 CXXFLAGS_OPT = $(POPT) |
|
162 CXXFLAGS_DBG = $(DEBUG_FLAG) |
|
163 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
164 |
|
165 # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java |
|
166 ifeq ($(FASTDEBUG), true) |
|
167 CFLAGS_DBG += $(CC_LOWER_OPT) |
|
168 CXXFLAGS_DBG += $(CC_LOWER_OPT) |
|
169 endif |
|
170 |
|
171 CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \ |
|
172 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT |
|
173 |
|
174 ifeq ($(ARCH_DATA_MODEL), 64) |
|
175 CPPFLAGS_COMMON += -D_LP64=1 |
|
176 endif |
|
177 |
|
178 CPPFLAGS_OPT = |
|
179 CPPFLAGS_DBG = -DDEBUG |
|
180 |
|
181 ifdef LIBRARY |
|
182 # Libraries need to locate other libraries at runtime, and you can tell |
|
183 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
|
184 # buried inside the .so. The $ORIGIN says to look relative to where |
|
185 # the library itself is and it can be followed with relative paths from |
|
186 # that. By default we always look in $ORIGIN, optionally we add relative |
|
187 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
|
188 # On Linux we add a flag -z origin, not sure if this is necessary, but |
|
189 # doesn't seem to hurt. |
|
190 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
|
191 # Try: 'readelf -d lib*.so' to see these settings in a library. |
|
192 # |
|
193 LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN |
|
194 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%) |
|
195 endif |
|
196 |
|
197 EXTRA_LIBS += -lc |
|
198 |
|
199 LDFLAGS_DEFS_OPTION = -z defs |
|
200 LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
|
201 |
|
202 # |
|
203 # -L paths for finding and -ljava |
|
204 # |
|
205 LDFLAGS_OPT = -Xlinker -O1 |
|
206 LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
|
207 LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) |
|
208 |
|
209 # |
|
210 # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always |
|
211 # statically link libgcc but will print a warning with the flag. We don't |
|
212 # want the warning, so check gcc version first. |
|
213 # |
|
214 CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1) |
|
215 ifeq ("$(CC_VER_MAJOR)", "3") |
|
216 OTHER_LDFLAGS += -static-libgcc |
|
217 endif |
|
218 |
|
219 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
|
220 # (See Rules.gmk) The gcc 5 compiler might have an option for this? |
|
221 AUTOMATIC_PCH_OPTION = |
|
222 |
|
223 # |
|
224 # Post Processing of libraries/executables |
|
225 # |
|
226 ifeq ($(VARIANT), OPT) |
|
227 ifneq ($(NO_STRIP), true) |
|
228 # Debug 'strip -g' leaves local function Elf symbols (better stack traces) |
|
229 POST_STRIP_PROCESS = $(STRIP) -g |
|
230 endif |
|
231 endif |
|
232 |
|
233 # |
|
234 # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o |
|
235 # |
|
236 LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker |
|
237 |
|
238 # |
|
239 # Support for Quantify. |
|
240 # |
|
241 ifdef QUANTIFY |
|
242 QUANTIFY_CMD = quantify |
|
243 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
|
244 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
|
245 endif |
|
246 |
|
247 # |
|
248 # Path and option to link against the VM, if you have to. Note that |
|
249 # there are libraries that link against only -ljava, but they do get |
|
250 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
|
251 # the library itself should not. |
|
252 # |
|
253 VM_NAME = server |
|
254 JVMLIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvm |
|
255 JAVALIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB) |
|
256 |
|
257 # |
|
258 # We want to privatize JVM symbols on Solaris. This is so the user can |
|
259 # write a function called FindClass and this should not override the |
|
260 # FindClass that is inside the JVM. At this point in time we are not |
|
261 # concerned with other JNI libraries because we hope that there will |
|
262 # not be as many clashes there. |
|
263 # |
|
264 PRIVATIZE_JVM_SYMBOLS = false |
|
265 |
|
266 USE_PTHREADS = true |
|
267 override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME |
|
268 override AWT_RUNPATH = |
|
269 override HAVE_ALTZONE = false |
|
270 override HAVE_FILIOH = false |
|
271 override HAVE_GETHRTIME = false |
|
272 override HAVE_GETHRVTIME = false |
|
273 override HAVE_SIGIGNORE = true |
|
274 override LEX_LIBRARY = -lfl |
|
275 ifeq ($(STATIC_CXX),true) |
|
276 override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic |
|
277 else |
|
278 override LIBCXX = -lstdc++ |
|
279 endif |
|
280 override LIBPOSIX4 = |
|
281 override LIBSOCKET = |
|
282 override LIBTHREAD = |
|
283 override MOOT_PRIORITIES = true |
|
284 override NO_INTERRUPTIBLE_IO = true |
|
285 override OPENWIN_HOME = /usr/X11R6 |
|
286 ifeq ($(ARCH), amd64) |
|
287 override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 |
|
288 else |
|
289 override OPENWIN_LIB = $(OPENWIN_HOME)/lib |
|
290 endif |
|
291 override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER |
|
292 override SUN_CMM_SUBDIR = |
|
293 override THREADS_FLAG = native |
|
294 override USE_GNU_M4 = true |
|
295 override USING_GNU_TAR = true |
|
296 override WRITE_LIBVERSION = false |
|
297 |
|
298 # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the |
|
299 # resulting resolved absolute name of the executable in the environment |
|
300 # variable EXECNAME. That executable name is then used that to locate the |
|
301 # installation area. |
|
302 override USE_EXECNAME = true |
|
303 |
|
304 # If your platform has DPS, it will have Type1 fonts too, in which case |
|
305 # it is best to enable DPS support until such time as 2D's rasteriser |
|
306 # can fully handle Type1 fonts in all cases. Default is "yes". |
|
307 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
|
308 # DPS (Displayable PostScript) is available on Solaris machines |
|
309 HAVE_DPS = no |
|
310 |
|
311 # |
|
312 # Japanese manpages |
|
313 # |
|
314 JA_SOURCE_ENCODING = eucJP |
|
315 JA_TARGET_ENCODINGS = eucJP |
|
316 |