Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/make/solaris/makefiles/adlc.make
32284 views
#1# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#22#2324# This makefile (adlc.make) is included from the adlc.make in the25# build directories.26# It knows how to compile, link, and run the adlc.2728include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make29include $(GAMMADIR)/make/altsrc.make3031# #########################################################################3233# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:34GENERATED = ../generated35OUTDIR = $(GENERATED)/adfiles3637ARCH = $(Platform_arch)38OS = $(Platform_os_family)3940SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad4142ifeq ("${Platform_arch_model}", "${Platform_arch}")43SOURCES.AD = \44$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad)45else46SOURCES.AD = \47$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \48$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad)49endif5051EXEC = $(OUTDIR)/adlc5253# set VPATH so make knows where to look for source files54Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc55VPATH += $(Src_Dirs_V:%=%:)5657# set INCLUDES for C preprocessor58Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)59INCLUDES += $(Src_Dirs_I:%=-I%)6061# set flags for adlc compilation62CXXFLAGS = $(SYSDEFS) $(INCLUDES)6364# Force assertions on.65CXXFLAGS += -DASSERT6667ifndef USE_GCC68# We need libCstd.so for adlc69CFLAGS += -library=Cstd -g70LFLAGS += -library=Cstd -g71endif7273# CFLAGS_WARN holds compiler options to suppress/enable warnings.74# Compiler warnings are treated as errors75ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)76CFLAGS_WARN = +w -errwarn77endif78# When using compiler version 5.13 (Solaris Studio 12.4), calls to explicitly79# instantiated template functions trigger this warning when +w is active.80ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 513), 1)81CFLAGS_WARN += -erroff=notemsource82endif83CFLAGS += $(CFLAGS_WARN)8485ifeq ("${Platform_compiler}", "sparcWorks")86# Enable the following CFLAGS addition if you need to compare the87# built ELF objects.88#89# The -g option makes static data global and the "-Qoption ccfe90# -xglobalstatic" option tells the compiler to not globalize static91# data using a unique globalization prefix. Instead force the use92# of a static globalization prefix based on the source filepath so93# the objects from two identical compilations are the same.94#CFLAGS += -Qoption ccfe -xglobalstatic95endif # Platform_compiler == sparcWorks9697OBJECTNAMES = \98adlparse.o \99archDesc.o \100arena.o \101dfa.o \102dict2.o \103filebuff.o \104forms.o \105formsopt.o \106formssel.o \107main.o \108adlc-opcodes.o \109output_c.o \110output_h.o \111112OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)113114GENERATEDNAMES = \115ad_$(Platform_arch_model).cpp \116ad_$(Platform_arch_model).hpp \117ad_$(Platform_arch_model)_clone.cpp \118ad_$(Platform_arch_model)_expand.cpp \119ad_$(Platform_arch_model)_format.cpp \120ad_$(Platform_arch_model)_gen.cpp \121ad_$(Platform_arch_model)_misc.cpp \122ad_$(Platform_arch_model)_peephole.cpp \123ad_$(Platform_arch_model)_pipeline.cpp \124adGlobals_$(Platform_arch_model).hpp \125dfa_$(Platform_arch_model).cpp \126127GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)128129# #########################################################################130131all: $(EXEC)132133$(EXEC) : $(OBJECTS)134@echo Making adlc135$(QUIETLY) $(LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS)136137# Random dependencies:138$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp139140# The source files refer to ostream.h, which sparcworks calls iostream.h141$(OBJECTS): ostream.h142143ostream.h :144@echo >$@ '#include <iostream.h>'145146dump:147: OUTDIR=$(OUTDIR)148: OBJECTS=$(OBJECTS)149: products = $(GENERATEDFILES)150151all: $(GENERATEDFILES)152153$(GENERATEDFILES): refresh_adfiles154155# Get a unique temporary directory name, so multiple makes can run in parallel.156# Note that product files are updated via "mv", which is atomic.157TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)158159# Debuggable by default160CFLAGS += -g161162# Pass -D flags into ADLC.163ADLCFLAGS += $(SYSDEFS)164165# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.166ADLCFLAGS += -q -T167168# Normally, debugging is done directly on the ad_<arch>*.cpp files.169# But -g will put #line directives in those files pointing back to <arch>.ad.170ADLCFLAGS += -g171172ifdef LP64173ADLCFLAGS += -D_LP64174else175ADLCFLAGS += -U_LP64176endif177178#179# adlc_updater is a simple sh script, under sccs control. It is180# used to selectively update generated adlc files. This should181# provide a nice compilation speed improvement.182#183ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)184ADLC_UPDATER = adlc_updater185$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)186$(QUIETLY) cp $< $@; chmod +x $@187188# This action refreshes all generated adlc files simultaneously.189# The way it works is this:190# 1) create a scratch directory to work in.191# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.192# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.193# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.194# 5) If we actually updated any files, echo a notice.195#196refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)197@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)198$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \199-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 \200|| { rm -rf $(TEMPDIR); exit 1; }201$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)202$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)203$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)204$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)205$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)206$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)207$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)208$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)209$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)210$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)211$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)212$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \213|| echo "Rescanned $(SOURCE.AD) but encountered no changes."214$(QUIETLY) rm -rf $(TEMPDIR)215216217# #########################################################################218219$(SOURCE.AD): $(SOURCES.AD)220$(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)221222#PROCESS_AD_FILES = cat223# Pass through #line directives, in case user enables -g option above:224PROCESS_AD_FILES = awk '{ \225if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \226if (need_lineno && $$0 !~ /\/\//) \227{ print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \228print }'229230$(OUTDIR)/%.o: %.cpp231@echo Compiling $<232$(QUIETLY) $(REMOVE_TARGET)233$(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE)234235# Some object files are given a prefix, to disambiguate236# them from objects of the same name built for the VM.237$(OUTDIR)/adlc-%.o: %.cpp238@echo Compiling $<239$(QUIETLY) $(REMOVE_TARGET)240$(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE)241242# #########################################################################243244clean :245rm $(OBJECTS)246247cleanall :248rm $(OBJECTS) $(EXEC)249250# #########################################################################251252.PHONY: all dump refresh_adfiles clean cleanall253254255