make/linux/makefiles/adlc.make

changeset 526
a294fd0c4b38
parent 435
a61af66fc99e
child 631
d1605aabd0a1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/linux/makefiles/adlc.make	Wed Apr 09 14:22:48 2008 -0400
     1.3 @@ -0,0 +1,201 @@
     1.4 +#
     1.5 +# Copyright 1999-2006 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 +# have any 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 = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
    1.46 +	     $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad 
    1.47 +
    1.48 +Src_Dirs += $(GAMMADIR)/src/share/vm/adlc
    1.49 +
    1.50 +EXEC	= $(OUTDIR)/adlc
    1.51 +
    1.52 +# set VPATH so make knows where to look for source files
    1.53 +Src_Dirs_V = ${Src_Dirs} $(GENERATED)/incls
    1.54 +VPATH    += $(Src_Dirs_V:%=%:)
    1.55 +
    1.56 +# set INCLUDES for C preprocessor
    1.57 +Src_Dirs_I = ${Src_Dirs} $(GENERATED)
    1.58 +INCLUDES += $(Src_Dirs_I:%=-I%)
    1.59 +
    1.60 +# Force assertions on.
    1.61 +SYSDEFS += -DASSERT
    1.62 +CPPFLAGS = $(SYSDEFS) $(INCLUDES)
    1.63 +
    1.64 +# CFLAGS_WARN holds compiler options to suppress/enable warnings.
    1.65 +# Suppress warnings (for now)
    1.66 +CFLAGS_WARN = -w
    1.67 +CFLAGS += $(CFLAGS_WARN)
    1.68 +
    1.69 +OBJECTNAMES = \
    1.70 +	adlparse.o \
    1.71 +	archDesc.o \
    1.72 +	arena.o \
    1.73 +	dfa.o \
    1.74 +	dict2.o \
    1.75 +	filebuff.o \
    1.76 +	forms.o \
    1.77 +	formsopt.o \
    1.78 +	formssel.o \
    1.79 +	main.o \
    1.80 +	adlc-opcodes.o \
    1.81 +	output_c.o \
    1.82 +	output_h.o \
    1.83 +
    1.84 +OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
    1.85 +
    1.86 +GENERATEDNAMES = \
    1.87 +        ad_$(Platform_arch_model).cpp \
    1.88 +        ad_$(Platform_arch_model).hpp \
    1.89 +        ad_$(Platform_arch_model)_clone.cpp \
    1.90 +        ad_$(Platform_arch_model)_expand.cpp \
    1.91 +        ad_$(Platform_arch_model)_format.cpp \
    1.92 +        ad_$(Platform_arch_model)_gen.cpp \
    1.93 +        ad_$(Platform_arch_model)_misc.cpp \
    1.94 +        ad_$(Platform_arch_model)_peephole.cpp \
    1.95 +        ad_$(Platform_arch_model)_pipeline.cpp \
    1.96 +        adGlobals_$(Platform_arch_model).hpp \
    1.97 +        dfa_$(Platform_arch_model).cpp \
    1.98 +
    1.99 +GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
   1.100 +
   1.101 +# #########################################################################
   1.102 +
   1.103 +all: $(EXEC)
   1.104 +
   1.105 +$(EXEC) : $(OBJECTS)
   1.106 +	@echo Making adlc
   1.107 +	$(QUIETLY) $(LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
   1.108 +
   1.109 +# Random dependencies:
   1.110 +$(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.111 +
   1.112 +# The source files refer to ostream.h, which sparcworks calls iostream.h
   1.113 +$(OBJECTS): ostream.h
   1.114 +
   1.115 +ostream.h :
   1.116 +	@echo >$@ '#include <iostream.h>'
   1.117 +
   1.118 +dump:
   1.119 +	: OUTDIR=$(OUTDIR)
   1.120 +	: OBJECTS=$(OBJECTS)
   1.121 +	: products = $(GENERATEDFILES)
   1.122 +
   1.123 +all: $(GENERATEDFILES)
   1.124 +
   1.125 +$(GENERATEDFILES): refresh_adfiles
   1.126 +
   1.127 +# Get a unique temporary directory name, so multiple makes can run in parallel.
   1.128 +# Note that product files are updated via "mv", which is atomic.
   1.129 +TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
   1.130 +
   1.131 +ADLCFLAGS = -q -T
   1.132 +
   1.133 +ifdef LP64
   1.134 +ADLCFLAGS += -D_LP64
   1.135 +else
   1.136 +ADLCFLAGS += -U_LP64
   1.137 +endif
   1.138 +
   1.139 +#
   1.140 +# adlc_updater is a simple sh script, under sccs control. It is
   1.141 +# used to selectively update generated adlc files. This should
   1.142 +# provide a nice compilation speed improvement.
   1.143 +#
   1.144 +ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
   1.145 +ADLC_UPDATER = adlc_updater
   1.146 +
   1.147 +# This action refreshes all generated adlc files simultaneously.
   1.148 +# The way it works is this:
   1.149 +# 1) create a scratch directory to work in.
   1.150 +# 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
   1.151 +# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
   1.152 +# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
   1.153 +# 5) If we actually updated any files, echo a notice.
   1.154 +#
   1.155 +refresh_adfiles: $(EXEC) $(SOURCE.AD)
   1.156 +	@rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
   1.157 +	$(QUIETLY) [ -f $(ADLC_UPDATER) ] || ( cp $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) . ; chmod +x $(ADLC_UPDATER) )
   1.158 +	$(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
   1.159 + -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.160 +	    || { rm -rf $(TEMPDIR); exit 1; }
   1.161 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
   1.162 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
   1.163 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
   1.164 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
   1.165 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
   1.166 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
   1.167 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
   1.168 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
   1.169 +	$(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
   1.170 +	$(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
   1.171 +	$(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
   1.172 +	$(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
   1.173 +		|| echo "Rescanned $(SOURCE.AD) but encountered no changes."
   1.174 +	$(QUIETLY) rm -rf $(TEMPDIR)
   1.175 +
   1.176 +
   1.177 +# #########################################################################
   1.178 +
   1.179 +$(SOURCE.AD): $(SOURCES.AD)
   1.180 +	$(QUIETLY) cat $(SOURCES.AD) > $(SOURCE.AD)
   1.181 +
   1.182 +$(OUTDIR)/%.o: %.cpp
   1.183 +	@echo Compiling $<
   1.184 +	$(QUIETLY) $(REMOVE_TARGET)
   1.185 +	$(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
   1.186 +
   1.187 +# Some object files are given a prefix, to disambiguate
   1.188 +# them from objects of the same name built for the VM.
   1.189 +$(OUTDIR)/adlc-%.o: %.cpp
   1.190 +	@echo Compiling $<
   1.191 +	$(QUIETLY) $(REMOVE_TARGET)
   1.192 +	$(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
   1.193 +
   1.194 +# #########################################################################
   1.195 +
   1.196 +clean	:
   1.197 +	rm $(OBJECTS)
   1.198 +
   1.199 +cleanall :
   1.200 +	rm $(OBJECTS) $(EXEC)
   1.201 +
   1.202 +# #########################################################################
   1.203 +
   1.204 +.PHONY: all dump refresh_adfiles clean cleanall

mercurial