annotate make/StripBinaries.gmk @ 39428:24cb2cb4ae0b

8159149: Several compiler tests fail with minimal VM Reviewed-by: kvn, psandoz
author iignatyev
date Thu, 16 Jun 2016 01:43:11 +0300
parents aeaa6d0101a8
children
rev   line source
chegar@27560 1 #
ihse@35747 2 # Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
chegar@27560 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
chegar@27560 4 #
chegar@27560 5 # This code is free software; you can redistribute it and/or modify it
chegar@27560 6 # under the terms of the GNU General Public License version 2 only, as
chegar@27560 7 # published by the Free Software Foundation. Oracle designates this
chegar@27560 8 # particular file as subject to the "Classpath" exception as provided
chegar@27560 9 # by Oracle in the LICENSE file that accompanied this code.
chegar@27560 10 #
chegar@27560 11 # This code is distributed in the hope that it will be useful, but WITHOUT
chegar@27560 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
chegar@27560 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
chegar@27560 14 # version 2 for more details (a copy is included in the LICENSE file that
chegar@27560 15 # accompanied this code).
chegar@27560 16 #
chegar@27560 17 # You should have received a copy of the GNU General Public License version
chegar@27560 18 # 2 along with this work; if not, write to the Free Software Foundation,
chegar@27560 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
chegar@27560 20 #
chegar@27560 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
chegar@27560 22 # or visit www.oracle.com if you need additional information or have any
chegar@27560 23 # questions.
chegar@27560 24 #
chegar@27560 25
chegar@27560 26 default: all
chegar@27560 27
chegar@27560 28 include $(SPEC)
chegar@27560 29 include MakeBase.gmk
chegar@27560 30
erikj@31310 31 # Hook to include the corresponding custom file, if present.
erikj@31310 32 $(eval $(call IncludeCustomExtension, , StripBinaries.gmk))
erikj@31310 33
chegar@27560 34 ################################################################################
chegar@27560 35 # Copy native libraries and executables to a secondary location to strip them
chegar@27560 36 # and filter out files that shouldn't go into the image.
chegar@27560 37
chegar@27560 38 MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
chegar@27560 39 MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
chegar@27560 40
erikj@32811 41 ifneq ($(STRIP), )
chegar@27560 42 define StripRecipe
erikj@35008 43 $(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
erikj@35008 44 $(call MakeDir, $(@D))
chegar@27560 45 $(CP) $< $@.tmp
chegar@27560 46 $(CHMOD) u+w $@.tmp
erikj@32811 47 $(STRIP) $(STRIPFLAGS) $@.tmp
chegar@27560 48 $(CHMOD) go-w $@.tmp
chegar@27560 49 $(MV) $@.tmp $@
chegar@27560 50 endef
chegar@27560 51 else
chegar@27560 52 define StripRecipe
chegar@27560 53 $(call install-file)
chegar@27560 54 endef
chegar@27560 55 endif
chegar@27560 56
erikj@31310 57 NO_STRIP_CMDS_FILTER += %.cgi
erikj@31310 58
chegar@27560 59 # Don't include debug info for executables.
alanb@36506 60 ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)), )
alanb@36506 61 # OS X stores symbol information in a .dylib file inside a .dSYM directory -
alanb@36506 62 # that file should not be stripped, so we prune the tree at the .dSYM directory.
alanb@36506 63 ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \
alanb@36506 64 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) \( -type f -o -type l \) \
alanb@36506 65 -print -o -name "*.dSYM" -prune))
alanb@36506 66 COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
alanb@36506 67 STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
alanb@36506 68 endif
ihse@35747 69
alanb@36506 70 ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)), )
alanb@36506 71 # OS X stores symbol information in a .dylib file inside a .dSYM directory -
alanb@36506 72 # that file should not be stripped, so we prune the tree at the .dSYM directory.
alanb@36506 73 # Example: support/modules_libs/java.base/libjsig.dylib.dSYM/Contents/Resources/DWARF/libjsig.dylib
alanb@36506 74 STRIP_LIBS_SRC := \
alanb@36506 75 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) \
alanb@36506 76 -name '*$(SHARED_LIBRARY_SUFFIX)' -type f -print -o -name "*.dSYM" -prune)
chegar@27560 77
alanb@36506 78 # Make sure symbolic links are copied and not stripped.
alanb@36506 79 COPY_LIBS_SRC := \
alanb@36506 80 $(filter-out $(STRIP_LIBS_SRC), \
alanb@36506 81 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) -type f -o -type l))
alanb@36506 82 endif
chegar@27560 83
chegar@27560 84 $(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
chegar@27560 85 SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
chegar@27560 86 DEST := $(MODULES_CMDS_STRIPPED), \
chegar@27560 87 FILES := $(STRIP_CMDS_SRC), \
chegar@27560 88 MACRO := StripRecipe))
chegar@27560 89
chegar@27560 90 $(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
chegar@27560 91 SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
chegar@27560 92 DEST := $(MODULES_CMDS_STRIPPED), \
chegar@27560 93 FILES := $(COPY_CMDS_SRC)))
chegar@27560 94
chegar@27560 95 $(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
chegar@27560 96 SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
chegar@27560 97 DEST := $(MODULES_LIBS_STRIPPED), \
chegar@27560 98 FILES := $(STRIP_LIBS_SRC), \
chegar@27560 99 MACRO := StripRecipe))
chegar@27560 100
chegar@27560 101 $(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
chegar@27560 102 SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
chegar@27560 103 DEST := $(MODULES_LIBS_STRIPPED), \
chegar@27560 104 FILES := $(COPY_LIBS_SRC)))
chegar@27560 105
chegar@27560 106 TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
chegar@27560 107 $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
chegar@27560 108
chegar@27560 109 all: $(TARGETS)