0
|
1 #
|
|
2 # Copyright 1997-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 # CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 # have any questions.
|
|
22 #
|
|
23 #
|
|
24
|
|
25 # This makefile (adlc.make) is included from the adlc.make in the
|
|
26 # build directories.
|
|
27 # It knows how to compile, link, and run the adlc.
|
|
28
|
|
29 include $(GAMMADIR)/build/$(Platform_os_family)/makefiles/rules.make
|
|
30
|
|
31 # #########################################################################
|
|
32
|
|
33 # OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:
|
|
34 GENERATED = ../generated
|
|
35 OUTDIR = $(GENERATED)/adfiles
|
|
36
|
|
37 ARCH = $(Platform_arch)
|
|
38 OS = $(Platform_os_family)
|
|
39
|
|
40 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
|
|
41
|
|
42 SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
|
|
43 $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad
|
|
44
|
|
45 Src_Dirs += $(GAMMADIR)/src/share/vm/adlc
|
|
46
|
|
47 EXEC = $(OUTDIR)/adlc
|
|
48
|
|
49 # set VPATH so make knows where to look for source files
|
|
50 Src_Dirs_V = ${Src_Dirs} $(GENERATED)/incls
|
|
51 VPATH += $(Src_Dirs_V:%=%:)
|
|
52
|
|
53 # set INCLUDES for C preprocessor
|
|
54 Src_Dirs_I = ${Src_Dirs} $(GENERATED)
|
|
55 INCLUDES += $(Src_Dirs_I:%=-I%)
|
|
56
|
|
57 # Force assertions on.
|
|
58 SYSDEFS += -DASSERT
|
|
59 CPPFLAGS = $(SYSDEFS) $(INCLUDES)
|
|
60
|
|
61 ifndef USE_GCC
|
|
62 # We need libCstd.so for adlc
|
|
63 CFLAGS += -library=Cstd -g
|
|
64 LFLAGS += -library=Cstd -g
|
|
65 endif
|
|
66
|
|
67 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
|
|
68 CFLAGS += $(CFLAGS_WARN)
|
|
69
|
|
70 ifeq ("${Platform_compiler}", "sparcWorks")
|
|
71 # Enable the following CFLAGS addition if you need to compare the
|
|
72 # built ELF objects.
|
|
73 #
|
|
74 # The -g option makes static data global and the "-Qoption ccfe
|
|
75 # -xglobalstatic" option tells the compiler to not globalize static
|
|
76 # data using a unique globalization prefix. Instead force the use
|
|
77 # of a static globalization prefix based on the source filepath so
|
|
78 # the objects from two identical compilations are the same.
|
|
79 #CFLAGS += -Qoption ccfe -xglobalstatic
|
|
80 endif # Platform_compiler == sparcWorks
|
|
81
|
|
82 OBJECTNAMES = \
|
|
83 adlparse.o \
|
|
84 archDesc.o \
|
|
85 arena.o \
|
|
86 dfa.o \
|
|
87 dict2.o \
|
|
88 filebuff.o \
|
|
89 forms.o \
|
|
90 formsopt.o \
|
|
91 formssel.o \
|
|
92 main.o \
|
|
93 adlc-opcodes.o \
|
|
94 output_c.o \
|
|
95 output_h.o \
|
|
96
|
|
97 OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
|
|
98
|
|
99 GENERATEDNAMES = \
|
|
100 ad_$(Platform_arch_model).cpp \
|
|
101 ad_$(Platform_arch_model).hpp \
|
|
102 ad_$(Platform_arch_model)_clone.cpp \
|
|
103 ad_$(Platform_arch_model)_expand.cpp \
|
|
104 ad_$(Platform_arch_model)_format.cpp \
|
|
105 ad_$(Platform_arch_model)_gen.cpp \
|
|
106 ad_$(Platform_arch_model)_misc.cpp \
|
|
107 ad_$(Platform_arch_model)_peephole.cpp \
|
|
108 ad_$(Platform_arch_model)_pipeline.cpp \
|
|
109 adGlobals_$(Platform_arch_model).hpp \
|
|
110 dfa_$(Platform_arch_model).cpp \
|
|
111
|
|
112 GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
|
|
113
|
|
114 # #########################################################################
|
|
115
|
|
116 all: $(EXEC)
|
|
117
|
|
118 $(EXEC) : $(OBJECTS)
|
|
119 @echo Making adlc
|
|
120 $(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
|
|
121
|
|
122 # Random dependencies:
|
|
123 $(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp
|
|
124
|
|
125 # The source files refer to ostream.h, which sparcworks calls iostream.h
|
|
126 $(OBJECTS): ostream.h
|
|
127
|
|
128 ostream.h :
|
|
129 @echo >$@ '#include <iostream.h>'
|
|
130
|
|
131 dump:
|
|
132 : OUTDIR=$(OUTDIR)
|
|
133 : OBJECTS=$(OBJECTS)
|
|
134 : products = $(GENERATEDFILES)
|
|
135
|
|
136 all: $(GENERATEDFILES)
|
|
137
|
|
138 $(GENERATEDFILES): refresh_adfiles
|
|
139
|
|
140 # Get a unique temporary directory name, so multiple makes can run in parallel.
|
|
141 # Note that product files are updated via "mv", which is atomic.
|
|
142 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
|
|
143
|
|
144 ADLCFLAGS = -q -T
|
|
145
|
|
146 ifdef LP64
|
|
147 ADLCFLAGS += -D_LP64
|
|
148 else
|
|
149 ADLCFLAGS += -U_LP64
|
|
150 endif
|
|
151
|
|
152 #
|
|
153 # adlc_updater is a simple sh script, under sccs control. It is
|
|
154 # used to selectively update generated adlc files. This should
|
|
155 # provide a nice compilation speed improvement.
|
|
156 #
|
|
157 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/build/$(OS)
|
|
158 ADLC_UPDATER = adlc_updater
|
|
159
|
|
160 # This action refreshes all generated adlc files simultaneously.
|
|
161 # The way it works is this:
|
|
162 # 1) create a scratch directory to work in.
|
|
163 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
|
|
164 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
|
|
165 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
|
|
166 # 5) If we actually updated any files, echo a notice.
|
|
167 #
|
|
168 refresh_adfiles: $(EXEC) $(SOURCE.AD)
|
|
169 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
|
|
170 $(QUIETLY) [ -f $(ADLC_UPDATER) ] || ( cp $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) . ; chmod +x $(ADLC_UPDATER) )
|
|
171 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
|
|
172 -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \
|
|
173 || { rm -rf $(TEMPDIR); exit 1; }
|
|
174 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
|
|
175 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
|
|
176 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
|
|
177 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
|
|
178 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
|
|
179 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
|
|
180 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
|
|
181 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
|
|
182 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
|
|
183 $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
|
|
184 $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
|
|
185 $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
|
|
186 || echo "Rescanned $(SOURCE.AD) but encountered no changes."
|
|
187 $(QUIETLY) rm -rf $(TEMPDIR)
|
|
188
|
|
189
|
|
190 # #########################################################################
|
|
191
|
|
192 $(SOURCE.AD): $(SOURCES.AD)
|
|
193 $(QUIETLY) cat $(SOURCES.AD) > $(SOURCE.AD)
|
|
194
|
|
195 $(OUTDIR)/%.o: %.cpp
|
|
196 @echo Compiling $<
|
|
197 $(QUIETLY) $(REMOVE_TARGET)
|
|
198 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
|
|
199
|
|
200 # Some object files are given a prefix, to disambiguate
|
|
201 # them from objects of the same name built for the VM.
|
|
202 $(OUTDIR)/adlc-%.o: %.cpp
|
|
203 @echo Compiling $<
|
|
204 $(QUIETLY) $(REMOVE_TARGET)
|
|
205 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
|
|
206
|
|
207 # #########################################################################
|
|
208
|
|
209 clean :
|
|
210 rm $(OBJECTS)
|
|
211
|
|
212 cleanall :
|
|
213 rm $(OBJECTS) $(EXEC)
|
|
214
|
|
215 # #########################################################################
|
|
216
|
|
217 .PHONY: all dump refresh_adfiles clean cleanall
|