annotate make/bsd/makefiles/adlc.make @ 2796:f08d439fab8c

7089790: integrate bsd-port changes Reviewed-by: kvn, twisti, jrose Contributed-by: Kurt Miller <kurt@intricatesoftware.com>, Greg Lewis <glewis@eyesbeyond.com>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, Landon Fuller <landonf@plausible.coop>, The FreeBSD Foundation <board@freebsdfoundation.org>, Michael Franz <mvfranz@gmail.com>, Roger Hoover <rhoover@apple.com>, Alexander Strange <astrange@apple.com>
author never
date Sun, 25 Sep 2011 16:03:29 -0700
parents
children 436b4a3231bf
rev   line source
never@2796 1 #
never@2796 2 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
never@2796 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@2796 4 #
never@2796 5 # This code is free software; you can redistribute it and/or modify it
never@2796 6 # under the terms of the GNU General Public License version 2 only, as
never@2796 7 # published by the Free Software Foundation.
never@2796 8 #
never@2796 9 # This code is distributed in the hope that it will be useful, but WITHOUT
never@2796 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@2796 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@2796 12 # version 2 for more details (a copy is included in the LICENSE file that
never@2796 13 # accompanied this code).
never@2796 14 #
never@2796 15 # You should have received a copy of the GNU General Public License version
never@2796 16 # 2 along with this work; if not, write to the Free Software Foundation,
never@2796 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@2796 18 #
never@2796 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
never@2796 20 # or visit www.oracle.com if you need additional information or have any
never@2796 21 # questions.
never@2796 22 #
never@2796 23 #
never@2796 24
never@2796 25 # This makefile (adlc.make) is included from the adlc.make in the
never@2796 26 # build directories.
never@2796 27 # It knows how to compile, link, and run the adlc.
never@2796 28
never@2796 29 include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
never@2796 30
never@2796 31 # #########################################################################
never@2796 32
never@2796 33 # OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make:
never@2796 34 GENERATED = ../generated
never@2796 35 OUTDIR = $(GENERATED)/adfiles
never@2796 36
never@2796 37 ARCH = $(Platform_arch)
never@2796 38 OS = $(Platform_os_family)
never@2796 39
never@2796 40 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
never@2796 41
never@2796 42 SOURCES.AD = \
never@2796 43 $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
never@2796 44 $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
never@2796 45
never@2796 46 EXEC = $(OUTDIR)/adlc
never@2796 47
never@2796 48 # set VPATH so make knows where to look for source files
never@2796 49 Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc
never@2796 50 VPATH += $(Src_Dirs_V:%=%:)
never@2796 51
never@2796 52 # set INCLUDES for C preprocessor
never@2796 53 Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED)
never@2796 54 INCLUDES += $(Src_Dirs_I:%=-I%)
never@2796 55
never@2796 56 # set flags for adlc compilation
never@2796 57 CPPFLAGS = $(SYSDEFS) $(INCLUDES)
never@2796 58
never@2796 59 # Force assertions on.
never@2796 60 CPPFLAGS += -DASSERT
never@2796 61
never@2796 62 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
never@2796 63 # Compiler warnings are treated as errors
never@2796 64 CFLAGS_WARN = -Werror
never@2796 65 CFLAGS += $(CFLAGS_WARN)
never@2796 66
never@2796 67 OBJECTNAMES = \
never@2796 68 adlparse.o \
never@2796 69 archDesc.o \
never@2796 70 arena.o \
never@2796 71 dfa.o \
never@2796 72 dict2.o \
never@2796 73 filebuff.o \
never@2796 74 forms.o \
never@2796 75 formsopt.o \
never@2796 76 formssel.o \
never@2796 77 main.o \
never@2796 78 adlc-opcodes.o \
never@2796 79 output_c.o \
never@2796 80 output_h.o \
never@2796 81
never@2796 82 OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%)
never@2796 83
never@2796 84 GENERATEDNAMES = \
never@2796 85 ad_$(Platform_arch_model).cpp \
never@2796 86 ad_$(Platform_arch_model).hpp \
never@2796 87 ad_$(Platform_arch_model)_clone.cpp \
never@2796 88 ad_$(Platform_arch_model)_expand.cpp \
never@2796 89 ad_$(Platform_arch_model)_format.cpp \
never@2796 90 ad_$(Platform_arch_model)_gen.cpp \
never@2796 91 ad_$(Platform_arch_model)_misc.cpp \
never@2796 92 ad_$(Platform_arch_model)_peephole.cpp \
never@2796 93 ad_$(Platform_arch_model)_pipeline.cpp \
never@2796 94 adGlobals_$(Platform_arch_model).hpp \
never@2796 95 dfa_$(Platform_arch_model).cpp \
never@2796 96
never@2796 97 GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%)
never@2796 98
never@2796 99 # #########################################################################
never@2796 100
never@2796 101 all: $(EXEC)
never@2796 102
never@2796 103 $(EXEC) : $(OBJECTS)
never@2796 104 @echo Making adlc
never@2796 105 $(QUIETLY) $(HOST.LINK_NOPROF.CC) -o $(EXEC) $(OBJECTS)
never@2796 106
never@2796 107 # Random dependencies:
never@2796 108 $(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
never@2796 109
never@2796 110 # The source files refer to ostream.h, which sparcworks calls iostream.h
never@2796 111 $(OBJECTS): ostream.h
never@2796 112
never@2796 113 ostream.h :
never@2796 114 @echo >$@ '#include <iostream.h>'
never@2796 115
never@2796 116 dump:
never@2796 117 : OUTDIR=$(OUTDIR)
never@2796 118 : OBJECTS=$(OBJECTS)
never@2796 119 : products = $(GENERATEDFILES)
never@2796 120
never@2796 121 all: $(GENERATEDFILES)
never@2796 122
never@2796 123 $(GENERATEDFILES): refresh_adfiles
never@2796 124
never@2796 125 # Get a unique temporary directory name, so multiple makes can run in parallel.
never@2796 126 # Note that product files are updated via "mv", which is atomic.
never@2796 127 TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
never@2796 128
never@2796 129 # Debuggable by default
never@2796 130 CFLAGS += -g
never@2796 131
never@2796 132 # Pass -D flags into ADLC.
never@2796 133 ADLCFLAGS += $(SYSDEFS)
never@2796 134
never@2796 135 # Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO.
never@2796 136 ADLCFLAGS += -q -T
never@2796 137
never@2796 138 # Normally, debugging is done directly on the ad_<arch>*.cpp files.
never@2796 139 # But -g will put #line directives in those files pointing back to <arch>.ad.
never@2796 140 # Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives
never@2796 141 # so skip it for 3.2 and ealier.
never@2796 142 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
never@2796 143 ADLCFLAGS += -g
never@2796 144 endif
never@2796 145
never@2796 146 ifdef LP64
never@2796 147 ADLCFLAGS += -D_LP64
never@2796 148 else
never@2796 149 ADLCFLAGS += -U_LP64
never@2796 150 endif
never@2796 151
never@2796 152 #
never@2796 153 # adlc_updater is a simple sh script, under sccs control. It is
never@2796 154 # used to selectively update generated adlc files. This should
never@2796 155 # provide a nice compilation speed improvement.
never@2796 156 #
never@2796 157 ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS)
never@2796 158 ADLC_UPDATER = adlc_updater
never@2796 159 $(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER)
never@2796 160 $(QUIETLY) cp $< $@; chmod +x $@
never@2796 161
never@2796 162 # This action refreshes all generated adlc files simultaneously.
never@2796 163 # The way it works is this:
never@2796 164 # 1) create a scratch directory to work in.
never@2796 165 # 2) if the current working directory does not have $(ADLC_UPDATER), copy it.
never@2796 166 # 3) run the compiled adlc executable. This will create new adlc files in the scratch directory.
never@2796 167 # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files.
never@2796 168 # 5) If we actually updated any files, echo a notice.
never@2796 169 #
never@2796 170 refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER)
never@2796 171 @rm -rf $(TEMPDIR); mkdir $(TEMPDIR)
never@2796 172 $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \
never@2796 173 -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 \
never@2796 174 || { rm -rf $(TEMPDIR); exit 1; }
never@2796 175 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
never@2796 176 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
never@2796 177 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR)
never@2796 178 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR)
never@2796 179 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR)
never@2796 180 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR)
never@2796 181 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR)
never@2796 182 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR)
never@2796 183 $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR)
never@2796 184 $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR)
never@2796 185 $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR)
never@2796 186 $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \
never@2796 187 || echo "Rescanned $(SOURCE.AD) but encountered no changes."
never@2796 188 $(QUIETLY) rm -rf $(TEMPDIR)
never@2796 189
never@2796 190
never@2796 191 # #########################################################################
never@2796 192
never@2796 193 $(SOURCE.AD): $(SOURCES.AD)
never@2796 194 $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD)
never@2796 195
never@2796 196 #PROCESS_AD_FILES = cat
never@2796 197 # Pass through #line directives, in case user enables -g option above:
never@2796 198 PROCESS_AD_FILES = awk '{ \
never@2796 199 if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
never@2796 200 if (need_lineno && $$0 !~ /\/\//) \
never@2796 201 { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
never@2796 202 print }'
never@2796 203
never@2796 204 $(OUTDIR)/%.o: %.cpp
never@2796 205 @echo Compiling $<
never@2796 206 $(QUIETLY) $(REMOVE_TARGET)
never@2796 207 $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
never@2796 208
never@2796 209 # Some object files are given a prefix, to disambiguate
never@2796 210 # them from objects of the same name built for the VM.
never@2796 211 $(OUTDIR)/adlc-%.o: %.cpp
never@2796 212 @echo Compiling $<
never@2796 213 $(QUIETLY) $(REMOVE_TARGET)
never@2796 214 $(QUIETLY) $(HOST.COMPILE.CC) -o $@ $< $(COMPILE_DONE)
never@2796 215
never@2796 216 # #########################################################################
never@2796 217
never@2796 218 clean :
never@2796 219 rm $(OBJECTS)
never@2796 220
never@2796 221 cleanall :
never@2796 222 rm $(OBJECTS) $(EXEC)
never@2796 223
never@2796 224 # #########################################################################
never@2796 225
never@2796 226 .PHONY: all dump refresh_adfiles clean cleanall