make/bsd/makefiles/adlc.make

changeset 3156
f08d439fab8c
child 3202
436b4a3231bf
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/bsd/makefiles/adlc.make	Sun Sep 25 16:03:29 2011 -0700
     1.3 @@ -0,0 +1,226 @@
     1.4 +#
     1.5 +# Copyright (c) 1999, 2011, 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 +SOURCES.AD = \
    1.46 +  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
    1.47 +  $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
    1.48 +
    1.49 +EXEC	= $(OUTDIR)/adlc
    1.50 +
    1.51 +# set VPATH so make knows where to look for source files
    1.52 +Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc
    1.53 +VPATH += $(Src_Dirs_V:%=%:)
    1.54 +
    1.55 +# set INCLUDES for C preprocessor
    1.56 +Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)
    1.57 +INCLUDES += $(Src_Dirs_I:%=-I%)
    1.58 +
    1.59 +# set flags for adlc compilation
    1.60 +CPPFLAGS = $(SYSDEFS) $(INCLUDES)
    1.61 +
    1.62 +# Force assertions on.
    1.63 +CPPFLAGS += -DASSERT
    1.64 +
    1.65 +# CFLAGS_WARN holds compiler options to suppress/enable warnings.
    1.66 +# Compiler warnings are treated as errors
    1.67 +CFLAGS_WARN = -Werror
    1.68 +CFLAGS += $(CFLAGS_WARN)
    1.69 +
    1.70 +OBJECTNAMES = \
    1.71 +	adlparse.o \
    1.72 +	archDesc.o \
    1.73 +	arena.o \
    1.74 +	dfa.o \
    1.75 +	dict2.o \
    1.76 +	filebuff.o \
    1.77 +	forms.o \
    1.78 +	formsopt.o \
    1.79 +	formssel.o \
    1.80 +	main.o \
    1.81 +	adlc-opcodes.o \
    1.82 +	output_c.o \
    1.83 +	output_h.o \
    1.84 +
    1.85 +OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
    1.86 +
    1.87 +GENERATEDNAMES = \
    1.88 +        ad_$(Platform_arch_model).cpp \
    1.89 +        ad_$(Platform_arch_model).hpp \
    1.90 +        ad_$(Platform_arch_model)_clone.cpp \
    1.91 +        ad_$(Platform_arch_model)_expand.cpp \
    1.92 +        ad_$(Platform_arch_model)_format.cpp \
    1.93 +        ad_$(Platform_arch_model)_gen.cpp \
    1.94 +        ad_$(Platform_arch_model)_misc.cpp \
    1.95 +        ad_$(Platform_arch_model)_peephole.cpp \
    1.96 +        ad_$(Platform_arch_model)_pipeline.cpp \
    1.97 +        adGlobals_$(Platform_arch_model).hpp \
    1.98 +        dfa_$(Platform_arch_model).cpp \
    1.99 +
   1.100 +GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
   1.101 +
   1.102 +# #########################################################################
   1.103 +
   1.104 +all: $(EXEC)
   1.105 +
   1.106 +$(EXEC) : $(OBJECTS)
   1.107 +	@echo Making adlc
   1.108 +	$(QUIETLY) $(HOST.LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
   1.109 +
   1.110 +# Random dependencies:
   1.111 +$(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.112 +
   1.113 +# The source files refer to ostream.h, which sparcworks calls iostream.h
   1.114 +$(OBJECTS): ostream.h
   1.115 +
   1.116 +ostream.h :
   1.117 +	@echo >$@ '#include <iostream.h>'
   1.118 +
   1.119 +dump:
   1.120 +	: OUTDIR=$(OUTDIR)
   1.121 +	: OBJECTS=$(OBJECTS)
   1.122 +	: products = $(GENERATEDFILES)
   1.123 +
   1.124 +all: $(GENERATEDFILES)
   1.125 +
   1.126 +$(GENERATEDFILES): refresh_adfiles
   1.127 +
   1.128 +# Get a unique temporary directory name, so multiple makes can run in parallel.
   1.129 +# Note that product files are updated via "mv", which is atomic.
   1.130 +TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
   1.131 +
   1.132 +# Debuggable by default
   1.133 +CFLAGS += -g
   1.134 +
   1.135 +# Pass -D flags into ADLC.
   1.136 +ADLCFLAGS += $(SYSDEFS)
   1.137 +
   1.138 +# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
   1.139 +ADLCFLAGS += -q -T
   1.140 +
   1.141 +# Normally, debugging is done directly on the ad_<arch>*.cpp files.
   1.142 +# But -g will put #line directives in those files pointing back to <arch>.ad.
   1.143 +# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives
   1.144 +# so skip it for 3.2 and ealier.
   1.145 +ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   1.146 +ADLCFLAGS += -g
   1.147 +endif
   1.148 +
   1.149 +ifdef LP64
   1.150 +ADLCFLAGS += -D_LP64
   1.151 +else
   1.152 +ADLCFLAGS += -U_LP64
   1.153 +endif
   1.154 +
   1.155 +#
   1.156 +# adlc_updater is a simple sh script, under sccs control. It is
   1.157 +# used to selectively update generated adlc files. This should
   1.158 +# provide a nice compilation speed improvement.
   1.159 +#
   1.160 +ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
   1.161 +ADLC_UPDATER = adlc_updater
   1.162 +$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
   1.163 +	$(QUIETLY) cp $< $@; chmod +x $@
   1.164 +
   1.165 +# This action refreshes all generated adlc files simultaneously.
   1.166 +# The way it works is this:
   1.167 +# 1) create a scratch directory to work in.
   1.168 +# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
   1.169 +# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
   1.170 +# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
   1.171 +# 5) If we actually updated any files, echo a notice.
   1.172 +#
   1.173 +refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
   1.174 +	@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
   1.175 +	$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
   1.176 + -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.177 +	    || { rm -rf $(TEMPDIR); exit 1; }
   1.178 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
   1.179 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
   1.180 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
   1.181 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
   1.182 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
   1.183 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
   1.184 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
   1.185 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
   1.186 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
   1.187 +	$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
   1.188 +	$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
   1.189 +	$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
   1.190 +		|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
   1.191 +	$(QUIETLY) rm -rf $(TEMPDIR)
   1.192 +
   1.193 +
   1.194 +# #########################################################################
   1.195 +
   1.196 +$(SOURCE.AD): $(SOURCES.AD)
   1.197 +	$(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
   1.198 +
   1.199 +#PROCESS_AD_FILES = cat
   1.200 +# Pass through #line directives, in case user enables -g option above:
   1.201 +PROCESS_AD_FILES = awk '{ \
   1.202 +    if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
   1.203 +    if (need_lineno && $$0 !~ /\/\//) \
   1.204 +      { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
   1.205 +    print }'
   1.206 +
   1.207 +$(OUTDIR)/%.o: %.cpp
   1.208 +	@echo Compiling $<
   1.209 +	$(QUIETLY) $(REMOVE_TARGET)
   1.210 +	$(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
   1.211 +
   1.212 +# Some object files are given a prefix, to disambiguate
   1.213 +# them from objects of the same name built for the VM.
   1.214 +$(OUTDIR)/adlc-%.o: %.cpp
   1.215 +	@echo Compiling $<
   1.216 +	$(QUIETLY) $(REMOVE_TARGET)
   1.217 +	$(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
   1.218 +
   1.219 +# #########################################################################
   1.220 +
   1.221 +clean	:
   1.222 +	rm $(OBJECTS)
   1.223 +
   1.224 +cleanall :
   1.225 +	rm $(OBJECTS) $(EXEC)
   1.226 +
   1.227 +# #########################################################################
   1.228 +
   1.229 +.PHONY: all dump refresh_adfiles clean cleanall

mercurial