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