|
1 # |
|
2 # Copyright (c) 2003, 2013, 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 # |
|
24 |
|
25 # Common rules/macros for the vm, adlc. |
|
26 |
|
27 # Tell make that .cpp is important |
|
28 .SUFFIXES: .cpp $(SUFFIXES) |
|
29 |
|
30 DEMANGLER = c++filt |
|
31 DEMANGLE = $(DEMANGLER) < $@ > .$@ && mv -f .$@ $@ |
|
32 |
|
33 # $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). |
|
34 CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS) |
|
35 CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS) |
|
36 |
|
37 AS.S = $(AS) $(ASFLAGS) |
|
38 |
|
39 COMPILE.CC = $(CC_COMPILE) -c |
|
40 GENASM.CC = $(CC_COMPILE) -S |
|
41 LINK.CC = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) |
|
42 LINK_LIB.CC = $(CC) $(LFLAGS) $(SHARED_FLAG) |
|
43 PREPROCESS.CC = $(CC_COMPILE) -E |
|
44 |
|
45 COMPILE.CXX = $(CXX_COMPILE) -c |
|
46 GENASM.CXX = $(CXX_COMPILE) -S |
|
47 LINK.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) |
|
48 LINK_NOPROF.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) |
|
49 LINK_LIB.CXX = $(CXX) $(LFLAGS) $(SHARED_FLAG) |
|
50 PREPROCESS.CXX = $(CXX_COMPILE) -E |
|
51 |
|
52 # cross compiling the jvm with c2 requires host compilers to build |
|
53 # adlc tool |
|
54 |
|
55 HOST.CXX_COMPILE = $(HOSTCXX) $(CXXFLAGS) $(CFLAGS) |
|
56 HOST.COMPILE.CXX = $(HOST.CXX_COMPILE) -c |
|
57 HOST.LINK_NOPROF.CXX = $(HOSTCXX) $(LFLAGS) $(AOUT_FLAGS) |
|
58 |
|
59 |
|
60 # Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". |
|
61 REMOVE_TARGET = rm -f $@ |
|
62 |
|
63 # Note use of ALT_BOOTDIR to explicitly specify location of java and |
|
64 # javac; this is the same environment variable used in the J2SE build |
|
65 # process for overriding the default spec, which is BOOTDIR. |
|
66 # Note also that we fall back to using JAVA_HOME if neither of these is |
|
67 # specified. |
|
68 |
|
69 ifdef ALT_BOOTDIR |
|
70 |
|
71 RUN.JAVA = $(ALT_BOOTDIR)/bin/java |
|
72 RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap |
|
73 RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah |
|
74 RUN.JAR = $(ALT_BOOTDIR)/bin/jar |
|
75 COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac |
|
76 COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic |
|
77 BOOT_JAVA_HOME = $(ALT_BOOTDIR) |
|
78 |
|
79 else |
|
80 |
|
81 ifdef BOOTDIR |
|
82 |
|
83 RUN.JAVA = $(BOOTDIR)/bin/java |
|
84 RUN.JAVAP = $(BOOTDIR)/bin/javap |
|
85 RUN.JAVAH = $(BOOTDIR)/bin/javah |
|
86 RUN.JAR = $(BOOTDIR)/bin/jar |
|
87 COMPILE.JAVAC = $(BOOTDIR)/bin/javac |
|
88 COMPILE.RMIC = $(BOOTDIR)/bin/rmic |
|
89 BOOT_JAVA_HOME = $(BOOTDIR) |
|
90 |
|
91 else |
|
92 |
|
93 ifdef JAVA_HOME |
|
94 |
|
95 RUN.JAVA = $(JAVA_HOME)/bin/java |
|
96 RUN.JAVAP = $(JAVA_HOME)/bin/javap |
|
97 RUN.JAVAH = $(JAVA_HOME)/bin/javah |
|
98 RUN.JAR = $(JAVA_HOME)/bin/jar |
|
99 COMPILE.JAVAC = $(JAVA_HOME)/bin/javac |
|
100 COMPILE.RMIC = $(JAVA_HOME)/bin/rmic |
|
101 BOOT_JAVA_HOME = $(JAVA_HOME) |
|
102 |
|
103 else |
|
104 |
|
105 # take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined |
|
106 # note that this is to support hotspot build without SA. To build |
|
107 # SA along with hotspot, you need to define ALT_BOOTDIR, BOOTDIR or JAVA_HOME |
|
108 |
|
109 RUN.JAVA = java |
|
110 RUN.JAVAP = javap |
|
111 RUN.JAVAH = javah |
|
112 RUN.JAR = jar |
|
113 COMPILE.JAVAC = javac |
|
114 COMPILE.RMIC = rmic |
|
115 |
|
116 endif |
|
117 endif |
|
118 endif |
|
119 |
|
120 COMPILE.JAVAC += $(BOOTSTRAP_JAVAC_FLAGS) |
|
121 |
|
122 SUM = /usr/bin/sum |
|
123 |
|
124 # 'gmake MAKE_VERBOSE=y' gives all the gory details. |
|
125 QUIETLY$(MAKE_VERBOSE) = @ |
|
126 RUN.JAR$(MAKE_VERBOSE) += >/dev/null |
|
127 |
|
128 # Settings for javac |
|
129 BOOT_SOURCE_LANGUAGE_VERSION = 6 |
|
130 BOOT_TARGET_CLASS_VERSION = 6 |
|
131 JAVAC_FLAGS = -g -encoding ascii |
|
132 BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) |
|
133 |
|
134 # With parallel makes, print a message at the end of compilation. |
|
135 ifeq ($(findstring j,$(MFLAGS)),j) |
|
136 COMPILE_DONE = && { echo Done with $<; } |
|
137 endif |
|
138 |
|
139 # Include $(NONPIC_OBJ_FILES) definition |
|
140 ifndef LP64 |
|
141 include $(GAMMADIR)/make/pic.make |
|
142 endif |
|
143 |
|
144 include $(GAMMADIR)/make/altsrc.make |
|
145 |
|
146 # The non-PIC object files are only generated for 32 bit platforms. |
|
147 ifdef LP64 |
|
148 %.o: %.cpp |
|
149 @echo Compiling $< |
|
150 $(QUIETLY) $(REMOVE_TARGET) |
|
151 $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) |
|
152 else |
|
153 %.o: %.cpp |
|
154 @echo Compiling $< |
|
155 $(QUIETLY) $(REMOVE_TARGET) |
|
156 $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ |
|
157 $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ |
|
158 $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)) |
|
159 endif |
|
160 |
|
161 %.o: %.s |
|
162 @echo Assembling $< |
|
163 $(QUIETLY) $(REMOVE_TARGET) |
|
164 $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) |
|
165 |
|
166 %.s: %.cpp |
|
167 @echo Generating assembly for $< |
|
168 $(QUIETLY) $(GENASM.CXX) -o $@ $< |
|
169 $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) |
|
170 |
|
171 # Intermediate files (for debugging macros) |
|
172 %.i: %.cpp |
|
173 @echo Preprocessing $< to $@ |
|
174 $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) |
|
175 |
|
176 # Override gnumake built-in rules which do sccs get operations badly. |
|
177 # (They put the checked out code in the current directory, not in the |
|
178 # directory of the original file.) Since this is a symptom of a teamware |
|
179 # failure, and since not all problems can be detected by gnumake due |
|
180 # to incomplete dependency checking... just complain and stop. |
|
181 %:: s.% |
|
182 @echo "=========================================================" |
|
183 @echo File $@ |
|
184 @echo is out of date with respect to its SCCS file. |
|
185 @echo This file may be from an unresolved Teamware conflict. |
|
186 @echo This is also a symptom of a Teamware bringover/putback failure |
|
187 @echo in which SCCS files are updated but not checked out. |
|
188 @echo Check for other out of date files in your workspace. |
|
189 @echo "=========================================================" |
|
190 @exit 666 |
|
191 |
|
192 %:: SCCS/s.% |
|
193 @echo "=========================================================" |
|
194 @echo File $@ |
|
195 @echo is out of date with respect to its SCCS file. |
|
196 @echo This file may be from an unresolved Teamware conflict. |
|
197 @echo This is also a symptom of a Teamware bringover/putback failure |
|
198 @echo in which SCCS files are updated but not checked out. |
|
199 @echo Check for other out of date files in your workspace. |
|
200 @echo "=========================================================" |
|
201 @exit 666 |
|
202 |
|
203 .PHONY: default |