Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/make/linux/makefiles/adlc.make
32285 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 errors68CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)69CFLAGS += $(CFLAGS_WARN)7071OBJECTNAMES = \72adlparse.o \73archDesc.o \74arena.o \75dfa.o \76dict2.o \77filebuff.o \78forms.o \79formsopt.o \80formssel.o \81main.o \82adlc-opcodes.o \83output_c.o \84output_h.o \8586OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)8788GENERATEDNAMES = \89ad_$(Platform_arch_model).cpp \90ad_$(Platform_arch_model).hpp \91ad_$(Platform_arch_model)_clone.cpp \92ad_$(Platform_arch_model)_expand.cpp \93ad_$(Platform_arch_model)_format.cpp \94ad_$(Platform_arch_model)_gen.cpp \95ad_$(Platform_arch_model)_misc.cpp \96ad_$(Platform_arch_model)_peephole.cpp \97ad_$(Platform_arch_model)_pipeline.cpp \98adGlobals_$(Platform_arch_model).hpp \99dfa_$(Platform_arch_model).cpp \100101GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)102103# #########################################################################104105all: $(EXEC)106107ADLC_LD_FLAGS=108ifeq ($(STATIC_CXX), true)109ADLC_LD_FLAGS = $(STATIC_LIBGCC) $(ADLC_STATIC_STDCXX)110endif111112113$(EXEC) : $(OBJECTS)114@echo Making adlc115$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) $(ADLC_LD_FLAGS) -o $(EXEC) $(OBJECTS)116117# Random dependencies:118$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp119120# The source files refer to ostream.h, which sparcworks calls iostream.h121$(OBJECTS): ostream.h122123ostream.h :124@echo >$@ '#include <iostream.h>'125126dump:127: OUTDIR=$(OUTDIR)128: OBJECTS=$(OBJECTS)129: products = $(GENERATEDFILES)130131all: $(GENERATEDFILES)132133$(GENERATEDFILES): refresh_adfiles134135# Get a unique temporary directory name, so multiple makes can run in parallel.136# Note that product files are updated via "mv", which is atomic.137TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)138139ifneq ($(DEBUG_BINARIES), true)140# Debuggable by default (unless already done by DEBUG_BINARIES)141CFLAGS += -g142endif143144# Pass -D flags into ADLC.145ADLCFLAGS += $(SYSDEFS)146147# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.148ADLCFLAGS += -q -T149150# Normally, debugging is done directly on the ad_<arch>*.cpp files.151# But -g will put #line directives in those files pointing back to <arch>.ad.152# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives153# so skip it for 3.2 and ealier.154ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"155ADLCFLAGS += -g156endif157158ifdef LP64159ADLCFLAGS += -D_LP64160else161ADLCFLAGS += -U_LP64162endif163164#165# adlc_updater is a simple sh script, under sccs control. It is166# used to selectively update generated adlc files. This should167# provide a nice compilation speed improvement.168#169ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)170ADLC_UPDATER = adlc_updater171$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)172$(QUIETLY) cp $< $@; chmod +x $@173174# This action refreshes all generated adlc files simultaneously.175# The way it works is this:176# 1) create a scratch directory to work in.177# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.178# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.179# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.180# 5) If we actually updated any files, echo a notice.181#182refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)183@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)184$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \185-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 \186|| { rm -rf $(TEMPDIR); exit 1; }187$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)188$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)189$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)190$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)191$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)192$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)193$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)194$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)195$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)196$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)197$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)198$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \199|| echo "Rescanned $(SOURCE.AD) but encountered no changes."200$(QUIETLY) rm -rf $(TEMPDIR)201202203# #########################################################################204205$(SOURCE.AD): $(SOURCES.AD)206$(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)207208#PROCESS_AD_FILES = cat209# Pass through #line directives, in case user enables -g option above:210PROCESS_AD_FILES = awk '{ \211if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \212if (need_lineno && $$0 !~ /\/\//) \213{ print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \214print }'215216$(OUTDIR)/%.o: %.cpp217@echo Compiling $<218$(QUIETLY) $(REMOVE_TARGET)219$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE)220221# Some object files are given a prefix, to disambiguate222# them from objects of the same name built for the VM.223$(OUTDIR)/adlc-%.o: %.cpp224@echo Compiling $<225$(QUIETLY) $(REMOVE_TARGET)226$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE)227228# #########################################################################229230clean :231rm $(OBJECTS)232233cleanall :234rm $(OBJECTS) $(EXEC)235236# #########################################################################237238.PHONY: all dump refresh_adfiles clean cleanall239240241