annotate make/StripBinaries.gmk @ 32811:df82db312e58

8135060: Stop building Xcode projects in install build Reviewed-by: ihse, pbhat, dmalav
author erikj
date Mon, 28 Sep 2015 15:51:29 +0200
parents 74e504d86cc9
children ef0cd710989f
rev   line source
chegar@27560 1 #
chegar@27560 2 # Copyright (c) 2014, 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
chegar@27560 43 $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
chegar@27560 44 $(MKDIR) -p $(@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.
ihse@28814 60 ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \
chegar@27560 61 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
erikj@31310 62 COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
erikj@31310 63 STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
chegar@27560 64
sla@30853 65 # OS X stores symbol information in a .dylib file inside a .dSYM directory -
sla@30853 66 # that file should not be stripped, so we prune the tree at the .dSYM directory.
sla@30853 67 # Example: support/modules_libs/java.base/libjsig.dylib.dSYM/Contents/Resources/DWARF/libjsig.dylib
chegar@27560 68 STRIP_LIBS_SRC := \
chegar@27560 69 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
sla@30853 70 -name '*$(SHARED_LIBRARY_SUFFIX)' -type f -print -o -name "*.dSYM" -prune)
erikj@31305 71 # Make sure symbolic links are copied and not stripped.
erikj@31305 72 COPY_LIBS_SRC := \
erikj@31305 73 $(filter-out $(STRIP_LIBS_SRC), \
erikj@31305 74 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs -type f -o -type l))
chegar@27560 75
chegar@27560 76 $(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
chegar@27560 77 SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
chegar@27560 78 DEST := $(MODULES_CMDS_STRIPPED), \
chegar@27560 79 FILES := $(STRIP_CMDS_SRC), \
chegar@27560 80 MACRO := StripRecipe))
chegar@27560 81
chegar@27560 82 $(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
chegar@27560 83 SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
chegar@27560 84 DEST := $(MODULES_CMDS_STRIPPED), \
chegar@27560 85 FILES := $(COPY_CMDS_SRC)))
chegar@27560 86
chegar@27560 87 $(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
chegar@27560 88 SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
chegar@27560 89 DEST := $(MODULES_LIBS_STRIPPED), \
chegar@27560 90 FILES := $(STRIP_LIBS_SRC), \
chegar@27560 91 MACRO := StripRecipe))
chegar@27560 92
chegar@27560 93 $(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
chegar@27560 94 SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
chegar@27560 95 DEST := $(MODULES_LIBS_STRIPPED), \
chegar@27560 96 FILES := $(COPY_LIBS_SRC)))
chegar@27560 97
chegar@27560 98 TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
chegar@27560 99 $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
chegar@27560 100
chegar@27560 101 all: $(TARGETS)