make/StripBinaries.gmk
author roland
Thu, 08 Jan 2015 11:00:38 +0100
changeset 28486 b0df113b962e
parent 27560 adc258b13e2c
child 28003 577e534faca4
permissions -rw-r--r--
8027626: assert(Opcode() != Op_If || outcnt() == 2) failed: bad if #1 Summary: IGVN encounters IfNode with single projection when optimizing dying subgraph Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     1
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     2
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     4
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    10
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    15
# accompanied this code).
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    16
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    20
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    23
# questions.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    24
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    25
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    26
default: all
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    27
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    28
include $(SPEC)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    29
include MakeBase.gmk
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    30
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    31
################################################################################
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    32
# Copy native libraries and executables to a secondary location to strip them
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    33
# and filter out files that shouldn't go into the image.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    34
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    35
MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    36
MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    37
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    38
ifneq ($(POST_STRIP_CMD), )
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    39
  define StripRecipe
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    40
	$(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    41
	$(MKDIR) -p $(@D)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    42
	$(CP) $< $@.tmp
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    43
	$(CHMOD) u+w $@.tmp
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    44
	$(POST_STRIP_CMD) $@.tmp
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    45
	$(if $(POST_MCS_CMD), $(POST_MCS_CMD) $@.tmp)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    46
	$(CHMOD) go-w $@.tmp
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    47
	$(MV) $@.tmp $@
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    48
  endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    49
else
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    50
  define StripRecipe
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    51
    $(call install-file)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    52
  endef
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    53
endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    54
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    55
# Don't include debug info for executables.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    56
ALL_CMDS_SRC := $(filter-out %.debuginfo %.diz %.map %.pdb, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    57
    $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    58
COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    59
STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    60
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    61
# Make sure symbolic links are copied and not stripped
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    62
COPY_LIBS_SRC := \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    63
    $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    64
        \( ! -name '*$(SHARED_LIBRARY_SUFFIX)' -type f \) -o -type l)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    65
STRIP_LIBS_SRC := \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    66
    $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    67
        -name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    68
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    69
# On Windows, don't include debug info for libs either.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    70
ifeq ($(OPENJDK_TARGET_OS), windows)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    71
  COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    72
endif
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    73
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    74
$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    75
    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    76
    DEST := $(MODULES_CMDS_STRIPPED), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    77
    FILES := $(STRIP_CMDS_SRC), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    78
    MACRO := StripRecipe))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    79
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    80
$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    81
    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    82
    DEST := $(MODULES_CMDS_STRIPPED), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    83
    FILES := $(COPY_CMDS_SRC)))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    84
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    85
$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    86
    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    87
    DEST := $(MODULES_LIBS_STRIPPED), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    88
    FILES := $(STRIP_LIBS_SRC), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    89
    MACRO := StripRecipe))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    90
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    91
$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    92
    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    93
    DEST := $(MODULES_LIBS_STRIPPED), \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    94
    FILES := $(COPY_LIBS_SRC)))
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    95
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    96
TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    97
    $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    98
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    99
all: $(TARGETS)