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