author | alanb |
Tue, 03 May 2016 09:11:31 +0100 | |
changeset 37827 | 09fa0c82a5f7 |
parent 34289 | 2d1821a50263 |
permissions | -rw-r--r-- |
10565 | 1 |
# |
33583
af842015bfaa
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
29463
diff
changeset
|
2 |
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. |
10565 | 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. |
|
25639
61be16de0fd5
8046765: makefiles should use parameterized $(CP) and $(MV) rather than explicit commands
mduigou
parents:
13963
diff
changeset
|
22 |
# |
10565 | 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 |
|
25639
61be16de0fd5
8046765: makefiles should use parameterized $(CP) and $(MV) rather than explicit commands
mduigou
parents:
13963
diff
changeset
|
31 |
DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ |
10565 | 32 |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
33 |
# $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
34 |
CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS) |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
35 |
CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS) |
10565 | 36 |
|
37 |
AS.S = $(AS) $(ASFLAGS) |
|
38 |
||
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
39 |
COMPILE.CC = $(CC_COMPILE) -c |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
40 |
GENASM.CC = $(CC_COMPILE) -S |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
41 |
LINK.CC = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) |
33583
af842015bfaa
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
29463
diff
changeset
|
42 |
ifeq ($(STATIC_BUILD),true) |
af842015bfaa
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
29463
diff
changeset
|
43 |
LINK_LIB.CC = $(AR) $(ARFLAGS) |
af842015bfaa
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
29463
diff
changeset
|
44 |
else |
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
45 |
LINK_LIB.CC = $(CC) $(LFLAGS) $(SHARED_FLAG) |
33583
af842015bfaa
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
29463
diff
changeset
|
46 |
endif |
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
47 |
PREPROCESS.CC = $(CC_COMPILE) -E |
10565 | 48 |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
49 |
COMPILE.CXX = $(CXX_COMPILE) -c |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
50 |
GENASM.CXX = $(CXX_COMPILE) -S |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
51 |
LINK.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
52 |
LINK_NOPROF.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
53 |
LINK_LIB.CXX = $(CXX) $(LFLAGS) $(SHARED_FLAG) |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
54 |
PREPROCESS.CXX = $(CXX_COMPILE) -E |
10565 | 55 |
|
56 |
# cross compiling the jvm with c2 requires host compilers to build |
|
57 |
# adlc tool |
|
58 |
||
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
59 |
HOST.CXX_COMPILE = $(HOSTCXX) $(CXXFLAGS) $(CFLAGS) |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
60 |
HOST.COMPILE.CXX = $(HOST.CXX_COMPILE) -c |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
61 |
HOST.LINK_NOPROF.CXX = $(HOSTCXX) $(LFLAGS) $(AOUT_FLAGS) |
10565 | 62 |
|
63 |
||
64 |
# Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". |
|
65 |
REMOVE_TARGET = rm -f $@ |
|
66 |
||
67 |
# Note use of ALT_BOOTDIR to explicitly specify location of java and |
|
68 |
# javac; this is the same environment variable used in the J2SE build |
|
69 |
# process for overriding the default spec, which is BOOTDIR. |
|
70 |
# Note also that we fall back to using JAVA_HOME if neither of these is |
|
71 |
# specified. |
|
72 |
||
73 |
ifdef ALT_BOOTDIR |
|
74 |
||
75 |
RUN.JAVA = $(ALT_BOOTDIR)/bin/java |
|
76 |
RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap |
|
77 |
RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah |
|
78 |
RUN.JAR = $(ALT_BOOTDIR)/bin/jar |
|
79 |
COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac |
|
80 |
COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic |
|
81 |
BOOT_JAVA_HOME = $(ALT_BOOTDIR) |
|
82 |
||
83 |
else |
|
84 |
||
85 |
ifdef BOOTDIR |
|
86 |
||
87 |
RUN.JAVA = $(BOOTDIR)/bin/java |
|
88 |
RUN.JAVAP = $(BOOTDIR)/bin/javap |
|
89 |
RUN.JAVAH = $(BOOTDIR)/bin/javah |
|
90 |
RUN.JAR = $(BOOTDIR)/bin/jar |
|
91 |
COMPILE.JAVAC = $(BOOTDIR)/bin/javac |
|
92 |
COMPILE.RMIC = $(BOOTDIR)/bin/rmic |
|
93 |
BOOT_JAVA_HOME = $(BOOTDIR) |
|
94 |
||
95 |
else |
|
96 |
||
97 |
ifdef JAVA_HOME |
|
98 |
||
99 |
RUN.JAVA = $(JAVA_HOME)/bin/java |
|
100 |
RUN.JAVAP = $(JAVA_HOME)/bin/javap |
|
101 |
RUN.JAVAH = $(JAVA_HOME)/bin/javah |
|
102 |
RUN.JAR = $(JAVA_HOME)/bin/jar |
|
103 |
COMPILE.JAVAC = $(JAVA_HOME)/bin/javac |
|
104 |
COMPILE.RMIC = $(JAVA_HOME)/bin/rmic |
|
105 |
BOOT_JAVA_HOME = $(JAVA_HOME) |
|
106 |
||
107 |
else |
|
108 |
||
109 |
# take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined |
|
110 |
||
111 |
RUN.JAVA = java |
|
112 |
RUN.JAVAP = javap |
|
113 |
RUN.JAVAH = javah |
|
114 |
RUN.JAR = jar |
|
115 |
COMPILE.JAVAC = javac |
|
116 |
COMPILE.RMIC = rmic |
|
117 |
||
118 |
endif |
|
119 |
endif |
|
120 |
endif |
|
121 |
||
122 |
COMPILE.JAVAC += $(BOOTSTRAP_JAVAC_FLAGS) |
|
123 |
||
124 |
SUM = /usr/bin/sum |
|
125 |
||
126 |
# 'gmake MAKE_VERBOSE=y' gives all the gory details. |
|
127 |
QUIETLY$(MAKE_VERBOSE) = @ |
|
128 |
RUN.JAR$(MAKE_VERBOSE) += >/dev/null |
|
129 |
||
130 |
# Settings for javac |
|
131 |
JAVAC_FLAGS = -g -encoding ascii |
|
29463
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
132 |
|
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
133 |
# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system) |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
134 |
# Fall back to the values here if it's not set (hotspot only builds) |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
135 |
ifeq ($(BOOT_JDK_SOURCETARGET),) |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
136 |
BOOTSTRAP_SOURCETARGET := -source 8 -target 8 |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
137 |
else |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
138 |
BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET) |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
139 |
endif |
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
140 |
|
4b16497408b9
8074726: Update source and target version used when compiling hotspot class files
mikael
parents:
26691
diff
changeset
|
141 |
BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET) |
10565 | 142 |
|
143 |
# With parallel makes, print a message at the end of compilation. |
|
144 |
ifeq ($(findstring j,$(MFLAGS)),j) |
|
145 |
COMPILE_DONE = && { echo Done with $<; } |
|
146 |
endif |
|
147 |
||
148 |
# Include $(NONPIC_OBJ_FILES) definition |
|
149 |
ifndef LP64 |
|
150 |
include $(GAMMADIR)/make/pic.make |
|
151 |
endif |
|
152 |
||
153 |
include $(GAMMADIR)/make/altsrc.make |
|
154 |
||
155 |
# The non-PIC object files are only generated for 32 bit platforms. |
|
156 |
ifdef LP64 |
|
157 |
%.o: %.cpp |
|
26691
40ea2c41f53b
8056999: Make hotspot builds less verbose on default log level
ihse
parents:
25639
diff
changeset
|
158 |
@echo $(LOG_INFO) Compiling $< |
10565 | 159 |
$(QUIETLY) $(REMOVE_TARGET) |
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
160 |
$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) |
10565 | 161 |
else |
162 |
%.o: %.cpp |
|
26691
40ea2c41f53b
8056999: Make hotspot builds less verbose on default log level
ihse
parents:
25639
diff
changeset
|
163 |
@echo $(LOG_INFO) Compiling $< |
10565 | 164 |
$(QUIETLY) $(REMOVE_TARGET) |
165 |
$(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ |
|
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
166 |
$(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ |
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
167 |
$(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)) |
10565 | 168 |
endif |
169 |
||
170 |
%.o: %.s |
|
26691
40ea2c41f53b
8056999: Make hotspot builds less verbose on default log level
ihse
parents:
25639
diff
changeset
|
171 |
@echo $(LOG_INFO) Assembling $< |
10565 | 172 |
$(QUIETLY) $(REMOVE_TARGET) |
173 |
$(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) |
|
174 |
||
175 |
%.s: %.cpp |
|
26691
40ea2c41f53b
8056999: Make hotspot builds less verbose on default log level
ihse
parents:
25639
diff
changeset
|
176 |
@echo $(LOG_INFO) Generating assembly for $< |
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
177 |
$(QUIETLY) $(GENASM.CXX) -o $@ $< |
10565 | 178 |
$(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) |
179 |
||
180 |
# Intermediate files (for debugging macros) |
|
181 |
%.i: %.cpp |
|
26691
40ea2c41f53b
8056999: Make hotspot builds less verbose on default log level
ihse
parents:
25639
diff
changeset
|
182 |
@echo $(LOG_INFO) Preprocessing $< to $@ |
11721
dcd1f62c9caf
7141242: build-infra merge: Rename CPP->CXX and LINK->LD
erikj
parents:
10565
diff
changeset
|
183 |
$(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) |
10565 | 184 |
|
185 |
# Override gnumake built-in rules which do sccs get operations badly. |
|
186 |
# (They put the checked out code in the current directory, not in the |
|
187 |
# directory of the original file.) Since this is a symptom of a teamware |
|
188 |
# failure, and since not all problems can be detected by gnumake due |
|
189 |
# to incomplete dependency checking... just complain and stop. |
|
190 |
%:: s.% |
|
191 |
@echo "=========================================================" |
|
192 |
@echo File $@ |
|
193 |
@echo is out of date with respect to its SCCS file. |
|
194 |
@echo This file may be from an unresolved Teamware conflict. |
|
195 |
@echo This is also a symptom of a Teamware bringover/putback failure |
|
196 |
@echo in which SCCS files are updated but not checked out. |
|
197 |
@echo Check for other out of date files in your workspace. |
|
198 |
@echo "=========================================================" |
|
199 |
@exit 666 |
|
200 |
||
201 |
%:: SCCS/s.% |
|
202 |
@echo "=========================================================" |
|
203 |
@echo File $@ |
|
204 |
@echo is out of date with respect to its SCCS file. |
|
205 |
@echo This file may be from an unresolved Teamware conflict. |
|
206 |
@echo This is also a symptom of a Teamware bringover/putback failure |
|
207 |
@echo in which SCCS files are updated but not checked out. |
|
208 |
@echo Check for other out of date files in your workspace. |
|
209 |
@echo "=========================================================" |
|
210 |
@exit 666 |
|
211 |
||
212 |
.PHONY: default |