Wed, 14 Oct 2020 17:44:48 +0800
Merge
1 #
2 # Copyright (c) 1999, 2012, Oracle and/or its affiliates. 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.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
23 #
25 #
26 # This file has been modified by Loongson Technology in 2015. These
27 # modifications are Copyright (c) 2015 Loongson Technology, and are made
28 # available on the same license terms set forth above.
29 #
31 #------------------------------------------------------------------------
32 # CC, CXX & AS
34 # If a SPEC is not set already, then use these defaults.
35 ifeq ($(SPEC),)
36 CXX = CC
37 CC = cc
38 AS = $(CC) -c
40 HOSTCXX = $(CXX)
41 HOSTCC = $(CC)
42 endif
44 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
45 ARCHFLAG/i486 = -m32
46 ARCHFLAG/amd64 = -m64
47 ARCHFLAG/mips64 = -m64
49 CFLAGS += $(ARCHFLAG)
50 AOUT_FLAGS += $(ARCHFLAG)
51 LFLAGS += $(ARCHFLAG)
52 ASFLAGS += $(ARCHFLAG)
54 #------------------------------------------------------------------------
55 # Compiler flags
57 # position-independent code
58 PICFLAG = -KPIC
60 CFLAGS += $(PICFLAG)
61 # no more exceptions
62 CFLAGS += -features=no%except
63 # Reduce code bloat by reverting back to 5.0 behavior for static initializers
64 CFLAGS += -features=no%split_init
65 # allow zero sized arrays
66 CFLAGS += -features=zla
68 # Use C++ Interpreter
69 ifdef CC_INTERP
70 CFLAGS += -DCC_INTERP
71 endif
73 # We don't need libCstd.so and librwtools7.so, only libCrun.so
74 CFLAGS += -library=Crun
75 LIBS += -lCrun
77 CFLAGS += -mt
78 LFLAGS += -mt
80 # Compiler warnings are treated as errors
81 #WARNINGS_ARE_ERRORS = -errwarn=%all
82 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS)
83 # Special cases
84 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
86 # The flags to use for an Optimized build
87 OPT_CFLAGS+=-xO4
88 OPT_CFLAGS/NOOPT=-xO0
90 # Flags for creating the dependency files.
91 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
92 DEPFLAGS = -xMMD -xMF $(DEP_DIR)/$(@:%=%.d)
93 endif
95 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
96 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
98 #------------------------------------------------------------------------
99 # Linker flags
101 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
102 MAPFLAG = -Wl,--version-script=FILENAME
104 # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
105 SONAMEFLAG = -h SONAME
107 # Build shared library
108 SHARED_FLAG = -G
110 #------------------------------------------------------------------------
111 # Debug flags
112 DEBUG_CFLAGS += -g
113 FASTDEBUG_CFLAGS = -g0