0
|
1 #
|
|
2 # Copyright 1999-2006 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 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
|
|
62 # Suppress warnings (for now)
|
|
63 CFLAGS_WARN = -w
|
|
64 CFLAGS += $(CFLAGS_WARN)
|
|
65
|
|
66 OBJECTNAMES = \
|
|
67 adlparse.o \
|
|
68 archDesc.o \
|
|
69 arena.o \
|
|
70 dfa.o \
|
|
71 dict2.o \
|
|
72 filebuff.o \
|
|
73 forms.o \
|
|
74 formsopt.o \
|
|
75 formssel.o \
|
|
76 main.o \
|
|
77 adlc-opcodes.o \
|
|
78 output_c.o \
|
|
79 output_h.o \
|
|
80
|
|
81 OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
|
|
82
|
|
83 GENERATEDNAMES = \
|
|
84 ad_$(Platform_arch_model).cpp \
|
|
85 ad_$(Platform_arch_model).hpp \
|
|
86 ad_$(Platform_arch_model)_clone.cpp \
|
|
87 ad_$(Platform_arch_model)_expand.cpp \
|
|
88 ad_$(Platform_arch_model)_format.cpp \
|
|
89 ad_$(Platform_arch_model)_gen.cpp \
|
|
90 ad_$(Platform_arch_model)_misc.cpp \
|
|
91 ad_$(Platform_arch_model)_peephole.cpp \
|
|
92 ad_$(Platform_arch_model)_pipeline.cpp \
|
|
93 adGlobals_$(Platform_arch_model).hpp \
|
|
94 dfa_$(Platform_arch_model).cpp \
|
|
95
|
|
96 GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
|
|
97
|
|
98 # #########################################################################
|
|
99
|
|
100 all: $(EXEC)
|
|
101
|
|
102 $(EXEC) : $(OBJECTS)
|
|
103 @echo Making adlc
|
|
104 $(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
|
|
105
|
|
106 # Random dependencies:
|
|
107 $(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
|
|
108
|
|
109 # The source files refer to ostream.h, which sparcworks calls iostream.h
|
|
110 $(OBJECTS): ostream.h
|
|
111
|
|
112 ostream.h :
|
|
113 @echo >$@ '#include <iostream.h>'
|
|
114
|
|
115 dump:
|
|
116 : OUTDIR=$(OUTDIR)
|
|
117 : OBJECTS=$(OBJECTS)
|
|
118 : products = $(GENERATEDFILES)
|
|
119
|
|
120 all: $(GENERATEDFILES)
|
|
121
|
|
122 $(GENERATEDFILES): refresh_adfiles
|
|
123
|
|
124 # Get a unique temporary directory name, so multiple makes can run in parallel.
|
|
125 # Note that product files are updated via "mv", which is atomic.
|
|
126 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
|
|
127
|
|
128 ADLCFLAGS = -q -T
|
|
129
|
|
130 ifdef LP64
|
|
131 ADLCFLAGS += -D_LP64
|
|
132 else
|
|
133 ADLCFLAGS += -U_LP64
|
|
134 endif
|
|
135
|
|
136 #
|
|
137 # adlc_updater is a simple sh script, under sccs control. It is
|
|
138 # used to selectively update generated adlc files. This should
|
|
139 # provide a nice compilation speed improvement.
|
|
140 #
|
|
141 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/build/$(OS)
|
|
142 ADLC_UPDATER = adlc_updater
|
|
143
|
|
144 # This action refreshes all generated adlc files simultaneously.
|
|
145 # The way it works is this:
|
|
146 # 1) create a scratch directory to work in.
|
|
147 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
|
|
148 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
|
|
149 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
|
|
150 # 5) If we actually updated any files, echo a notice.
|
|
151 #
|
|
152 refresh_adfiles: $(EXEC) $(SOURCE.AD)
|
|
153 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
|
|
154 $(QUIETLY) [ -f $(ADLC_UPDATER) ] || ( cp $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) . ; chmod +x $(ADLC_UPDATER) )
|
|
155 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
|
|
156 -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 \
|
|
157 || { rm -rf $(TEMPDIR); exit 1; }
|
|
158 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
|
|
159 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
|
|
160 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
|
|
161 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
|
|
162 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
|
|
163 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
|
|
164 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
|
|
165 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
|
|
166 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
|
|
167 $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
|
|
168 $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
|
|
169 $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
|
|
170 || echo "Rescanned $(SOURCE.AD) but encountered no changes."
|
|
171 $(QUIETLY) rm -rf $(TEMPDIR)
|
|
172
|
|
173
|
|
174 # #########################################################################
|
|
175
|
|
176 $(SOURCE.AD): $(SOURCES.AD)
|
|
177 $(QUIETLY) cat $(SOURCES.AD) > $(SOURCE.AD)
|
|
178
|
|
179 $(OUTDIR)/%.o: %.cpp
|
|
180 @echo Compiling $<
|
|
181 $(QUIETLY) $(REMOVE_TARGET)
|
|
182 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
|
|
183
|
|
184 # Some object files are given a prefix, to disambiguate
|
|
185 # them from objects of the same name built for the VM.
|
|
186 $(OUTDIR)/adlc-%.o: %.cpp
|
|
187 @echo Compiling $<
|
|
188 $(QUIETLY) $(REMOVE_TARGET)
|
|
189 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
|
|
190
|
|
191 # #########################################################################
|
|
192
|
|
193 clean :
|
|
194 rm $(OBJECTS)
|
|
195
|
|
196 cleanall :
|
|
197 rm $(OBJECTS) $(EXEC)
|
|
198
|
|
199 # #########################################################################
|
|
200
|
|
201 .PHONY: all dump refresh_adfiles clean cleanall
|