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