annotate make/StripBinaries.gmk @ 27560:adc258b13e2c

8049367: Modular Run-Time Images Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, bradford.wetmore@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, james.laskey@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com, sundararajan.athijegannathan@oracle.com
author chegar
date Wed, 03 Dec 2014 14:20:21 +0000
parents
children 577e534faca4
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
chegar@27560 31 ################################################################################
chegar@27560 32 # Copy native libraries and executables to a secondary location to strip them
chegar@27560 33 # and filter out files that shouldn't go into the image.
chegar@27560 34
chegar@27560 35 MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
chegar@27560 36 MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
chegar@27560 37
chegar@27560 38 ifneq ($(POST_STRIP_CMD), )
chegar@27560 39 define StripRecipe
chegar@27560 40 $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
chegar@27560 41 $(MKDIR) -p $(@D)
chegar@27560 42 $(CP) $< $@.tmp
chegar@27560 43 $(CHMOD) u+w $@.tmp
chegar@27560 44 $(POST_STRIP_CMD) $@.tmp
chegar@27560 45 $(if $(POST_MCS_CMD), $(POST_MCS_CMD) $@.tmp)
chegar@27560 46 $(CHMOD) go-w $@.tmp
chegar@27560 47 $(MV) $@.tmp $@
chegar@27560 48 endef
chegar@27560 49 else
chegar@27560 50 define StripRecipe
chegar@27560 51 $(call install-file)
chegar@27560 52 endef
chegar@27560 53 endif
chegar@27560 54
chegar@27560 55 # Don't include debug info for executables.
chegar@27560 56 ALL_CMDS_SRC := $(filter-out %.debuginfo %.diz %.map %.pdb, \
chegar@27560 57 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
chegar@27560 58 COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
chegar@27560 59 STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
chegar@27560 60
chegar@27560 61 # Make sure symbolic links are copied and not stripped
chegar@27560 62 COPY_LIBS_SRC := \
chegar@27560 63 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
chegar@27560 64 \( ! -name '*$(SHARED_LIBRARY_SUFFIX)' -type f \) -o -type l)
chegar@27560 65 STRIP_LIBS_SRC := \
chegar@27560 66 $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
chegar@27560 67 -name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
chegar@27560 68
chegar@27560 69 # On Windows, don't include debug info for libs either.
chegar@27560 70 ifeq ($(OPENJDK_TARGET_OS), windows)
chegar@27560 71 COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
chegar@27560 72 endif
chegar@27560 73
chegar@27560 74 $(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
chegar@27560 75 SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
chegar@27560 76 DEST := $(MODULES_CMDS_STRIPPED), \
chegar@27560 77 FILES := $(STRIP_CMDS_SRC), \
chegar@27560 78 MACRO := StripRecipe))
chegar@27560 79
chegar@27560 80 $(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
chegar@27560 81 SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
chegar@27560 82 DEST := $(MODULES_CMDS_STRIPPED), \
chegar@27560 83 FILES := $(COPY_CMDS_SRC)))
chegar@27560 84
chegar@27560 85 $(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
chegar@27560 86 SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
chegar@27560 87 DEST := $(MODULES_LIBS_STRIPPED), \
chegar@27560 88 FILES := $(STRIP_LIBS_SRC), \
chegar@27560 89 MACRO := StripRecipe))
chegar@27560 90
chegar@27560 91 $(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
chegar@27560 92 SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
chegar@27560 93 DEST := $(MODULES_LIBS_STRIPPED), \
chegar@27560 94 FILES := $(COPY_LIBS_SRC)))
chegar@27560 95
chegar@27560 96 TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
chegar@27560 97 $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
chegar@27560 98
chegar@27560 99 all: $(TARGETS)