Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/make/bsd/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# if target Darwin then set arch67# ifeq ($(OS_VENDOR), Darwin)68CXXFLAGS += -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v169# endif7071# CFLAGS_WARN holds compiler options to suppress/enable warnings.72# Compiler warnings are treated as errors73ifneq ($(COMPILER_WARNINGS_FATAL),false)74CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)75endif76CFLAGS += $(CFLAGS_WARN)7778OBJECTNAMES = \79adlparse.o \80archDesc.o \81arena.o \82dfa.o \83dict2.o \84filebuff.o \85forms.o \86formsopt.o \87formssel.o \88main.o \89adlc-opcodes.o \90output_c.o \91output_h.o \9293OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)9495GENERATEDNAMES = \96ad_$(Platform_arch_model).cpp \97ad_$(Platform_arch_model).hpp \98ad_$(Platform_arch_model)_clone.cpp \99ad_$(Platform_arch_model)_expand.cpp \100ad_$(Platform_arch_model)_format.cpp \101ad_$(Platform_arch_model)_gen.cpp \102ad_$(Platform_arch_model)_misc.cpp \103ad_$(Platform_arch_model)_peephole.cpp \104ad_$(Platform_arch_model)_pipeline.cpp \105adGlobals_$(Platform_arch_model).hpp \106dfa_$(Platform_arch_model).cpp \107108GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)109110# #########################################################################111112all: $(EXEC)113114$(EXEC) : $(OBJECTS)115@echo Making adlc116$(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) -lc++117118# Random dependencies:119$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp120121# The source files refer to ostream.h, which sparcworks calls iostream.h122$(OBJECTS): ostream.h123124ostream.h :125@echo >$@ '#include <iostream.h>'126127dump:128: OUTDIR=$(OUTDIR)129: OBJECTS=$(OBJECTS)130: products = $(GENERATEDFILES)131132all: $(GENERATEDFILES)133134$(GENERATEDFILES): refresh_adfiles135136# Get a unique temporary directory name, so multiple makes can run in parallel.137# Note that product files are updated via "mv", which is atomic.138TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)139140# Debuggable by default141CFLAGS += -g142143# Pass -D flags into ADLC.144ADLCFLAGS += $(SYSDEFS)145146# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.147ADLCFLAGS += -q -T148149# Normally, debugging is done directly on the ad_<arch>*.cpp files.150# But -g will put #line directives in those files pointing back to <arch>.ad.151# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives152# so skip it for 3.2 and ealier.153ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"154ADLCFLAGS += -g155endif156157ifdef LP64158ADLCFLAGS += -D_LP64159else160ADLCFLAGS += -U_LP64161endif162163#164# adlc_updater is a simple sh script, under sccs control. It is165# used to selectively update generated adlc files. This should166# provide a nice compilation speed improvement.167#168ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)169ADLC_UPDATER = adlc_updater170$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)171$(QUIETLY) cp $< $@; chmod +x $@172173# This action refreshes all generated adlc files simultaneously.174# The way it works is this:175# 1) create a scratch directory to work in.176# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.177# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.178# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.179# 5) If we actually updated any files, echo a notice.180#181refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)182@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)183$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \184-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 \185|| { rm -rf $(TEMPDIR); exit 1; }186$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)187$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)188$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)189$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)190$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)191$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)192$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)193$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)194$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)195$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)196$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)197$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \198|| echo "Rescanned $(SOURCE.AD) but encountered no changes."199$(QUIETLY) rm -rf $(TEMPDIR)200201202# #########################################################################203204$(SOURCE.AD): $(SOURCES.AD)205$(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)206207#PROCESS_AD_FILES = cat208# Pass through #line directives, in case user enables -g option above:209PROCESS_AD_FILES = awk '{ \210if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \211if (need_lineno && $$0 !~ /\/\//) \212{ print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \213print }'214215$(OUTDIR)/%.o: %.cpp216@echo Compiling $<217$(QUIETLY) $(REMOVE_TARGET)218$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)219220# Some object files are given a prefix, to disambiguate221# them from objects of the same name built for the VM.222$(OUTDIR)/adlc-%.o: %.cpp223@echo Compiling $<224$(QUIETLY) $(REMOVE_TARGET)225$(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE)226227# #########################################################################228229clean :230rm $(OBJECTS)231232cleanall :233rm $(OBJECTS) $(EXEC)234235# #########################################################################236237.PHONY: all dump refresh_adfiles clean cleanall238239240