Path: blob/jdk8u272-b10-aarch32-20201026/hotspot/make/bsd/makefiles/adlc.make
83397 views
#1# Copyright (c) 1999, 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.make2930# #########################################################################3132# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:33GENERATED = ../generated34OUTDIR = $(GENERATED)/adfiles3536ARCH = $(Platform_arch)37OS = $(Platform_os_family)3839SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad4041ifeq ("${Platform_arch_model}", "${Platform_arch}")42SOURCES.AD = \43$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad)44else45SOURCES.AD = \46$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \47$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad)48endif4950EXEC = $(OUTDIR)/adlc5152# set VPATH so make knows where to look for source files53Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc54VPATH += $(Src_Dirs_V:%=%:)5556# set INCLUDES for C preprocessor57Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)58INCLUDES += $(Src_Dirs_I:%=-I%)5960# set flags for adlc compilation61CXXFLAGS = $(SYSDEFS) $(INCLUDES)6263# Force assertions on.64CXXFLAGS += -DASSERT6566# CFLAGS_WARN holds compiler options to suppress/enable warnings.67# Compiler warnings are treated as errors68ifneq ($(COMPILER_WARNINGS_FATAL),false)69CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)70endif71CFLAGS += $(CFLAGS_WARN)7273OBJECTNAMES = \74adlparse.o \75archDesc.o \76arena.o \77dfa.o \78dict2.o \79filebuff.o \80forms.o \81formsopt.o \82formssel.o \83main.o \84adlc-opcodes.o \85output_c.o \86output_h.o \8788OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)8990GENERATEDNAMES = \91ad_$(Platform_arch_model).cpp \92ad_$(Platform_arch_model).hpp \93ad_$(Platform_arch_model)_clone.cpp \94ad_$(Platform_arch_model)_expand.cpp \95ad_$(Platform_arch_model)_format.cpp \96ad_$(Platform_arch_model)_gen.cpp \97ad_$(Platform_arch_model)_misc.cpp \98ad_$(Platform_arch_model)_peephole.cpp \99ad_$(Platform_arch_model)_pipeline.cpp \100adGlobals_$(Platform_arch_model).hpp \101dfa_$(Platform_arch_model).cpp \102103GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)104105# #########################################################################106107all: $(EXEC)108109$(EXEC) : $(OBJECTS)110@echo Making adlc111$(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS)112113# Random dependencies:114$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp115116# The source files refer to ostream.h, which sparcworks calls iostream.h117$(OBJECTS): ostream.h118119ostream.h :120@echo >$@ '#include <iostream.h>'121122dump:123: OUTDIR=$(OUTDIR)124: OBJECTS=$(OBJECTS)125: products = $(GENERATEDFILES)126127all: $(GENERATEDFILES)128129$(GENERATEDFILES): refresh_adfiles130131# Get a unique temporary directory name, so multiple makes can run in parallel.132# Note that product files are updated via "mv", which is atomic.133TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)134135# Debuggable by default136CFLAGS += -g137138# Pass -D flags into ADLC.139ADLCFLAGS += $(SYSDEFS)140141# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.142ADLCFLAGS += -q -T143144# Normally, debugging is done directly on the ad_<arch>*.cpp files.145# But -g will put #line directives in those files pointing back to <arch>.ad.146# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives147# so skip it for 3.2 and ealier.148ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"149ADLCFLAGS += -g150endif151152ifdef LP64153ADLCFLAGS += -D_LP64154else155ADLCFLAGS += -U_LP64156endif157158#159# adlc_updater is a simple sh script, under sccs control. It is160# used to selectively update generated adlc files. This should161# provide a nice compilation speed improvement.162#163ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)164ADLC_UPDATER = adlc_updater165$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)166$(QUIETLY) cp $< $@; chmod +x $@167168# This action refreshes all generated adlc files simultaneously.169# The way it works is this:170# 1) create a scratch directory to work in.171# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.172# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.173# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.174# 5) If we actually updated any files, echo a notice.175#176refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)177@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)178$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \179-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 \180|| { rm -rf $(TEMPDIR); exit 1; }181$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)182$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)183$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)184$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)185$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)186$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)187$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)188$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)189$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)190$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)191$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)192$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \193|| echo "Rescanned $(SOURCE.AD) but encountered no changes."194$(QUIETLY) rm -rf $(TEMPDIR)195196197# #########################################################################198199$(SOURCE.AD): $(SOURCES.AD)200$(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)201202#PROCESS_AD_FILES = cat203# Pass through #line directives, in case user enables -g option above:204PROCESS_AD_FILES = awk '{ \205if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \206if (need_lineno && $$0 !~ /\/\//) \207{ print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \208print }'209210$(OUTDIR)/%.o: %.cpp211@echo Compiling $<212$(QUIETLY) $(REMOVE_TARGET)213$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)214215# Some object files are given a prefix, to disambiguate216# them from objects of the same name built for the VM.217$(OUTDIR)/adlc-%.o: %.cpp218@echo Compiling $<219$(QUIETLY) $(REMOVE_TARGET)220$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)221222# #########################################################################223224clean :225rm $(OBJECTS)226227cleanall :228rm $(OBJECTS) $(EXEC)229230# #########################################################################231232.PHONY: all dump refresh_adfiles clean cleanall233234235