make/linux/makefiles/adlc.make

Tue, 05 Apr 2011 14:12:31 -0700

author
trims
date
Tue, 05 Apr 2011 14:12:31 -0700
changeset 2708
1d1603768966
parent 2683
7e88bdae86ec
child 3390
65149e74c706
permissions
-rw-r--r--

7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
Summary: Update the copyright to be 2010 on all changed files in OpenJDK
Reviewed-by: ohair

duke@435 1 #
kamg@2515 2 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 #
trims@1907 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 # or visit www.oracle.com if you need additional information or have any
trims@1907 21 # 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
kamg@2515 42 SOURCES.AD = \
kamg@2515 43 $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
kamg@2515 44 $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
duke@435 45
duke@435 46 EXEC = $(OUTDIR)/adlc
duke@435 47
duke@435 48 # set VPATH so make knows where to look for source files
stefank@2314 49 Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc
stefank@2314 50 VPATH += $(Src_Dirs_V:%=%:)
duke@435 51
duke@435 52 # set INCLUDES for C preprocessor
stefank@2314 53 Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)
duke@435 54 INCLUDES += $(Src_Dirs_I:%=-I%)
duke@435 55
jrose@910 56 # set flags for adlc compilation
jrose@910 57 CPPFLAGS = $(SYSDEFS) $(INCLUDES)
jrose@910 58
duke@435 59 # Force assertions on.
jrose@910 60 CPPFLAGS += -DASSERT
duke@435 61
duke@435 62 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
twisti@1038 63 # Compiler warnings are treated as errors
twisti@1038 64 CFLAGS_WARN = -Werror
duke@435 65 CFLAGS += $(CFLAGS_WARN)
duke@435 66
duke@435 67 OBJECTNAMES = \
duke@435 68 adlparse.o \
duke@435 69 archDesc.o \
duke@435 70 arena.o \
duke@435 71 dfa.o \
duke@435 72 dict2.o \
duke@435 73 filebuff.o \
duke@435 74 forms.o \
duke@435 75 formsopt.o \
duke@435 76 formssel.o \
duke@435 77 main.o \
duke@435 78 adlc-opcodes.o \
duke@435 79 output_c.o \
duke@435 80 output_h.o \
duke@435 81
duke@435 82 OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
duke@435 83
duke@435 84 GENERATEDNAMES = \
duke@435 85 ad_$(Platform_arch_model).cpp \
duke@435 86 ad_$(Platform_arch_model).hpp \
duke@435 87 ad_$(Platform_arch_model)_clone.cpp \
duke@435 88 ad_$(Platform_arch_model)_expand.cpp \
duke@435 89 ad_$(Platform_arch_model)_format.cpp \
duke@435 90 ad_$(Platform_arch_model)_gen.cpp \
duke@435 91 ad_$(Platform_arch_model)_misc.cpp \
duke@435 92 ad_$(Platform_arch_model)_peephole.cpp \
duke@435 93 ad_$(Platform_arch_model)_pipeline.cpp \
duke@435 94 adGlobals_$(Platform_arch_model).hpp \
duke@435 95 dfa_$(Platform_arch_model).cpp \
duke@435 96
duke@435 97 GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
duke@435 98
duke@435 99 # #########################################################################
duke@435 100
duke@435 101 all: $(EXEC)
duke@435 102
duke@435 103 $(EXEC) : $(OBJECTS)
duke@435 104 @echo Making adlc
roland@2683 105 $(QUIETLY) $(HOST.LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
duke@435 106
duke@435 107 # Random dependencies:
duke@435 108 $(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 109
duke@435 110 # The source files refer to ostream.h, which sparcworks calls iostream.h
duke@435 111 $(OBJECTS): ostream.h
duke@435 112
duke@435 113 ostream.h :
duke@435 114 @echo >$@ '#include <iostream.h>'
duke@435 115
duke@435 116 dump:
duke@435 117 : OUTDIR=$(OUTDIR)
duke@435 118 : OBJECTS=$(OBJECTS)
duke@435 119 : products = $(GENERATEDFILES)
duke@435 120
duke@435 121 all: $(GENERATEDFILES)
duke@435 122
duke@435 123 $(GENERATEDFILES): refresh_adfiles
duke@435 124
duke@435 125 # Get a unique temporary directory name, so multiple makes can run in parallel.
duke@435 126 # Note that product files are updated via "mv", which is atomic.
duke@435 127 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
duke@435 128
never@1831 129 # Debuggable by default
never@1831 130 CFLAGS += -g
never@1831 131
jrose@910 132 # Pass -D flags into ADLC.
jrose@910 133 ADLCFLAGS += $(SYSDEFS)
jrose@910 134
jrose@910 135 # Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
jrose@910 136 ADLCFLAGS += -q -T
jrose@910 137
jrose@910 138 # Normally, debugging is done directly on the ad_<arch>*.cpp files.
jrose@910 139 # But -g will put #line directives in those files pointing back to <arch>.ad.
never@1961 140 # Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives
never@1961 141 # so skip it for 3.2 and ealier.
never@1961 142 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
never@1831 143 ADLCFLAGS += -g
never@1961 144 endif
duke@435 145
duke@435 146 ifdef LP64
duke@435 147 ADLCFLAGS += -D_LP64
duke@435 148 else
duke@435 149 ADLCFLAGS += -U_LP64
duke@435 150 endif
duke@435 151
duke@435 152 #
duke@435 153 # adlc_updater is a simple sh script, under sccs control. It is
duke@435 154 # used to selectively update generated adlc files. This should
duke@435 155 # provide a nice compilation speed improvement.
duke@435 156 #
kamg@526 157 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
duke@435 158 ADLC_UPDATER = adlc_updater
jrose@910 159 $(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
jrose@910 160 $(QUIETLY) cp $< $@; chmod +x $@
duke@435 161
duke@435 162 # This action refreshes all generated adlc files simultaneously.
duke@435 163 # The way it works is this:
duke@435 164 # 1) create a scratch directory to work in.
duke@435 165 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
duke@435 166 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
duke@435 167 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
duke@435 168 # 5) If we actually updated any files, echo a notice.
duke@435 169 #
jrose@910 170 refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
duke@435 171 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
duke@435 172 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
duke@435 173 -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 174 || { rm -rf $(TEMPDIR); exit 1; }
duke@435 175 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
duke@435 176 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
duke@435 177 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
duke@435 178 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
duke@435 179 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
duke@435 180 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
duke@435 181 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
duke@435 182 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
duke@435 183 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
duke@435 184 $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
duke@435 185 $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
duke@435 186 $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
duke@435 187 || echo "Rescanned $(SOURCE.AD) but encountered no changes."
duke@435 188 $(QUIETLY) rm -rf $(TEMPDIR)
duke@435 189
duke@435 190
duke@435 191 # #########################################################################
duke@435 192
duke@435 193 $(SOURCE.AD): $(SOURCES.AD)
jrose@910 194 $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
jrose@910 195
jrose@910 196 #PROCESS_AD_FILES = cat
jrose@910 197 # Pass through #line directives, in case user enables -g option above:
jrose@910 198 PROCESS_AD_FILES = awk '{ \
jrose@910 199 if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
jrose@910 200 if (need_lineno && $$0 !~ /\/\//) \
jrose@910 201 { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
jrose@910 202 print }'
duke@435 203
duke@435 204 $(OUTDIR)/%.o: %.cpp
duke@435 205 @echo Compiling $<
duke@435 206 $(QUIETLY) $(REMOVE_TARGET)
roland@2683 207 $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
duke@435 208
duke@435 209 # Some object files are given a prefix, to disambiguate
duke@435 210 # them from objects of the same name built for the VM.
duke@435 211 $(OUTDIR)/adlc-%.o: %.cpp
duke@435 212 @echo Compiling $<
duke@435 213 $(QUIETLY) $(REMOVE_TARGET)
roland@2683 214 $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
duke@435 215
duke@435 216 # #########################################################################
duke@435 217
duke@435 218 clean :
duke@435 219 rm $(OBJECTS)
duke@435 220
duke@435 221 cleanall :
duke@435 222 rm $(OBJECTS) $(EXEC)
duke@435 223
duke@435 224 # #########################################################################
duke@435 225
duke@435 226 .PHONY: all dump refresh_adfiles clean cleanall

mercurial