make/solaris/makefiles/adlc.make

Mon, 09 Mar 2009 13:28:46 -0700

author
xdono
date
Mon, 09 Mar 2009 13:28:46 -0700
changeset 1014
0fbdb4381b99
parent 910
284d0af00d53
child 1063
7bb995fbd3c0
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

duke@435 1 #
xdono@1014 2 # Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 #
duke@435 5 # This code is free software; you can redistribute it and/or modify it
duke@435 6 # under the terms of the GNU General Public License version 2 only, as
duke@435 7 # published by the Free Software Foundation.
duke@435 8 #
duke@435 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 # accompanied this code).
duke@435 14 #
duke@435 15 # You should have received a copy of the GNU General Public License version
duke@435 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 #
duke@435 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 # have any questions.
duke@435 22 #
duke@435 23 #
duke@435 24
duke@435 25 # This makefile (adlc.make) is included from the adlc.make in the
duke@435 26 # build directories.
duke@435 27 # It knows how to compile, link, and run the adlc.
duke@435 28
kamg@526 29 include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
duke@435 30
duke@435 31 # #########################################################################
duke@435 32
duke@435 33 # OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:
duke@435 34 GENERATED = ../generated
duke@435 35 OUTDIR = $(GENERATED)/adfiles
duke@435 36
duke@435 37 ARCH = $(Platform_arch)
duke@435 38 OS = $(Platform_os_family)
duke@435 39
duke@435 40 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
duke@435 41
duke@435 42 SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
duke@435 43 $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad
duke@435 44
duke@435 45 Src_Dirs += $(GAMMADIR)/src/share/vm/adlc
duke@435 46
duke@435 47 EXEC = $(OUTDIR)/adlc
duke@435 48
duke@435 49 # set VPATH so make knows where to look for source files
duke@435 50 Src_Dirs_V = ${Src_Dirs} $(GENERATED)/incls
duke@435 51 VPATH += $(Src_Dirs_V:%=%:)
duke@435 52
duke@435 53 # set INCLUDES for C preprocessor
duke@435 54 Src_Dirs_I = ${Src_Dirs} $(GENERATED)
duke@435 55 INCLUDES += $(Src_Dirs_I:%=-I%)
duke@435 56
jrose@910 57 # set flags for adlc compilation
jrose@910 58 CPPFLAGS = $(SYSDEFS) $(INCLUDES)
jrose@910 59
duke@435 60 # Force assertions on.
jrose@910 61 CPPFLAGS += -DASSERT
duke@435 62
duke@435 63 ifndef USE_GCC
duke@435 64 # We need libCstd.so for adlc
duke@435 65 CFLAGS += -library=Cstd -g
duke@435 66 LFLAGS += -library=Cstd -g
duke@435 67 endif
duke@435 68
duke@435 69 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
duke@435 70 CFLAGS += $(CFLAGS_WARN)
duke@435 71
duke@435 72 ifeq ("${Platform_compiler}", "sparcWorks")
duke@435 73 # Enable the following CFLAGS addition if you need to compare the
duke@435 74 # built ELF objects.
duke@435 75 #
duke@435 76 # The -g option makes static data global and the "-Qoption ccfe
duke@435 77 # -xglobalstatic" option tells the compiler to not globalize static
duke@435 78 # data using a unique globalization prefix. Instead force the use
duke@435 79 # of a static globalization prefix based on the source filepath so
duke@435 80 # the objects from two identical compilations are the same.
duke@435 81 #CFLAGS += -Qoption ccfe -xglobalstatic
duke@435 82 endif # Platform_compiler == sparcWorks
duke@435 83
duke@435 84 OBJECTNAMES = \
duke@435 85 adlparse.o \
duke@435 86 archDesc.o \
duke@435 87 arena.o \
duke@435 88 dfa.o \
duke@435 89 dict2.o \
duke@435 90 filebuff.o \
duke@435 91 forms.o \
duke@435 92 formsopt.o \
duke@435 93 formssel.o \
duke@435 94 main.o \
duke@435 95 adlc-opcodes.o \
duke@435 96 output_c.o \
duke@435 97 output_h.o \
duke@435 98
duke@435 99 OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
duke@435 100
duke@435 101 GENERATEDNAMES = \
duke@435 102 ad_$(Platform_arch_model).cpp \
duke@435 103 ad_$(Platform_arch_model).hpp \
duke@435 104 ad_$(Platform_arch_model)_clone.cpp \
duke@435 105 ad_$(Platform_arch_model)_expand.cpp \
duke@435 106 ad_$(Platform_arch_model)_format.cpp \
duke@435 107 ad_$(Platform_arch_model)_gen.cpp \
duke@435 108 ad_$(Platform_arch_model)_misc.cpp \
duke@435 109 ad_$(Platform_arch_model)_peephole.cpp \
duke@435 110 ad_$(Platform_arch_model)_pipeline.cpp \
duke@435 111 adGlobals_$(Platform_arch_model).hpp \
duke@435 112 dfa_$(Platform_arch_model).cpp \
duke@435 113
duke@435 114 GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
duke@435 115
duke@435 116 # #########################################################################
duke@435 117
duke@435 118 all: $(EXEC)
duke@435 119
duke@435 120 $(EXEC) : $(OBJECTS)
duke@435 121 @echo Making adlc
duke@435 122 $(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
duke@435 123
duke@435 124 # Random dependencies:
duke@435 125 $(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
duke@435 126
duke@435 127 # The source files refer to ostream.h, which sparcworks calls iostream.h
duke@435 128 $(OBJECTS): ostream.h
duke@435 129
duke@435 130 ostream.h :
duke@435 131 @echo >$@ '#include <iostream.h>'
duke@435 132
duke@435 133 dump:
duke@435 134 : OUTDIR=$(OUTDIR)
duke@435 135 : OBJECTS=$(OBJECTS)
duke@435 136 : products = $(GENERATEDFILES)
duke@435 137
duke@435 138 all: $(GENERATEDFILES)
duke@435 139
duke@435 140 $(GENERATEDFILES): refresh_adfiles
duke@435 141
duke@435 142 # Get a unique temporary directory name, so multiple makes can run in parallel.
duke@435 143 # Note that product files are updated via "mv", which is atomic.
duke@435 144 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
duke@435 145
jrose@910 146 # Pass -D flags into ADLC.
jrose@910 147 ADLCFLAGS += $(SYSDEFS)
jrose@910 148
jrose@910 149 # Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
jrose@910 150 ADLCFLAGS += -q -T
jrose@910 151
jrose@910 152 # Normally, debugging is done directly on the ad_<arch>*.cpp files.
jrose@910 153 # But -g will put #line directives in those files pointing back to <arch>.ad.
jrose@910 154 #ADLCFLAGS += -g
duke@435 155
duke@435 156 ifdef LP64
duke@435 157 ADLCFLAGS += -D_LP64
duke@435 158 else
duke@435 159 ADLCFLAGS += -U_LP64
duke@435 160 endif
duke@435 161
duke@435 162 #
duke@435 163 # adlc_updater is a simple sh script, under sccs control. It is
duke@435 164 # used to selectively update generated adlc files. This should
duke@435 165 # provide a nice compilation speed improvement.
duke@435 166 #
kamg@526 167 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
duke@435 168 ADLC_UPDATER = adlc_updater
jrose@910 169 $(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
jrose@910 170 $(QUIETLY) cp $< $@; chmod +x $@
duke@435 171
duke@435 172 # This action refreshes all generated adlc files simultaneously.
duke@435 173 # The way it works is this:
duke@435 174 # 1) create a scratch directory to work in.
duke@435 175 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
duke@435 176 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
duke@435 177 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
duke@435 178 # 5) If we actually updated any files, echo a notice.
duke@435 179 #
jrose@910 180 refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
duke@435 181 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
duke@435 182 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
duke@435 183 -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 \
duke@435 184 || { rm -rf $(TEMPDIR); exit 1; }
duke@435 185 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
duke@435 186 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
duke@435 187 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
duke@435 188 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
duke@435 189 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
duke@435 190 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
duke@435 191 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
duke@435 192 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
duke@435 193 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
duke@435 194 $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
duke@435 195 $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
duke@435 196 $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
duke@435 197 || echo "Rescanned $(SOURCE.AD) but encountered no changes."
duke@435 198 $(QUIETLY) rm -rf $(TEMPDIR)
duke@435 199
duke@435 200
duke@435 201 # #########################################################################
duke@435 202
duke@435 203 $(SOURCE.AD): $(SOURCES.AD)
jrose@910 204 $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
jrose@910 205
jrose@910 206 #PROCESS_AD_FILES = cat
jrose@910 207 # Pass through #line directives, in case user enables -g option above:
jrose@910 208 PROCESS_AD_FILES = awk '{ \
jrose@910 209 if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
jrose@910 210 if (need_lineno && $$0 !~ /\/\//) \
jrose@910 211 { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
jrose@910 212 print }'
duke@435 213
duke@435 214 $(OUTDIR)/%.o: %.cpp
duke@435 215 @echo Compiling $<
duke@435 216 $(QUIETLY) $(REMOVE_TARGET)
duke@435 217 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
duke@435 218
duke@435 219 # Some object files are given a prefix, to disambiguate
duke@435 220 # them from objects of the same name built for the VM.
duke@435 221 $(OUTDIR)/adlc-%.o: %.cpp
duke@435 222 @echo Compiling $<
duke@435 223 $(QUIETLY) $(REMOVE_TARGET)
duke@435 224 $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
duke@435 225
duke@435 226 # #########################################################################
duke@435 227
duke@435 228 clean :
duke@435 229 rm $(OBJECTS)
duke@435 230
duke@435 231 cleanall :
duke@435 232 rm $(OBJECTS) $(EXEC)
duke@435 233
duke@435 234 # #########################################################################
duke@435 235
duke@435 236 .PHONY: all dump refresh_adfiles clean cleanall

mercurial