comparison make/bsd/makefiles/rules.make @ 3960:f08d439fab8c

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