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