author | coleenp |
Tue, 28 Aug 2018 18:31:14 -0400 | |
changeset 51555 | 7e1f4a215b45 |
parent 50590 | 5fa19bad622d |
child 52065 | dea8a62cdfc3 |
permissions | -rw-r--r-- |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
1 |
# |
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
2 |
# Copyright (c) 2011, 2014, 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 |
|
20363 | 65 |
# Find all files in the source tree. |
20645
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
66 |
$1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) |
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
67 |
|
6170a286f879
8025869: make docs doesn't regenerate docs correctly after changing API doc comments in jaxp sources
erikj
parents:
20364
diff
changeset
|
68 |
# 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
|
69 |
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
|
70 |
$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
|
71 |
endif |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
72 |
|
20363 | 73 |
ifneq ($$($1_INCLUDES),) |
74 |
ifneq ($$($1_SUFFIXES),) |
|
75 |
$1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ |
|
76 |
$$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) |
|
77 |
else |
|
78 |
$1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
79 |
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
|
80 |
else |
14de1ab85d25
8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents:
29312
diff
changeset
|
81 |
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
|
82 |
$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
|
83 |
$$(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
|
84 |
endif |
20363 | 85 |
endif |
86 |
ifneq ($$($1_INCLUDE_FILES),) |
|
87 |
$1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES)) |
|
88 |
endif |
|
89 |
ifneq ($$($1_EXCLUDES),) |
|
27560 | 90 |
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) |
20363 | 91 |
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) |
92 |
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS)) |
|
93 |
endif |
|
27560 | 94 |
ifneq ($$($1_EXCLUDE_FILES),) |
95 |
$1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES) |
|
96 |
$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
|
97 |
$$(foreach s, $$($1_SRC), \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
98 |
$$(eval $1_ZIP_EXCLUDES_$$s += \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
99 |
$$(addprefix -x$$(SPACE), $$(patsubst $$s/%,%, $$($1_EXCLUDE_FILES))) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
100 |
) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
101 |
) |
27560 | 102 |
endif |
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
103 |
ifneq ($$($1_EXCLUDE_PATTERNS), ) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
104 |
$1_ALL_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERNS), $$($1_ALL_SRCS)) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
105 |
$1_ZIP_EXCLUDES += $$(addprefix -x$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS))) |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
106 |
endif |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
107 |
# Rewrite src dir specific exclude patterns to zip excludes |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
108 |
$$(foreach s, $$($1_SRC), \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
109 |
$$(if $$($1_EXCLUDE_PATTERNS_$$s), \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
110 |
$$(eval $1_ZIP_EXCLUDES_$$s += \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
111 |
$$(addprefix -x$$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS_$$s))) \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
112 |
) \ |
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 |
) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
115 |
|
20363 | 116 |
# 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
|
117 |
$1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
118 |
|
20363 | 119 |
# Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. |
120 |
# I.e. the zip -i and -x options should match the filtering done in the makefile. |
|
121 |
# Explicitly excluded files can be given with absolute path. The patsubst solution |
|
122 |
# isn't perfect but the likelyhood of an absolute path to match something in a src |
|
123 |
# dir is very small. |
|
124 |
# If zip has nothing to do, it returns 12 and would fail the build. Check for 12 |
|
125 |
# and only fail if it's not. |
|
126 |
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) |
|
127 |
$(MKDIR) -p $$(@D) |
|
128 |
$(ECHO) Updating $$($1_NAME) |
|
50590
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
129 |
$$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
130 |
$$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \ |
5fa19bad622d
8204973: Add build support for filtering translations
erikj
parents:
47253
diff
changeset
|
131 |
$$($1_ZIP_EXCLUDES_$$s) \ |
27560 | 132 |
|| test "$$$$?" = "12" )$$(NEWLINE)) true |
20363 | 133 |
$(TOUCH) $$@ |
22480
d1be923b168a
8026773: Failing compilation in Corba does not fail the build
erikj
parents:
22469
diff
changeset
|
134 |
|
d1be923b168a
8026773: Failing compilation in Corba does not fail the build
erikj
parents:
22469
diff
changeset
|
135 |
# Add zip to target list |
d1be923b168a
8026773: Failing compilation in Corba does not fail the build
erikj
parents:
22469
diff
changeset
|
136 |
$1 += $$($1_ZIP) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
137 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
138 |
|
27592
af7df0dd5ff7
8065911: Introduce EvalDebugWrapper for all Setup* macros
ihse
parents:
27591
diff
changeset
|
139 |
endif # _ZIP_ARCHIVE_GMK |