Makefile revision 0
0N/A#
0N/A# Copyright 2000-2005 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. Sun designates this
0N/A# particular file as subject to the "Classpath" exception as provided
0N/A# by Sun in the LICENSE file that accompanied this code.
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.
0N/A#
0N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A# CA 95054 USA or visit www.sun.com if you need additional information or
0N/A# have any questions.
0N/A#
0N/A
0N/A# This Makefile is intended to produce new reordering files for the
0N/A# reordering of jar files and shared libraries. This is not part of the
0N/A# standard build. The objects produced by this Makefile must be copied
0N/A# into their standard locations and checked in.
0N/A
0N/ABUILDDIR = ../..
0N/APACKAGE = tools.reorder
0N/APRODUCT = tools
0N/Ainclude $(BUILDDIR)/common/Defs.gmk
0N/A
0N/AOUTDIR = $(OUTPUTDIR)/reorder
0N/APRELOAD_DIR = $(ABS_OUTPUTDIR)/reorder/$(ARCH)
0N/A
0N/Aifeq ($(PLATFORM), windows)
0N/ASEP = \\
0N/Aelse
0N/ASEP = /
0N/Aendif
0N/A
0N/ACLASSDIR = $(OUTDIR)/classes
0N/AOBJDIR = $(OUTDIR)/$(ARCH)
0N/ATESTS = Null Exit Hello Sleep IntToString \
0N/A LoadToolkit LoadFrame LoadJFrame JHello
0N/ATEST_CLASSES = $(TESTS:%=$(CLASSDIR)/%.class)
0N/ASWINGSET2 = $(OUTPUTDIR)/demo/jfc/SwingSet2/SwingSet2.jar
0N/A
0N/A# Run java from the JRE image because using rt.jar requires a
0N/A# larger list of classes, and these should appear in the list.
0N/A# FIXUP: adding rt.jar into bootclasspath?
0N/AJRE_LIB = $(JRE_IMAGE_DIR)/lib
0N/ABOOTPATH = -Xbootclasspath:$(JRE_LIB)/rt.jar:$(JRE_LIB)/charsets.jar
0N/AJRE_JAVA = $(JRE_IMAGE_DIR)/bin/java
0N/A
0N/AJAVA_BIN = $(BINDIR)/java
0N/A
0N/Aall : jars.reorder libs.reorder
0N/A
0N/Atools : $(OBJDIR) $(OBJDIR)/libmcount.so $(OBJDIR)/remove_mcount
0N/A
0N/Acopy : jars.copy libs.copy
0N/A
0N/Aclean :
0N/A $(RM) $(REORDER_JAR)
0N/A
0N/Aclobber : clean
0N/A $(RM) -r $(OUTDIR)
0N/A
0N/A
0N/Ajars.reorder :
0N/A $(MAKE) JARFILE=rt.jar reorder.jar
0N/A $(MAKE) JARFILE=charsets.jar reorder.jar
0N/A
0N/Ajars.copy:
0N/A $(CP) $(OUTDIR)/reorder_rt_jar-$(PLATFORM) reorder_rt_jar-$(PLATFORM)
0N/A $(CP) $(OUTDIR)/reorder_charsets_jar-$(PLATFORM) reorder_charsets_jar-$(PLATFORM)
0N/A
0N/AREORDER_JAR = $(OUTDIR)/reorder_$(subst .,_,$(JARFILE))-$(PLATFORM)
0N/Areorder.jar : $(REORDER_JAR)
0N/A
0N/Alibs.reorder :
0N/Aifeq ($(PLATFORM), solaris)
0N/A $(MAKE) LIBBLDDIR=java/zip LIBTMPDIR=sun/java.util.zip/zip reorder.lib
0N/A $(MAKE) LIBBLDDIR=java/hpi/native LIBTMPDIR=java/hpi/native_threads reorder.lib
0N/A $(MAKE) LIBBLDDIR=java/java LIBTMPDIR=java/java.lang/java reorder.lib
0N/A $(MAKE) LIBBLDDIR=java/nio LIBTMPDIR=java/java.nio/nio reorder.lib
0N/A $(MAKE) LIBBLDDIR=sun/font LIBTMPDIR=sun/sun.awt.font/fontmanager reorder.lib
0N/A $(MAKE) LIBBLDDIR=sun/jpeg LIBTMPDIR=sun/sun.awt/jpeg reorder.lib
0N/A $(MAKE) LIBBLDDIR=java/verify LIBTMPDIR=java/verify reorder.lib
0N/Aendif
0N/A
0N/Alibs.copy:
0N/Aifeq ($(PLATFORM), solaris)
0N/A $(CP) $(OUTDIR)/reorder_java_zip-$(ARCH) ../../java/zip/reorder-$(ARCH)
0N/A $(CP) $(OUTDIR)/reorder_java_hpi_native-$(ARCH) ../../java/hpi/native/reorder-$(ARCH)
0N/A $(CP) $(OUTDIR)/reorder_java_java-$(ARCH) ../../java/java/reorder-$(ARCH)
0N/A $(CP) $(OUTDIR)/reorder_sun_font-$(ARCH) ../../sun/font/reorder-$(ARCH)
0N/A $(CP) $(OUTDIR)/reorder_sun_jpeg-$(ARCH) ../../sun/jpeg/reorder-$(ARCH)
0N/A $(CP) $(OUTDIR)/reorder_java_verify-$(ARCH) ../../java/verify/reorder-$(ARCH)
0N/Aendif
0N/A
0N/AREORDER_LIB = $(OUTDIR)/reorder_$(subst /,_,$(LIBBLDDIR))-$(ARCH)
0N/Areorder.lib : $(OBJDIR) $(REORDER_LIB)
0N/A
0N/A
0N/A# This target 'test_classes' also used by hotspot reordering.
0N/Atest_classes : $(TEST_CLASSES)
0N/A
0N/A# This target 'tool_classes' also used by hotspot reordering.
0N/Atool_classes : $(CLASSDIR) $(CLASSDIR)/Combine.class $(CLASSDIR)/MaxTime.class
0N/A
0N/A$(REORDER_JAR) : $(CLASSDIR) test_classes tool_classes
0N/A $(RM) $(REORDER_JAR)
0N/A
0N/A @$(ECHO) "# Ordered list of files to include in $(JARFILE)." > $(REORDER_JAR)
0N/A @$(ECHO) "# This is a generated file - do not edit." >> $(REORDER_JAR)
0N/A @$(ECHO) "#" >> $(REORDER_JAR)
0N/A
0N/A @# Run each of a set of tests, extract the classes required and
0N/A @# append the new classes to the ClassList.
0N/A
0N/A @for f in $(TESTS) ; do \
0N/A $(ECHO) Running test $$f.; \
0N/A $(RM) $(REORDER_JAR)_tmp1; \
0N/A echo "# Test $$f" >> $(REORDER_JAR); \
0N/A $(JRE_JAVA) -verbose -classpath $(CLASSDIR) $$f | \
0N/A $(SED) -n -e 's=\[Loaded \(.*\) from .*$(SEP)lib$(SEP)$(JARFILE)]=\1=p' | \
0N/A $(SED) -e 's=\.=/=g' -e 's=$$=.class=' \
0N/A > $(REORDER_JAR)_tmp1; \
0N/A $(JRE_JAVA) -classpath $(CLASSDIR) Combine \
0N/A $(REORDER_JAR) $(REORDER_JAR)_tmp1 \
0N/A > $(REORDER_JAR)_tmp2; \
0N/A $(MV) $(REORDER_JAR)_tmp2 $(REORDER_JAR); \
0N/A $(RM) $(REORDER_JAR)_tmp1; \
0N/A done
0N/A
0N/A @# Run SwingSet2, extract the classes required and
0N/A @# append the new classes to the ClassList.
0N/A
0N/A @$(RM) $(REORDER_JAR)_tmp1
0N/A @$(RM) $(REORDER_JAR)_tmp2
0N/A @$(ECHO) "# SwingSet2" >> $(REORDER_JAR)
0N/A
0N/A @$(ECHO) ""
0N/A @$(ECHO) ""
0N/A @$(ECHO) "When SwingSet2 has finished drawing, " \
0N/A "you may terminate it (with your mouse)."
0N/A @$(ECHO) "Otherwise, it should be automatically terminated in 2 minutes."
0N/A @$(ECHO) ""
0N/A @$(ECHO) ""
0N/A
0N/A $(JRE_JAVA) -verbose -classpath $(CLASSDIR) MaxTime $(SWINGSET2) 120 \
0N/A > $(REORDER_JAR)_tmp2
0N/A
0N/A $(SED) -n -e 's=\[Loaded \(.*\) from .*$(SEP)lib$(SEP)$(JARFILE)]=\1=p' \
0N/A < $(REORDER_JAR)_tmp2 | \
0N/A $(SED) -e 's=\.=/=g' -e 's=$$=.class=' > $(REORDER_JAR)_tmp1
0N/A
0N/A $(RM) $(REORDER_JAR)_tmp2
0N/A $(JRE_JAVA) -classpath $(CLASSDIR) Combine \
0N/A $(REORDER_JAR) $(REORDER_JAR)_tmp1 > $(REORDER_JAR)_tmp2
0N/A $(MV) $(REORDER_JAR)_tmp2 $(REORDER_JAR)
0N/A $(RM) $(REORDER_JAR)_tmp1
0N/A
0N/A$(CLASSDIR) :
0N/A $(MKDIR) -p $(CLASSDIR)
0N/A
0N/A$(CLASSDIR)/%.class : tools/%.java
0N/A $(JAVAC_CMD) -d $(CLASSDIR) $<
0N/A$(CLASSDIR)/%.class : tests/%.java
0N/A $(JAVAC_CMD) -d $(CLASSDIR) $<
0N/A
0N/A$(OBJDIR) :
0N/A $(MKDIR) -p $(OBJDIR)
0N/A
0N/A
0N/AMCOUNT_SRC = mcount.c
0N/AMCOUNT_OBJ = $(MCOUNT_SRC:%.c=$(OBJDIR)/%.o)
0N/Avpath %.c tools
0N/A
0N/A$(OBJDIR)/%.o : %.c tools/util-$(ARCH).il
0N/A $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $^
0N/A
0N/A# This library 'libmcount.so' also used by hotspot reordering.
0N/A$(OBJDIR)/libmcount.so : $(MCOUNT_OBJ)
0N/A $(CC) -G -mt -zdefs -o $@ $^ -ldl -lelf $(EXTRA_LIBS)
0N/A
0N/A# This library 'libmcount.so' also used by hotspot reordering.
0N/A$(OBJDIR)/remove_mcount : remove_mcount.c
0N/A $(CC) -g -o $@ $^ -ldl -lelf $(EXTRA_LIBS)
0N/A
0N/A
0N/A# Reorder libraries.
0N/A# + Delete all of the library's object files, and recompile them for profiling.
0N/A# + Run the test sequence using libmcount to produce the mapfile.
0N/A# + Delete all of the library's object files, and recompile them normally.
0N/A
0N/A$(REORDER_LIB): $(OBJDIR)/libmcount.so $(OBJDIR)/remove_mcount \
0N/A test_classes tool_classes
0N/A
0N/Aifeq ($(ARCH), i586)
0N/A @# On Solaris-i586 we need to remove the symbol _mcount from the command
0N/A $(OBJDIR)/remove_mcount $(BINDIR)/java
0N/Aendif
0N/A
0N/A $(RM) $(OUTPUTDIR)/tmp/$(LIBTMPDIR)/$(OBJDIRNAME)/*.o
0N/A $(CD) $(BUILDDIR)/$(LIBBLDDIR) ; \
0N/A $(MAKE) PARTIAL_GPROF=true LDNOMAP=true NO_ROBOT=true all
0N/A
0N/A $(RM) $(REORDER_LIB)
0N/A @$(ECHO) "data = R0x2000;" > $(REORDER_LIB)
0N/A @$(ECHO) "text = LOAD ?RXO;" >> $(REORDER_LIB)
0N/A
0N/A @# Run each of a set of tests, extract the classes required and
0N/A @# append the new classes to the ClassList.
0N/A
0N/A for f in $(TESTS) ; do \
0N/A $(ECHO) Running test $$f.; \
0N/A $(RM) $(REORDER_LIB)_tmp1; \
0N/A $(ECHO) "# Test $$f" >> $(REORDER_LIB); \
0N/A LD_PRELOAD=$(PRELOAD_DIR)/libmcount.so \
0N/A $(SETENV) \
0N/A $(JAVA_BIN) $(BOOTPATH) -classpath $(CLASSDIR) $$f \
0N/A 2> $(REORDER_LIB)_tmp1; \
0N/A $(SED) -n -e 's=[./]*$(OUTPUTDIR)=OUTPUTDIR=' -e '/^text:/p' \
0N/A $(REORDER_LIB)_tmp1 > $(REORDER_LIB)_tmp2; \
0N/A $(SED) -e '/^text:/d' $(REORDER_LIB)_tmp1; \
0N/A $(JRE_JAVA) -classpath $(CLASSDIR) Combine \
0N/A $(REORDER_LIB) $(REORDER_LIB)_tmp2 \
0N/A > $(REORDER_LIB)_tmp3; \
0N/A $(MV) $(REORDER_LIB)_tmp3 $(REORDER_LIB); \
0N/A $(RM) $(REORDER_LIB)_tmp2; \
0N/A $(RM) $(REORDER_LIB)_tmp1; \
0N/A done
0N/A
0N/A @# Run SwingSet2, extract the classes required and
0N/A @# append the new classes to the ClassList.
0N/A
0N/A @$(RM) $(REORDER_LIB)_tmp1
0N/A @$(RM) $(REORDER_JAR)_tmp2
0N/A @$(ECHO) "# SwingSet2" >> $(REORDER_LIB)
0N/A
0N/A @$(ECHO) ""
0N/A @$(ECHO) ""
0N/A @$(ECHO) "When SwingSet2 has finished drawing, " \
0N/A "you may terminate it (with your mouse)."
0N/A @$(ECHO) "Otherwise, it should be automatically terminated in 2 minutes."
0N/A @$(ECHO) ""
0N/A @$(ECHO) ""
0N/A
0N/A LD_PRELOAD=$(PRELOAD_DIR)/libmcount.so \
0N/A $(SETENV) \
0N/A $(JAVA_BIN) $(BOOTPATH) -classpath $(CLASSDIR) MaxTime \
0N/A $(SWINGSET2) 120 2> $(REORDER_LIB)_tmp1
0N/A
0N/A $(SED) -n -e 's=[./]*$(OUTPUTDIR)=OUTPUTDIR=' -e '/^text:/p' \
0N/A $(REORDER_LIB)_tmp1 > $(REORDER_LIB)_tmp2
0N/A $(SED) -e '/^text:/d' $(REORDER_LIB)_tmp1
0N/A $(JRE_JAVA) -classpath $(CLASSDIR) Combine \
0N/A $(REORDER_LIB) $(REORDER_LIB)_tmp2 \
0N/A > $(REORDER_LIB)_tmp3
0N/A $(MV) $(REORDER_LIB)_tmp3 $(REORDER_LIB)
0N/A $(RM) $(REORDER_LIB)_tmp2
0N/A $(RM) $(REORDER_LIB)_tmp1
0N/A
0N/A $(RM) $(OUTPUTDIR)/tmp/$(LIBTMPDIR)/$(OBJDIRNAME)/*.o
0N/A $(CD) $(BUILDDIR)/$(LIBBLDDIR) ; $(MAKE) all
0N/A
0N/A.PHONY: test_classes tool_classes