2796N/A#
2796N/A# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
2796N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2796N/A#
2796N/A# This code is free software; you can redistribute it and/or modify it
2796N/A# under the terms of the GNU General Public License version 2 only, as
2796N/A# published by the Free Software Foundation.
2796N/A#
2796N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2796N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2796N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2796N/A# version 2 for more details (a copy is included in the LICENSE file that
2796N/A# accompanied this code).
2796N/A#
2796N/A# You should have received a copy of the GNU General Public License version
2796N/A# 2 along with this work; if not, write to the Free Software Foundation,
2796N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2796N/A#
2796N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2796N/A# or visit www.oracle.com if you need additional information or have any
2796N/A# questions.
2796N/A#
2796N/A#
2796N/A
2796N/A# This makefile (adlc.make) is included from the adlc.make in the
2796N/A# build directories.
2796N/A# It knows how to compile, link, and run the adlc.
2796N/A
2796N/Ainclude $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
2796N/A
2796N/A# #########################################################################
2796N/A
2796N/A# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:
2796N/AGENERATED = ../generated
2796N/AOUTDIR = $(GENERATED)/adfiles
2796N/A
2796N/AARCH = $(Platform_arch)
2796N/AOS = $(Platform_os_family)
2796N/A
2796N/ASOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
2796N/A
3041N/Aifeq ("${Platform_arch_model}", "${Platform_arch}")
3041N/A SOURCES.AD = \
2796N/A $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
2796N/A $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
3041N/Aelse
3041N/A SOURCES.AD = \
3041N/A $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
3041N/A $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \
3041N/A $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
3041N/Aendif
2796N/A
2796N/AEXEC = $(OUTDIR)/adlc
2796N/A
2796N/A# set VPATH so make knows where to look for source files
2796N/ASrc_Dirs_V += $(GAMMADIR)/src/share/vm/adlc
2796N/AVPATH += $(Src_Dirs_V:%=%:)
2796N/A
2796N/A# set INCLUDES for C preprocessor
2796N/ASrc_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)
2796N/AINCLUDES += $(Src_Dirs_I:%=-I%)
2796N/A
2796N/A# set flags for adlc compilation
3178N/ACXXFLAGS = $(SYSDEFS) $(INCLUDES)
2796N/A
2796N/A# Force assertions on.
3178N/ACXXFLAGS += -DASSERT
2796N/A
2796N/A# CFLAGS_WARN holds compiler options to suppress/enable warnings.
2796N/A# Compiler warnings are treated as errors
2842N/Aifneq ($(COMPILER_WARNINGS_FATAL),false)
2842N/A CFLAGS_WARN = -Werror
2842N/Aendif
2796N/ACFLAGS += $(CFLAGS_WARN)
2796N/A
2796N/AOBJECTNAMES = \
2796N/A adlparse.o \
2796N/A archDesc.o \
2796N/A arena.o \
2796N/A dfa.o \
2796N/A dict2.o \
2796N/A filebuff.o \
2796N/A forms.o \
2796N/A formsopt.o \
2796N/A formssel.o \
2796N/A main.o \
2796N/A adlc-opcodes.o \
2796N/A output_c.o \
2796N/A output_h.o \
2796N/A
2796N/AOBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
2796N/A
2796N/AGENERATEDNAMES = \
2796N/A ad_$(Platform_arch_model).cpp \
2796N/A ad_$(Platform_arch_model).hpp \
2796N/A ad_$(Platform_arch_model)_clone.cpp \
2796N/A ad_$(Platform_arch_model)_expand.cpp \
2796N/A ad_$(Platform_arch_model)_format.cpp \
2796N/A ad_$(Platform_arch_model)_gen.cpp \
2796N/A ad_$(Platform_arch_model)_misc.cpp \
2796N/A ad_$(Platform_arch_model)_peephole.cpp \
2796N/A ad_$(Platform_arch_model)_pipeline.cpp \
2796N/A adGlobals_$(Platform_arch_model).hpp \
2796N/A dfa_$(Platform_arch_model).cpp \
2796N/A
2796N/AGENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
2796N/A
2796N/A# #########################################################################
2796N/A
2796N/Aall: $(EXEC)
2796N/A
2796N/A$(EXEC) : $(OBJECTS)
2796N/A @echo Making adlc
3178N/A $(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS)
2796N/A
2796N/A# Random dependencies:
2796N/A$(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
2796N/A
2796N/A# The source files refer to ostream.h, which sparcworks calls iostream.h
2796N/A$(OBJECTS): ostream.h
2796N/A
2796N/Aostream.h :
2796N/A @echo >$@ '#include <iostream.h>'
2796N/A
2796N/Adump:
2796N/A : OUTDIR=$(OUTDIR)
2796N/A : OBJECTS=$(OBJECTS)
2796N/A : products = $(GENERATEDFILES)
2796N/A
2796N/Aall: $(GENERATEDFILES)
2796N/A
2796N/A$(GENERATEDFILES): refresh_adfiles
2796N/A
2796N/A# Get a unique temporary directory name, so multiple makes can run in parallel.
2796N/A# Note that product files are updated via "mv", which is atomic.
2796N/ATEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
2796N/A
2796N/A# Debuggable by default
2796N/ACFLAGS += -g
2796N/A
2796N/A# Pass -D flags into ADLC.
2796N/AADLCFLAGS += $(SYSDEFS)
2796N/A
2796N/A# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
2796N/AADLCFLAGS += -q -T
2796N/A
2796N/A# Normally, debugging is done directly on the ad_<arch>*.cpp files.
2796N/A# But -g will put #line directives in those files pointing back to <arch>.ad.
2796N/A# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives
2796N/A# so skip it for 3.2 and ealier.
2796N/Aifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
2796N/AADLCFLAGS += -g
2796N/Aendif
2796N/A
2796N/Aifdef LP64
2796N/AADLCFLAGS += -D_LP64
2796N/Aelse
2796N/AADLCFLAGS += -U_LP64
2796N/Aendif
2796N/A
2796N/A#
2796N/A# adlc_updater is a simple sh script, under sccs control. It is
2796N/A# used to selectively update generated adlc files. This should
2796N/A# provide a nice compilation speed improvement.
2796N/A#
2796N/AADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
2796N/AADLC_UPDATER = adlc_updater
2796N/A$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
2796N/A $(QUIETLY) cp $< $@; chmod +x $@
2796N/A
2796N/A# This action refreshes all generated adlc files simultaneously.
2796N/A# The way it works is this:
2796N/A# 1) create a scratch directory to work in.
2796N/A# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
2796N/A# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
2796N/A# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
2796N/A# 5) If we actually updated any files, echo a notice.
2796N/A#
2796N/Arefresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
2796N/A @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
2796N/A $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
2796N/A -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 \
2796N/A || { rm -rf $(TEMPDIR); exit 1; }
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
2796N/A $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
2796N/A || echo "Rescanned $(SOURCE.AD) but encountered no changes."
2796N/A $(QUIETLY) rm -rf $(TEMPDIR)
2796N/A
2796N/A
2796N/A# #########################################################################
2796N/A
2796N/A$(SOURCE.AD): $(SOURCES.AD)
2796N/A $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
2796N/A
2796N/A#PROCESS_AD_FILES = cat
2796N/A# Pass through #line directives, in case user enables -g option above:
2796N/APROCESS_AD_FILES = awk '{ \
2796N/A if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
2796N/A if (need_lineno && $$0 !~ /\/\//) \
2796N/A { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
2796N/A print }'
2796N/A
2796N/A$(OUTDIR)/%.o: %.cpp
2796N/A @echo Compiling $<
2796N/A $(QUIETLY) $(REMOVE_TARGET)
3178N/A $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)
2796N/A
2796N/A# Some object files are given a prefix, to disambiguate
2796N/A# them from objects of the same name built for the VM.
2796N/A$(OUTDIR)/adlc-%.o: %.cpp
2796N/A @echo Compiling $<
2796N/A $(QUIETLY) $(REMOVE_TARGET)
3178N/A $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)
2796N/A
2796N/A# #########################################################################
2796N/A
2796N/Aclean :
2796N/A rm $(OBJECTS)
2796N/A
2796N/Acleanall :
2796N/A rm $(OBJECTS) $(EXEC)
2796N/A
2796N/A# #########################################################################
2796N/A
2796N/A.PHONY: all dump refresh_adfiles clean cleanall