adlc.make revision 603
4169N/A#
1178N/A# Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
1178N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1178N/A#
1178N/A# This code is free software; you can redistribute it and/or modify it
1178N/A# under the terms of the GNU General Public License version 2 only, as
1178N/A# published by the Free Software Foundation.
1178N/A#
1178N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1178N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1178N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1178N/A# version 2 for more details (a copy is included in the LICENSE file that
1178N/A# accompanied this code).
1178N/A#
1178N/A# You should have received a copy of the GNU General Public License version
1178N/A# 2 along with this work; if not, write to the Free Software Foundation,
1178N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A#
2362N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2362N/A# CA 95054 USA or visit www.sun.com if you need additional information or
1178N/A# have any questions.
4169N/A#
1178N/A#
0N/A
4033N/A# This makefile (adlc.make) is included from the adlc.make in the
1178N/A# build directories.
1178N/A# It knows how to compile, link, and run the adlc.
4033N/A
4033N/Ainclude $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
0N/A
1178N/A# #########################################################################
4033N/A
0N/A# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:
4033N/AGENERATED = ../generated
0N/AOUTDIR = $(GENERATED)/adfiles
1178N/A
0N/AARCH = $(Platform_arch)
4033N/AOS = $(Platform_os_family)
0N/A
0N/ASOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
0N/A
0N/ASOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
0N/A $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad
0N/A
0N/ASrc_Dirs += $(GAMMADIR)/src/share/vm/adlc
0N/A
0N/AEXEC = $(OUTDIR)/adlc
0N/A
4033N/A# set VPATH so make knows where to look for source files
1178N/ASrc_Dirs_V = ${Src_Dirs} $(GENERATED)/incls
1178N/AVPATH += $(Src_Dirs_V:%=%:)
4033N/A
0N/A# set INCLUDES for C preprocessor
0N/ASrc_Dirs_I = ${Src_Dirs} $(GENERATED)
0N/AINCLUDES += $(Src_Dirs_I:%=-I%)
1178N/A
4033N/A# set flags for adlc compilation
0N/ACPPFLAGS = $(SYSDEFS) $(INCLUDES)
1178N/A
4033N/A# Force assertions on.
1178N/ACPPFLAGS += -DASSERT
1178N/A
1178N/Aifndef USE_GCC
1178N/A # We need libCstd.so for adlc
4033N/A CFLAGS += -library=Cstd -g
1178N/A LFLAGS += -library=Cstd -g
1178N/Aendif
4033N/A
1178N/A# CFLAGS_WARN holds compiler options to suppress/enable warnings.
4033N/A# Compiler warnings are treated as errors
1178N/ACFLAGS_WARN = +w -errwarn
4033N/ACFLAGS += $(CFLAGS_WARN)
1178N/A
4033N/Aifeq ("${Platform_compiler}", "sparcWorks")
1178N/A# Enable the following CFLAGS addition if you need to compare the
1178N/A# built ELF objects.
4033N/A#
1178N/A# The -g option makes static data global and the "-Qoption ccfe
1178N/A# -xglobalstatic" option tells the compiler to not globalize static
1178N/A# data using a unique globalization prefix. Instead force the use
1178N/A# of a static globalization prefix based on the source filepath so
4033N/A# the objects from two identical compilations are the same.
0N/A#CFLAGS += -Qoption ccfe -xglobalstatic
0N/Aendif # Platform_compiler == sparcWorks
0N/A
0N/AOBJECTNAMES = \
0N/A adlparse.o \
0N/A archDesc.o \
1178N/A arena.o \
4033N/A dfa.o \
1178N/A dict2.o \
1178N/A filebuff.o \
0N/A forms.o \
1178N/A formsopt.o \
4033N/A formssel.o \
1178N/A main.o \
0N/A adlc-opcodes.o \
0N/A output_c.o \
1178N/A output_h.o \
0N/A
1178N/AOBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
4033N/A
1178N/AGENERATEDNAMES = \
1178N/A ad_$(Platform_arch_model).cpp \
1178N/A ad_$(Platform_arch_model).hpp \
1178N/A ad_$(Platform_arch_model)_clone.cpp \
0N/A ad_$(Platform_arch_model)_expand.cpp \
1178N/A ad_$(Platform_arch_model)_format.cpp \
4033N/A ad_$(Platform_arch_model)_gen.cpp \
1178N/A ad_$(Platform_arch_model)_misc.cpp \
1178N/A ad_$(Platform_arch_model)_peephole.cpp \
1178N/A ad_$(Platform_arch_model)_pipeline.cpp \
1178N/A adGlobals_$(Platform_arch_model).hpp \
0N/A dfa_$(Platform_arch_model).cpp \
0N/A
4033N/AGENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
0N/A
0N/A# #########################################################################
0N/A
1178N/Aall: $(EXEC)
1178N/A
1178N/A$(EXEC) : $(OBJECTS)
4033N/A @echo Making adlc
1178N/A $(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
1178N/A
1178N/A# Random dependencies:
1178N/A$(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
0N/A
4033N/A# The source files refer to ostream.h, which sparcworks calls iostream.h
0N/A$(OBJECTS): ostream.h
0N/A
4033N/Aostream.h :
1178N/A @echo >$@ '#include <iostream.h>'
4033N/A
1178N/Adump:
4033N/A : OUTDIR=$(OUTDIR)
1178N/A : OBJECTS=$(OBJECTS)
4033N/A : products = $(GENERATEDFILES)
1178N/A
4033N/Aall: $(GENERATEDFILES)
1178N/A
1178N/A$(GENERATEDFILES): refresh_adfiles
4033N/A
1178N/A# Get a unique temporary directory name, so multiple makes can run in parallel.
1178N/A# Note that product files are updated via "mv", which is atomic.
4033N/ATEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
1178N/A
1178N/A# Pass -D flags into ADLC.
1178N/AADLCFLAGS += $(SYSDEFS)
1178N/A
1178N/A# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
4033N/AADLCFLAGS += -q -T
1178N/A
1178N/A# Normally, debugging is done directly on the ad_<arch>*.cpp files.
4033N/A# But -g will put #line directives in those files pointing back to <arch>.ad.
1178N/A#ADLCFLAGS += -g
1178N/A
4033N/Aifdef LP64
0N/AADLCFLAGS += -D_LP64
0N/Aelse
0N/AADLCFLAGS += -U_LP64
0N/Aendif
0N/A
0N/A#
0N/A# adlc_updater is a simple sh script, under sccs control. It is
0N/A# used to selectively update generated adlc files. This should
0N/A# provide a nice compilation speed improvement.
0N/A#
0N/AADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
4033N/AADLC_UPDATER = adlc_updater
0N/A$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
0N/A $(QUIETLY) cp $< $@; chmod +x $@
0N/A
0N/A# This action refreshes all generated adlc files simultaneously.
0N/A# The way it works is this:
0N/A# 1) create a scratch directory to work in.
0N/A# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
0N/A# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
0N/A# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
0N/A# 5) If we actually updated any files, echo a notice.
0N/A#
4033N/Arefresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
0N/A @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
0N/A $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
0N/A -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 \
0N/A || { rm -rf $(TEMPDIR); exit 1; }
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
0N/A $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
0N/A || echo "Rescanned $(SOURCE.AD) but encountered no changes."
4033N/A $(QUIETLY) rm -rf $(TEMPDIR)
0N/A
0N/A
0N/A# #########################################################################
0N/A
0N/A$(SOURCE.AD): $(SOURCES.AD)
0N/A $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
0N/A
0N/A#PROCESS_AD_FILES = cat
0N/A# Pass through #line directives, in case user enables -g option above:
0N/APROCESS_AD_FILES = awk '{ \
0N/A if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
4033N/A if (need_lineno && $$0 !~ /\/\//) \
1178N/A { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
0N/A print }'
4033N/A
1178N/A$(OUTDIR)/%.o: %.cpp
4033N/A @echo Compiling $<
0N/A $(QUIETLY) $(REMOVE_TARGET)
4033N/A $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
0N/A
4033N/A# Some object files are given a prefix, to disambiguate
0N/A# them from objects of the same name built for the VM.
0N/A$(OUTDIR)/adlc-%.o: %.cpp
4033N/A @echo Compiling $<
0N/A $(QUIETLY) $(REMOVE_TARGET)
1178N/A $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
4033N/A
0N/A# #########################################################################
0N/A
4033N/Aclean :
1178N/A rm $(OBJECTS)
4033N/A
0N/Acleanall :
4033N/A rm $(OBJECTS) $(EXEC)
1178N/A
0N/A# #########################################################################
4033N/A
1178N/A.PHONY: all dump refresh_adfiles clean cleanall
0N/A