26 # |
26 # |
27 # Makefile to specify compiler flags for programs and libraries |
27 # Makefile to specify compiler flags for programs and libraries |
28 # targeted to Linux. Should not contain any rules. |
28 # targeted to Linux. Should not contain any rules. |
29 # |
29 # |
30 |
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 |
31 # Get shared JDK settings |
41 include $(BUILDDIR)/common/shared/Defs.gmk |
32 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 |
33 |
49 ifndef PLATFORM_SRC |
34 ifndef PLATFORM_SRC |
50 PLATFORM_SRC = $(TOPDIR)/src/solaris |
35 PLATFORM_SRC = $(TOPDIR)/src/solaris |
51 endif # PLATFORM_SRC |
36 endif # PLATFORM_SRC |
52 |
37 |
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 ifeq ($(ZERO_BUILD), true) |
|
103 CFLAGS_REQUIRED = $(ZERO_ARCHFLAG) |
|
104 ifeq ($(ZERO_ENDIANNESS), little) |
|
105 CFLAGS_REQUIRED += -D_LITTLE_ENDIAN |
|
106 endif |
|
107 LDFLAGS_COMMON += $(ZERO_ARCHFLAG) |
|
108 else |
|
109 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
|
110 LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH)) |
|
111 endif |
|
112 |
|
113 # Add in platform specific optimizations for all opt levels |
|
114 CC_HIGHEST_OPT += $(_OPT_$(ARCH)) |
|
115 CC_HIGHER_OPT += $(_OPT_$(ARCH)) |
|
116 CC_LOWER_OPT += $(_OPT_$(ARCH)) |
|
117 |
|
118 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off |
|
119 ifdef NO_OPTIMIZATIONS |
|
120 CC_HIGHEST_OPT = $(CC_NO_OPT) |
|
121 CC_HIGHER_OPT = $(CC_NO_OPT) |
|
122 CC_LOWER_OPT = $(CC_NO_OPT) |
|
123 endif |
|
124 |
|
125 # |
|
126 # Selection of warning messages |
|
127 # |
|
128 GCC_INHIBIT = -Wno-unused -Wno-parentheses |
|
129 GCC_STYLE = |
|
130 GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT) |
|
131 |
|
132 # |
|
133 # Treat compiler warnings as errors, if warnings not allowed |
|
134 # |
|
135 ifeq ($(COMPILER_WARNINGS_FATAL),true) |
|
136 GCC_WARNINGS += -Werror |
|
137 endif |
|
138 |
|
139 # |
|
140 # Misc compiler options |
|
141 # |
|
142 ifeq ($(ARCH),ppc) |
|
143 CFLAGS_COMMON = -fsigned-char |
|
144 else # ARCH |
|
145 CFLAGS_COMMON = -fno-strict-aliasing |
|
146 endif # ARCH |
|
147 PIC_CODE_LARGE = -fPIC |
|
148 PIC_CODE_SMALL = -fpic |
|
149 GLOBAL_KPIC = $(PIC_CODE_LARGE) |
|
150 ifeq ($(ARCH), amd64) |
|
151 CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe |
|
152 else |
|
153 CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) |
|
154 endif |
|
155 |
|
156 # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1 |
|
157 DEBUG_FLAG = -g |
|
158 ifeq ($(FASTDEBUG), true) |
|
159 ifeq ($(ARCH_DATA_MODEL), 64) |
|
160 DEBUG_FLAG = -g1 |
|
161 endif |
|
162 endif |
|
163 |
|
164 CFLAGS_OPT = $(POPT) |
|
165 CFLAGS_DBG = $(DEBUG_FLAG) |
|
166 CFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
167 |
|
168 CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS) |
|
169 CXXFLAGS_OPT = $(POPT) |
|
170 CXXFLAGS_DBG = $(DEBUG_FLAG) |
|
171 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
172 |
|
173 # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java |
|
174 ifeq ($(FASTDEBUG), true) |
|
175 CFLAGS_DBG += $(CC_LOWER_OPT) |
|
176 CXXFLAGS_DBG += $(CC_LOWER_OPT) |
|
177 endif |
|
178 |
|
179 CPP_ARCH_FLAGS = -DARCH='"$(ARCH)"' |
|
180 |
|
181 # Alpha arch does not like "alpha" defined (potential general arch cleanup issue here) |
|
182 ifneq ($(ARCH),alpha) |
|
183 CPP_ARCH_FLAGS += -D$(ARCH) |
|
184 else |
|
185 CPP_ARCH_FLAGS += -D_$(ARCH)_ |
|
186 endif |
|
187 |
|
188 CPPFLAGS_COMMON = $(CPP_ARCH_FLAGS) -DLINUX $(VERSION_DEFINES) \ |
|
189 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT |
|
190 |
|
191 ifeq ($(ARCH_DATA_MODEL), 64) |
|
192 CPPFLAGS_COMMON += -D_LP64=1 |
|
193 endif |
|
194 |
|
195 CPPFLAGS_OPT = |
|
196 CPPFLAGS_DBG = -DDEBUG |
|
197 |
|
198 ifdef LIBRARY |
|
199 # Libraries need to locate other libraries at runtime, and you can tell |
|
200 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
|
201 # buried inside the .so. The $ORIGIN says to look relative to where |
|
202 # the library itself is and it can be followed with relative paths from |
|
203 # that. By default we always look in $ORIGIN, optionally we add relative |
|
204 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
|
205 # On Linux we add a flag -z origin, not sure if this is necessary, but |
|
206 # doesn't seem to hurt. |
|
207 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
|
208 # Try: 'readelf -d lib*.so' to see these settings in a library. |
|
209 # |
|
210 LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN |
|
211 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%) |
|
212 endif |
|
213 |
|
214 EXTRA_LIBS += -lc |
|
215 |
|
216 LDFLAGS_DEFS_OPTION = -Xlinker -z -Xlinker defs |
|
217 LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
|
218 |
|
219 # |
|
220 # -L paths for finding and -ljava |
|
221 # |
|
222 LDFLAGS_OPT = -Xlinker -O1 |
|
223 LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
|
224 LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) |
|
225 |
|
226 # |
|
227 # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always |
|
228 # statically link libgcc but will print a warning with the flag. We don't |
|
229 # want the warning, so check gcc version first. |
|
230 # |
|
231 CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1) |
|
232 ifeq ("$(CC_VER_MAJOR)", "3") |
|
233 OTHER_LDFLAGS += -static-libgcc |
|
234 endif |
|
235 |
|
236 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
|
237 # (See Rules.gmk) The gcc 5 compiler might have an option for this? |
|
238 AUTOMATIC_PCH_OPTION = |
|
239 |
|
240 # |
|
241 # Post Processing of libraries/executables |
|
242 # |
|
243 ifeq ($(VARIANT), OPT) |
|
244 ifneq ($(NO_STRIP), true) |
|
245 # Debug 'strip -g' leaves local function Elf symbols (better stack traces) |
|
246 POST_STRIP_PROCESS = $(STRIP) -g |
|
247 endif |
|
248 endif |
|
249 |
|
250 # |
|
251 # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o |
|
252 # |
|
253 LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker |
|
254 |
|
255 # |
|
256 # Support for Quantify. |
|
257 # |
|
258 ifdef QUANTIFY |
|
259 QUANTIFY_CMD = quantify |
|
260 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
|
261 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
|
262 endif |
|
263 |
|
264 # |
|
265 # Path and option to link against the VM, if you have to. Note that |
|
266 # there are libraries that link against only -ljava, but they do get |
|
267 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
|
268 # the library itself should not. |
|
269 # |
|
270 VM_NAME = server |
|
271 JVMLIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvm |
|
272 JAVALIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB) |
|
273 |
|
274 # |
|
275 # We want to privatize JVM symbols on Solaris. This is so the user can |
|
276 # write a function called FindClass and this should not override the |
|
277 # FindClass that is inside the JVM. At this point in time we are not |
|
278 # concerned with other JNI libraries because we hope that there will |
|
279 # not be as many clashes there. |
|
280 # |
|
281 PRIVATIZE_JVM_SYMBOLS = false |
|
282 |
|
283 USE_PTHREADS = true |
|
284 override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME |
|
285 override AWT_RUNPATH = |
|
286 override HAVE_ALTZONE = false |
|
287 override HAVE_FILIOH = false |
|
288 override HAVE_GETHRTIME = false |
|
289 override HAVE_GETHRVTIME = false |
|
290 override HAVE_SIGIGNORE = true |
|
291 override LEX_LIBRARY = -lfl |
|
292 ifeq ($(STATIC_CXX),true) |
|
293 override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic |
|
294 else |
|
295 override LIBCXX = -lstdc++ |
|
296 endif |
|
297 override LIBPOSIX4 = |
|
298 override LIBSOCKET = |
|
299 override LIBTHREAD = |
|
300 override MOOT_PRIORITIES = true |
|
301 override NO_INTERRUPTIBLE_IO = true |
|
302 override OPENWIN_HOME = /usr/X11R6 |
|
303 ifeq ($(ARCH), amd64) |
|
304 override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 |
|
305 else |
|
306 override OPENWIN_LIB = $(OPENWIN_HOME)/lib |
|
307 endif |
|
308 override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER |
|
309 override SUN_CMM_SUBDIR = |
|
310 override THREADS_FLAG = native |
|
311 override USE_GNU_M4 = true |
|
312 override USING_GNU_TAR = true |
|
313 override WRITE_LIBVERSION = false |
|
314 |
|
315 # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the |
|
316 # resulting resolved absolute name of the executable in the environment |
|
317 # variable EXECNAME. That executable name is then used that to locate the |
|
318 # installation area. |
|
319 override USE_EXECNAME = true |
|
320 |
|
321 # If your platform has DPS, it will have Type1 fonts too, in which case |
|
322 # it is best to enable DPS support until such time as 2D's rasteriser |
|
323 # can fully handle Type1 fonts in all cases. Default is "yes". |
|
324 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
|
325 # DPS (Displayable PostScript) is available on Solaris machines |
|
326 HAVE_DPS = no |
|
327 |
|
328 # |
|
329 # Japanese manpages |
|
330 # |
|
331 JA_SOURCE_ENCODING = eucJP |
|
332 JA_TARGET_ENCODINGS = eucJP |
|
333 |
|