author | herrick |
Thu, 28 Mar 2019 13:49:38 -0400 | |
branch | JDK-8200758-branch |
changeset 57292 | 7a683c461b80 |
parent 53829 | 56dc0b27536c |
child 54380 | e297c7bb6469 |
permissions | -rw-r--r-- |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
1 |
# |
52804
28094715ae71
8214718: Update missing copyright year in build system
ihse
parents:
52065
diff
changeset
|
2 |
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
4 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
10 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
15 |
# accompanied this code). |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
16 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
20 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
23 |
# questions. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
24 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
25 |
|
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
26 |
ifndef _ZIP_ARCHIVE_GMK |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
27 |
_ZIP_ARCHIVE_GMK := 1 |
25854 | 28 |
|
20363 | 29 |
ifeq (,$(_MAKEBASE_GMK)) |
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
30 |
$(error You must include MakeBase.gmk prior to including ZipArchive.gmk) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
31 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
32 |
|
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
33 |
# Setup make rules for creating a zip archive. |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
34 |
# |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
35 |
# Parameter 1 is the name of the rule. This name is used as variable prefix, |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
36 |
# and the targets generated are listed in a variable by that name. |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
37 |
# |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
38 |
# Remaining parameters are named arguments. These include: |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
39 |
# SRC |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
40 |
# ZIP |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
41 |
# INCLUDES |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
42 |
# INCLUDE_FILES |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
43 |
# EXCLUDES |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
44 |
# EXCLUDE_FILES |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
45 |
# EXCLUDE_PATTERNS - Patterns with at most one % wildcard matching filenames |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
46 |
# and not directories. |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
47 |
# EXCLUDE_PATTERNS_$dir - Exclude patterns just like above but specific to one |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
48 |
# src dir |
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
49 |
# SUFFIXES |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
50 |
# EXTRA_DEPS |
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
51 |
# ZIP_OPTIONS extra options to pass to zip |
29312
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
27602
diff
changeset
|
52 |
SetupZipArchive = $(NamedParamsMacroTemplate) |
f3f859137ce6
8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents:
27602
diff
changeset
|
53 |
define SetupZipArchiveBody |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
54 |
|
20363 | 55 |
# To avoid running find over too large sets of files, which causes make to crash |
56 |
# on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set |
|
57 |
# of directories to run find in, if available. |
|
58 |
ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),) |
|
59 |
$1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \ |
|
60 |
$$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES)))) |
|
61 |
else |
|
62 |
$1_FIND_LIST := $$($1_SRC) |
|
63 |
endif |
|
18422 | 64 |
|
53829
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
65 |
# Find all files in the source tree. Follow symlinks in this find since that is |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
66 |
# what zip does. |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
67 |
$1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST), , -L)) |
20645
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
68 |
|
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
69 |
# Filter on suffixes if set |
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
70 |
ifneq ($$($1_SUFFIXES),) |
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
71 |
$1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS)) |
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
72 |
endif |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
73 |
|
20363 | 74 |
ifneq ($$($1_INCLUDES),) |
75 |
ifneq ($$($1_SUFFIXES),) |
|
76 |
$1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ |
|
77 |
$$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) |
|
78 |
else |
|
79 |
$1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
80 |
endif |
41658
14de1ab85d25
8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents:
29312
diff
changeset
|
81 |
else |
14de1ab85d25
8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents:
29312
diff
changeset
|
82 |
ifneq ($$($1_SUFFIXES),) |
14de1ab85d25
8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents:
29312
diff
changeset
|
83 |
$1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ |
14de1ab85d25
8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents:
29312
diff
changeset
|
84 |
$$(addprefix -i$(SPACE)$(DQUOTE),*$$s$(DQUOTE))) |
14de1ab85d25
8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents:
29312
diff
changeset
|
85 |
endif |
20363 | 86 |
endif |
87 |
ifneq ($$($1_INCLUDE_FILES),) |
|
88 |
$1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES)) |
|
89 |
endif |
|
90 |
ifneq ($$($1_EXCLUDES),) |
|
27560 | 91 |
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) |
20363 | 92 |
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) |
93 |
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS)) |
|
94 |
endif |
|
27560 | 95 |
ifneq ($$($1_EXCLUDE_FILES),) |
96 |
$1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES) |
|
97 |
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS)) |
|
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
98 |
$$(foreach s, $$($1_SRC), \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
99 |
$$(eval $1_ZIP_EXCLUDES_$$s += \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
100 |
$$(addprefix -x$$(SPACE), $$(patsubst $$s/%,%, $$($1_EXCLUDE_FILES))) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
101 |
) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
102 |
) |
27560 | 103 |
endif |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
104 |
ifneq ($$($1_EXCLUDE_PATTERNS), ) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
105 |
$1_ALL_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERNS), $$($1_ALL_SRCS)) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
106 |
$1_ZIP_EXCLUDES += $$(addprefix -x$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS))) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
107 |
endif |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
108 |
# Rewrite src dir specific exclude patterns to zip excludes |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
109 |
$$(foreach s, $$($1_SRC), \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
110 |
$$(if $$($1_EXCLUDE_PATTERNS_$$s), \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
111 |
$$(eval $1_ZIP_EXCLUDES_$$s += \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
112 |
$$(addprefix -x$$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS_$$s))) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
113 |
) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
114 |
) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
115 |
) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
116 |
|
20363 | 117 |
# Use a slightly shorter name for logging, but with enough path to identify this zip. |
47253
92fd0e04e0e1
8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents:
42136
diff
changeset
|
118 |
$1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
119 |
|
20363 | 120 |
# Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. |
121 |
# I.e. the zip -i and -x options should match the filtering done in the makefile. |
|
122 |
# Explicitly excluded files can be given with absolute path. The patsubst solution |
|
123 |
# isn't perfect but the likelyhood of an absolute path to match something in a src |
|
124 |
# dir is very small. |
|
125 |
# If zip has nothing to do, it returns 12 and would fail the build. Check for 12 |
|
126 |
# and only fail if it's not. |
|
127 |
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) |
|
52065
dea8a62cdfc3
8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents:
50590
diff
changeset
|
128 |
$$(call LogWarn, Updating $$($1_NAME)) |
dea8a62cdfc3
8211724: Change mkdir -p to MakeDir macro where possible
erikj
parents:
50590
diff
changeset
|
129 |
$$(call MakeTargetDir) |
53829
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
130 |
$$(foreach s,$$($1_SRC), $$(call ExecuteWithLog, \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
131 |
$$(SUPPORT_OUTPUTDIR)/zip/$$(patsubst $$(OUTPUTDIR)/%,%, $$@), \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
132 |
(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
133 |
$$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
134 |
$$($1_ZIP_EXCLUDES_$$s) \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
135 |
|| test "$$$$?" = "12" \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
136 |
))$$(NEWLINE) \ |
56dc0b27536c
8211016: make images does not update jdk/lib/src.zip with latest changes
erikj
parents:
52804
diff
changeset
|
137 |
) true \ |
20363 | 138 |
$(TOUCH) $$@ |
22480
d1be923b168a
8026773: Failing compilation in Corba does not fail the build
erikj
parents:
22469
diff
changeset
|
139 |
|
d1be923b168a
8026773: Failing compilation in Corba does not fail the build
erikj
parents:
22469
diff
changeset
|
140 |
# Add zip to target list |
d1be923b168a
8026773: Failing compilation in Corba does not fail the build
erikj
parents:
22469
diff
changeset
|
141 |
$1 += $$($1_ZIP) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
142 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
143 |
|
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
144 |
endif # _ZIP_ARCHIVE_GMK |