source: trunk/openjdk/hotspot/make/linux/makefiles/rules.make

Last change on this file was 309, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b24 from branches/vendor/oracle.

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