make/linux/makefiles/adlc.make

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/linux/makefiles/adlc.make	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,233 @@
     1.4 +#
     1.5 +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.
    1.11 +#
    1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 +# version 2 for more details (a copy is included in the LICENSE file that
    1.16 +# accompanied this code).
    1.17 +#
    1.18 +# You should have received a copy of the GNU General Public License version
    1.19 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 +#
    1.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 +# or visit www.oracle.com if you need additional information or have any
    1.24 +# questions.
    1.25 +#  
    1.26 +#
    1.27 +
    1.28 +# This makefile (adlc.make) is included from the adlc.make in the
    1.29 +# build directories.
    1.30 +# It knows how to compile, link, and run the adlc.
    1.31 +
    1.32 +include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
    1.33 +
    1.34 +# #########################################################################
    1.35 +
    1.36 +# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:
    1.37 +GENERATED = ../generated
    1.38 +OUTDIR  = $(GENERATED)/adfiles
    1.39 +
    1.40 +ARCH = $(Platform_arch)
    1.41 +OS = $(Platform_os_family)
    1.42 +
    1.43 +SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad 
    1.44 +
    1.45 +ifeq ("${Platform_arch_model}", "${Platform_arch}")
    1.46 +  SOURCES.AD = \
    1.47 +  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) 
    1.48 +else
    1.49 +  SOURCES.AD = \
    1.50 +  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
    1.51 +  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) 
    1.52 +endif
    1.53 +
    1.54 +EXEC	= $(OUTDIR)/adlc
    1.55 +
    1.56 +# set VPATH so make knows where to look for source files
    1.57 +Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc
    1.58 +VPATH += $(Src_Dirs_V:%=%:)
    1.59 +
    1.60 +# set INCLUDES for C preprocessor
    1.61 +Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)
    1.62 +INCLUDES += $(Src_Dirs_I:%=-I%)
    1.63 +
    1.64 +# set flags for adlc compilation
    1.65 +CXXFLAGS = $(SYSDEFS) $(INCLUDES)
    1.66 +
    1.67 +# Force assertions on.
    1.68 +CXXFLAGS += -DASSERT
    1.69 +
    1.70 +# CFLAGS_WARN holds compiler options to suppress/enable warnings.
    1.71 +# Compiler warnings are treated as errors
    1.72 +CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
    1.73 +CFLAGS += $(CFLAGS_WARN)
    1.74 +
    1.75 +OBJECTNAMES = \
    1.76 +	adlparse.o \
    1.77 +	archDesc.o \
    1.78 +	arena.o \
    1.79 +	dfa.o \
    1.80 +	dict2.o \
    1.81 +	filebuff.o \
    1.82 +	forms.o \
    1.83 +	formsopt.o \
    1.84 +	formssel.o \
    1.85 +	main.o \
    1.86 +	adlc-opcodes.o \
    1.87 +	output_c.o \
    1.88 +	output_h.o \
    1.89 +
    1.90 +OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
    1.91 +
    1.92 +GENERATEDNAMES = \
    1.93 +        ad_$(Platform_arch_model).cpp \
    1.94 +        ad_$(Platform_arch_model).hpp \
    1.95 +        ad_$(Platform_arch_model)_clone.cpp \
    1.96 +        ad_$(Platform_arch_model)_expand.cpp \
    1.97 +        ad_$(Platform_arch_model)_format.cpp \
    1.98 +        ad_$(Platform_arch_model)_gen.cpp \
    1.99 +        ad_$(Platform_arch_model)_misc.cpp \
   1.100 +        ad_$(Platform_arch_model)_peephole.cpp \
   1.101 +        ad_$(Platform_arch_model)_pipeline.cpp \
   1.102 +        adGlobals_$(Platform_arch_model).hpp \
   1.103 +        dfa_$(Platform_arch_model).cpp \
   1.104 +
   1.105 +GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
   1.106 +
   1.107 +# #########################################################################
   1.108 +
   1.109 +all: $(EXEC)
   1.110 +
   1.111 +$(EXEC) : $(OBJECTS)
   1.112 +	@echo Making adlc
   1.113 +	$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) -o $(EXEC) $(OBJECTS)
   1.114 +
   1.115 +# Random dependencies:
   1.116 +$(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
   1.117 +
   1.118 +# The source files refer to ostream.h, which sparcworks calls iostream.h
   1.119 +$(OBJECTS): ostream.h
   1.120 +
   1.121 +ostream.h :
   1.122 +	@echo >$@ '#include <iostream.h>'
   1.123 +
   1.124 +dump:
   1.125 +	: OUTDIR=$(OUTDIR)
   1.126 +	: OBJECTS=$(OBJECTS)
   1.127 +	: products = $(GENERATEDFILES)
   1.128 +
   1.129 +all: $(GENERATEDFILES)
   1.130 +
   1.131 +$(GENERATEDFILES): refresh_adfiles
   1.132 +
   1.133 +# Get a unique temporary directory name, so multiple makes can run in parallel.
   1.134 +# Note that product files are updated via "mv", which is atomic.
   1.135 +TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
   1.136 +
   1.137 +ifneq ($(DEBUG_BINARIES), true)
   1.138 +  # Debuggable by default (unless already done by DEBUG_BINARIES)
   1.139 +  CFLAGS += -g
   1.140 +endif
   1.141 +
   1.142 +# Pass -D flags into ADLC.
   1.143 +ADLCFLAGS += $(SYSDEFS)
   1.144 +
   1.145 +# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
   1.146 +ADLCFLAGS += -q -T
   1.147 +
   1.148 +# Normally, debugging is done directly on the ad_<arch>*.cpp files.
   1.149 +# But -g will put #line directives in those files pointing back to <arch>.ad.
   1.150 +# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives
   1.151 +# so skip it for 3.2 and ealier.
   1.152 +ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   1.153 +ADLCFLAGS += -g
   1.154 +endif
   1.155 +
   1.156 +ifdef LP64
   1.157 +ADLCFLAGS += -D_LP64
   1.158 +else
   1.159 +ADLCFLAGS += -U_LP64
   1.160 +endif
   1.161 +
   1.162 +#
   1.163 +# adlc_updater is a simple sh script, under sccs control. It is
   1.164 +# used to selectively update generated adlc files. This should
   1.165 +# provide a nice compilation speed improvement.
   1.166 +#
   1.167 +ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
   1.168 +ADLC_UPDATER = adlc_updater
   1.169 +$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
   1.170 +	$(QUIETLY) cp $< $@; chmod +x $@
   1.171 +
   1.172 +# This action refreshes all generated adlc files simultaneously.
   1.173 +# The way it works is this:
   1.174 +# 1) create a scratch directory to work in.
   1.175 +# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
   1.176 +# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
   1.177 +# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
   1.178 +# 5) If we actually updated any files, echo a notice.
   1.179 +#
   1.180 +refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
   1.181 +	@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
   1.182 +	$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
   1.183 + -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 \
   1.184 +	    || { rm -rf $(TEMPDIR); exit 1; }
   1.185 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
   1.186 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
   1.187 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
   1.188 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
   1.189 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
   1.190 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
   1.191 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
   1.192 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
   1.193 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
   1.194 +	$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
   1.195 +	$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
   1.196 +	$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
   1.197 +		|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
   1.198 +	$(QUIETLY) rm -rf $(TEMPDIR)
   1.199 +
   1.200 +
   1.201 +# #########################################################################
   1.202 +
   1.203 +$(SOURCE.AD): $(SOURCES.AD)
   1.204 +	$(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
   1.205 +
   1.206 +#PROCESS_AD_FILES = cat
   1.207 +# Pass through #line directives, in case user enables -g option above:
   1.208 +PROCESS_AD_FILES = awk '{ \
   1.209 +    if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
   1.210 +    if (need_lineno && $$0 !~ /\/\//) \
   1.211 +      { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
   1.212 +    print }'
   1.213 +
   1.214 +$(OUTDIR)/%.o: %.cpp
   1.215 +	@echo Compiling $<
   1.216 +	$(QUIETLY) $(REMOVE_TARGET)
   1.217 +	$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE)
   1.218 +
   1.219 +# Some object files are given a prefix, to disambiguate
   1.220 +# them from objects of the same name built for the VM.
   1.221 +$(OUTDIR)/adlc-%.o: %.cpp
   1.222 +	@echo Compiling $<
   1.223 +	$(QUIETLY) $(REMOVE_TARGET)
   1.224 +	$(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE)
   1.225 +
   1.226 +# #########################################################################
   1.227 +
   1.228 +clean	:
   1.229 +	rm $(OBJECTS)
   1.230 +
   1.231 +cleanall :
   1.232 +	rm $(OBJECTS) $(EXEC)
   1.233 +
   1.234 +# #########################################################################
   1.235 +
   1.236 +.PHONY: all dump refresh_adfiles clean cleanall

mercurial