author | jbachorik |
Wed, 24 Oct 2012 20:44:07 +0100 | |
changeset 14319 | 0b9fd764d40d |
parent 13697 | 5262b00bc10c |
child 14111 | 2a82ecb35fc7 |
permissions | -rw-r--r-- |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
1 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
2 |
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
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 |
|
13697 | 26 |
# This makefile is much simpler now that it can use the smart javac wrapper |
27 |
# for dependency tracking between java packages and incremental compiles. |
|
28 |
# It could be even more simple if we added support for incremental jar updates |
|
29 |
# directly from the smart javac wrapper. |
|
30 |
||
31 |
# Cleaning/copying properties here is not a good solution. The properties |
|
32 |
# should be cleaned/copied by a annotation processor in sjavac. |
|
33 |
||
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
34 |
# When you read this source. Remember that $(sort ...) has the side effect |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
35 |
# of removing duplicates. It is actually this side effect that is |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
36 |
# desired whenever sort is used below! |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
37 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
38 |
ifeq (,$(_MAKEBASE_GMK)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
39 |
$(error You must include MakeBase.gmk prior to including JavaCompilation.gmk) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
40 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
41 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
42 |
FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
43 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
44 |
define SetupJavaCompiler |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
45 |
# param 1 is for example BOOT_JAVAC or NEW_JAVAC |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
46 |
# This is the name later used to decide which java compiler to use. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
47 |
# param 2-9 are named args. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
48 |
# JVM:=The jvm used to run the javac/javah command |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
49 |
# JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
50 |
# FLAGS:=Flags to be supplied to javac |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
51 |
# SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
52 |
# SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
53 |
$(if $2,$1_$(strip $2)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
54 |
$(if $3,$1_$(strip $3)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
55 |
$(if $4,$1_$(strip $4)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
56 |
$(if $5,$1_$(strip $5)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
57 |
$(if $6,$1_$(strip $6)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
58 |
$(if $7,$1_$(strip $7)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
59 |
$(if $8,$1_$(strip $8)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
60 |
$(if $9,$1_$(strip $9)) |
13132 | 61 |
$(if $(10),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
62 |
|
13697 | 63 |
ifeq ($$(ENABLE_SJAVAC),yes) |
64 |
# The port file contains the tcp/ip on which the server listens |
|
65 |
# and the cookie necessary to talk to the server. |
|
66 |
$1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port |
|
67 |
# You can use a different JVM to run the background javac server. |
|
68 |
ifeq ($$($1_SERVER_JVM),) |
|
69 |
# It defaults to the same JVM that is used to start the javac command. |
|
70 |
$1_SERVER_JVM:=$$($1_JVM) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
71 |
endif |
13697 | 72 |
# Set the $1_REMOTE to spawn a background javac server. |
73 |
$1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(SJAVAC_SERVER_CORES),id=$1,javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC)))) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
74 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
75 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
76 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
77 |
define SetupArchive |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
78 |
# param 1 is for example ARCHIVE_MYPACKAGE |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
79 |
# param 2 are the dependecies |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
80 |
# param 3,4,5,6,7,8,9 are named args. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
81 |
# SRCS:=List of directories in where to find files to add to archive |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
82 |
# SUFFIXES:=File suffixes to include in jar |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
83 |
# INCLUDES:=List of directories/packages in SRCS that should be included |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
84 |
# EXCLUDES:=List of directories/packages in SRCS that should be excluded |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
85 |
# EXCLUDE_FILES:=List of files in SRCS that should be excluded |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
86 |
# EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
87 |
# JAR:=Jar file to create |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
88 |
# MANIFEST:=Optional manifest file template. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
89 |
# JARMAIN:=Optional main class to add to manifest |
13697 | 90 |
# JARINDEX:=true means generate the index in the jar file. |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
91 |
# SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
92 |
# added to the archive. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
93 |
# EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. |
13132 | 94 |
# CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
95 |
$(if $3,$1_$(strip $3)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
96 |
$(if $4,$1_$(strip $4)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
97 |
$(if $5,$1_$(strip $5)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
98 |
$(if $6,$1_$(strip $6)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
99 |
$(if $7,$1_$(strip $7)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
100 |
$(if $8,$1_$(strip $8)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
101 |
$(if $9,$1_$(strip $9)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
102 |
$(if $(10),$1_$(strip $(10))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
103 |
$(if $(11),$1_$(strip $(11))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
104 |
$(if $(12),$1_$(strip $(12))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
105 |
$(if $(13),$1_$(strip $(13))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
106 |
$(if $(14),$1_$(strip $(14))) |
12801 | 107 |
$(if $(15),$1_$(strip $(15))) |
13132 | 108 |
$(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
109 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
110 |
$1_JARMAIN:=$(strip $$($1_JARMAIN)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
111 |
$1_JARNAME:=$$(notdir $$($1_JAR)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
112 |
$1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
113 |
$1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
114 |
$1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
115 |
$1_BIN:=$$(dir $$($1_JAR)) |
12801 | 116 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
117 |
ifeq (,$$($1_SUFFIXES)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
118 |
# No suffix was set, default to classes. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
119 |
$1_SUFFIXES:=.class |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
120 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
121 |
# Convert suffixes to a find expression |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
122 |
$1_FIND_PATTERNS:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES)) |
12801 | 123 |
# On windows, a lot of includes/excludes risk making the command line too long, so |
124 |
# writing the grep patterns to files. |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
125 |
ifneq (,$$($1_INCLUDES)) |
12801 | 126 |
$1_GREP_INCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),\ |
127 |
$$(addprefix $$(src)/,$$($1_INCLUDES))) |
|
128 |
$$(eval $$(call ListPathsSafelyNow,$1_GREP_INCLUDE_PATTERNS,\n, \ |
|
129 |
>> $$($1_BIN)/_the.$$($1_JARNAME)_include)) |
|
130 |
$1_GREP_INCLUDES:=| $(GREP) -f $$($1_BIN)/_the.$$($1_JARNAME)_include |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
131 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
132 |
ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES)) |
12801 | 133 |
$1_GREP_EXCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,\ |
134 |
$$($1_EXCLUDES) $$($1_EXCLUDE_FILES))) |
|
135 |
$$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \ |
|
136 |
>> $$($1_BIN)/_the.$$($1_JARNAME)_exclude)) |
|
137 |
$1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
138 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
139 |
|
13697 | 140 |
# Check if this jar needs to have its index generated. |
12801 | 141 |
ifneq (,$$($1_JARINDEX)) |
142 |
$1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@)) |
|
143 |
else |
|
144 |
$1_JARINDEX = true |
|
145 |
endif |
|
146 |
# When this macro is run in the same makefile as the java compilation, dependencies are transfered |
|
147 |
# in make variables. When the macro is run in a different makefile than the java compilation, the |
|
148 |
# dependencies need to be found in the filesystem. |
|
13697 | 149 |
ifneq (,$2) |
150 |
$1_DEPS:=$2 |
|
151 |
else |
|
152 |
$1_DEPS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \ |
|
12801 | 153 |
-a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \ |
13697 | 154 |
$$($1_GREP_EXCLUDES) && $(ECHO) $$(addprefix $$(src)/,$$($1_EXTRA_FILES))))) |
155 |
ifeq (,$$($1_SKIP_METAINF)) |
|
156 |
$1_DEPS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null)) |
|
157 |
endif |
|
12801 | 158 |
endif |
159 |
||
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
160 |
# Utility macros, to make the shell script receipt somewhat easier to dechipher. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
161 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
162 |
# The capture contents macro finds all files (matching the patterns, typically |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
163 |
# .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
164 |
$1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > $$(src)/_the.$$($1_JARNAME)_contents) && ) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
165 |
# The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
166 |
ifeq (,$$($1_SKIP_METAINF)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
167 |
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) && ) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
168 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
169 |
# The capture deletes macro finds all deleted files and concatenates them. The resulting file |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
170 |
# tells us what to remove from the jar-file. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
171 |
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) &&) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
172 |
# The update contents macro updates the jar file with the previously capture contents. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
173 |
$1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
174 |
(cd $$(src) && \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
175 |
if [ -s _the.$$($1_JARNAME)_contents ]; then \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
176 |
$(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \ |
13697 | 177 |
$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \ |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
178 |
fi) &&) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
179 |
# The s-variants of the above macros are used when the jar is created from scratch. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
180 |
$1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\ |
12801 | 181 |
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \ |
182 |
$$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > \ |
|
183 |
$$(src)/_the.$$($1_JARNAME)_contents) && ) |
|
184 |
||
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
185 |
ifeq (,$$($1_SKIP_METAINF)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
186 |
$1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\ |
12801 | 187 |
($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \ |
188 |
$$(src)/_the.$$($1_JARNAME)_contents) && ) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
189 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
190 |
$1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\ |
13697 | 191 |
(cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&) |
12801 | 192 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
193 |
# Use a slightly shorter name for logging, but with enough path to identify this jar. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
194 |
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR)) |
13132 | 195 |
|
196 |
ifneq (,$$($1_CHECK_COMPRESS_JAR)) |
|
197 |
$1_JAR_CREATE_OPTIONS := c0fm |
|
13697 | 198 |
$1_JAR_UPDATE_OPTIONS := u0f |
13132 | 199 |
ifeq ($(COMPRESS_JARS), true) |
200 |
$1_JAR_CREATE_OPTIONS := cfm |
|
13697 | 201 |
$1_JAR_UPDATE_OPTIONS := uf |
13132 | 202 |
endif |
203 |
else |
|
204 |
$1_JAR_CREATE_OPTIONS := cfm |
|
13697 | 205 |
$1_JAR_UPDATE_OPTIONS := uf |
13132 | 206 |
endif |
207 |
||
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
208 |
# Here is the rule that creates/updates the jar file. |
13697 | 209 |
$$($1_JAR) : $$($1_DEPS) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
210 |
$(MKDIR) -p $$($1_BIN) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
211 |
if [ -n "$$($1_MANIFEST)" ]; then \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
212 |
$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
213 |
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE); \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
214 |
else \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
215 |
$(RM) $$($1_MANIFEST_FILE) && $(TOUCH) $$($1_MANIFEST_FILE); \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
216 |
fi |
12801 | 217 |
if [ -n "$$(strip $$($1_JARMAIN))" ]; then \ |
218 |
$(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE); \ |
|
219 |
fi |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
220 |
if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \ |
12801 | 221 |
$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \ |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
222 |
fi |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
223 |
+if [ -s $$@ ]; then \ |
13697 | 224 |
$(ECHO) Modifying $$($1_NAME) && \ |
225 |
$$($1_CAPTURE_CONTENTS) \ |
|
226 |
$$($1_CAPTURE_METAINF) \ |
|
227 |
$(RM) $$($1_DELETES_FILE) && \ |
|
228 |
$$($1_CAPTURE_DELETES) \ |
|
229 |
$(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \ |
|
230 |
if [ -s $$($1_DELETESS_FILE) ]; then \ |
|
231 |
$(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \ |
|
232 |
$(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \ |
|
233 |
fi && \ |
|
234 |
$$($1_UPDATE_CONTENTS) true && \ |
|
235 |
$$($1_JARINDEX) && true ; \ |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
236 |
else \ |
13132 | 237 |
$(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) && \ |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
238 |
$$($1_SCAPTURE_CONTENTS) \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
239 |
$$($1_SCAPTURE_METAINF) \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
240 |
$$($1_SUPDATE_CONTENTS) \ |
13697 | 241 |
$$($1_JARINDEX) && true ; \ |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
242 |
fi; |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
243 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
244 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
245 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
246 |
define SetupZipArchive |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
247 |
# param 1 is for example ZIP_MYSOURCE |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
248 |
# param 2,3,4,5,6,7,8,9 are named args. |
12801 | 249 |
# SRC,ZIP,INCLUDES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
250 |
$(if $2,$1_$(strip $2)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
251 |
$(if $3,$1_$(strip $3)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
252 |
$(if $4,$1_$(strip $4)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
253 |
$(if $5,$1_$(strip $5)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
254 |
$(if $6,$1_$(strip $6)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
255 |
$(if $7,$1_$(strip $7)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
256 |
$(if $8,$1_$(strip $8)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
257 |
$(if $9,$1_$(strip $9)) |
13132 | 258 |
$(if $(10),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
259 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
260 |
# Find all files in the source tree. |
12801 | 261 |
$1_SUFFIX_FILTER := $$(patsubst %,-o -name $(DQUOTE)*%$(DQUOTE),$$($1_SUFFIXES)) |
262 |
$1_ALL_SRCS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f -a ! -name "_the.*" \( -name FALSE_DUMMY $$($1_SUFFIX_FILTER) \) )) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
263 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
264 |
ifneq ($$($1_INCLUDES),) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
265 |
$1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) |
12801 | 266 |
ifneq ($$($1_SUFFIXES),) |
267 |
$1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES),\ |
|
268 |
$$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) |
|
269 |
else |
|
270 |
$1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) |
|
271 |
endif |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
272 |
$1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
273 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
274 |
ifneq ($$($1_EXCLUDES),) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
275 |
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
276 |
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) |
13697 | 277 |
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRC)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
278 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
279 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
280 |
# Use a slightly shorter name for logging, but with enough path to identify this zip. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
281 |
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
282 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
283 |
# Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
284 |
# I.e. the zip -i and -x options should match the filtering done in the makefile. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
285 |
# Explicitly excluded files can be given with absolute path. The patsubst solution |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
286 |
# isn't perfect but the likelyhood of an absolute path to match something in a src |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
287 |
# dir is very small. |
12801 | 288 |
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
289 |
$(MKDIR) -p $$(@D) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
290 |
$(ECHO) Updating $$($1_NAME) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
291 |
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES)))) ;) true |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
292 |
$(TOUCH) $$@ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
293 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
294 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
295 |
define add_file_to_copy |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
296 |
# param 1 = BUILD_MYPACKAGE |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
297 |
# parma 2 = The source file to copy. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
298 |
$2_TARGET:=$2 |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
299 |
# Remove the source prefix. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
300 |
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
301 |
# Now we can setup the depency that will trigger the copying. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
302 |
$$($1_BIN)$$($2_TARGET) : $2 |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
303 |
$(MKDIR) -p $$(@D) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
304 |
$(CP) $$< $$@ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
305 |
$(CHMOD) -f ug+w $$@ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
306 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
307 |
# And do not forget this target |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
308 |
$1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
309 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
310 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
311 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
312 |
# This macro is used only for properties files that are to be |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
313 |
# copied over to the classes directory in cleaned form: |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
314 |
# Previously this was inconsistently done in different repositories. |
13697 | 315 |
# This is the new clean standard. Though it is to be superseded by |
316 |
# a standard annotation processor from with sjavac. |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
317 |
define add_file_to_copy_and_clean |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
318 |
# param 1 = BUILD_MYPACKAGE |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
319 |
# parma 2 = The source file to copy and clean. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
320 |
$2_TARGET:=$2 |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
321 |
# Remove the source prefix. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
322 |
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
323 |
# Now we can setup the depency that will trigger the copying. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
324 |
$$($1_BIN)$$($2_TARGET) : $2 |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
325 |
$(MKDIR) -p $$(@D) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
326 |
$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ |
13697 | 327 |
| $(SED) -f "$(SRC_ROOT)/common/bin/unicode2x.sed" \ |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
328 |
| $(SED) -e '/^#/d' -e '/^$$$$/d' \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
329 |
-e :a -e '/\\$$$$/N; s/\\\n//; ta' \ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
330 |
-e 's/^[ \t]*//;s/[ \t]*$$$$//' \ |
12801 | 331 |
-e 's/\\=/=/' | LANG=C $(SORT) > $$@ |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
332 |
$(CHMOD) -f ug+w $$@ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
333 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
334 |
# And do not forget this target |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
335 |
$1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
336 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
337 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
338 |
define remove_string |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
339 |
$2 := $$(subst $1,,$$($2)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
340 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
341 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
342 |
define replace_space_with_pathsep |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
343 |
$1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
344 |
endef |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
345 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
346 |
define SetupJavaCompilation |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
347 |
# param 1 is for example BUILD_MYPACKAGE |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
348 |
# param 2,3,4,5,6,7,8 are named args. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
349 |
# SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
350 |
# JVM:=path to ..bin/java |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
351 |
# ADD_JAVAC_FLAGS:=javac flags to append to the default ones. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
352 |
# SRC:=one or more directories to search for sources |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
353 |
# BIN:=store classes here |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
354 |
# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
355 |
# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
356 |
# COPY:=.prp means copy all prp files to the corresponding package in BIN. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
357 |
# CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
358 |
# COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
359 |
# SRCZIP:=Create a src.zip based on the found sources and copied files. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
360 |
# INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file! |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
361 |
# EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file! |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
362 |
# "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
363 |
# JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
364 |
# Its only here until we cleanup some nasty source code pasta in the jdk. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
365 |
# HEADERS:=path to directory where all generated c-headers are written. |
12801 | 366 |
# DEPENDS:=Extra dependecy |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
367 |
$(if $2,$1_$(strip $2)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
368 |
$(if $3,$1_$(strip $3)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
369 |
$(if $4,$1_$(strip $4)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
370 |
$(if $5,$1_$(strip $5)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
371 |
$(if $6,$1_$(strip $6)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
372 |
$(if $7,$1_$(strip $7)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
373 |
$(if $8,$1_$(strip $8)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
374 |
$(if $9,$1_$(strip $9)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
375 |
$(if $(10),$1_$(strip $(10))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
376 |
$(if $(11),$1_$(strip $(11))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
377 |
$(if $(12),$1_$(strip $(12))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
378 |
$(if $(13),$1_$(strip $(13))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
379 |
$(if $(14),$1_$(strip $(14))) |
13132 | 380 |
$(if $(15),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
381 |
|
13697 | 382 |
# Extract the info from the java compiler setup. |
383 |
$1_REMOTE := $$($$($1_SETUP)_REMOTE) |
|
384 |
$1_JVM := $$($$($1_SETUP)_JVM) |
|
385 |
$1_JAVAC := $$($$($1_SETUP)_JAVAC) |
|
386 |
$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS) |
|
387 |
ifeq ($$($1_JAVAC),) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
388 |
$$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP)) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
389 |
endif |
13697 | 390 |
|
391 |
# Handle addons and overrides. |
|
392 |
$1_SRC:=$$(call ADD_SRCS,$$($1_SRC)) |
|
393 |
# Make sure the dirs exist. |
|
394 |
$$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN)) |
|
395 |
# Find all files in the source trees. |
|
396 |
$1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f))) |
|
397 |
# Extract the java files. |
|
398 |
ifneq ($$($1_EXCLUDE_FILES),) |
|
399 |
$1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES)) |
|
400 |
endif |
|
401 |
$1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS))) |
|
402 |
ifneq ($$($1_INCLUDE_FILES),) |
|
403 |
$1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) |
|
404 |
$1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS)) |
|
405 |
endif |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
406 |
|
13697 | 407 |
# Now we have a list of all java files to compile: $$($1_SRCS) |
408 |
||
409 |
# Create the corresponding smart javac wrapper command line. |
|
410 |
$1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \ |
|
411 |
$$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \ |
|
412 |
$$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \ |
|
413 |
$$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \ |
|
414 |
-src "$$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))" |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
415 |
|
13697 | 416 |
# Prepend the source/bin path to the filter expressions. |
417 |
ifneq ($$($1_INCLUDES),) |
|
418 |
$1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) |
|
419 |
$1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS)) |
|
420 |
endif |
|
421 |
ifneq ($$($1_EXCLUDES),) |
|
422 |
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) |
|
423 |
$1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) |
|
424 |
endif |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
425 |
|
13697 | 426 |
# Find all files to be copied from source to bin. |
427 |
ifneq (,$$($1_COPY)) |
|
428 |
# Rewrite list of patterns into a find statement. |
|
429 |
$1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY)) |
|
430 |
# Search for all files to be copied. |
|
431 |
$1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f)) |
|
432 |
# Copy these explicitly |
|
433 |
$1_ALL_COPIES += $$($1_COPY_FILES) |
|
434 |
# Copy must also respect filters. |
|
435 |
ifneq (,$$($1_INCLUDES)) |
|
436 |
$1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES)) |
|
437 |
endif |
|
438 |
ifneq (,$$($1_EXCLUDES)) |
|
439 |
$1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES)) |
|
440 |
endif |
|
441 |
ifneq (,$$($1_EXCLUDE_FILES)) |
|
442 |
$1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES)) |
|
443 |
endif |
|
444 |
# All files below META-INF are always copied. |
|
445 |
$1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null)) |
|
446 |
ifneq (,$$($1_ALL_COPIES)) |
|
447 |
# Yep, there are files to be copied! |
|
448 |
$1_ALL_COPY_TARGETS:= |
|
449 |
$$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i))) |
|
450 |
# Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files! |
|
451 |
endif |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
452 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
453 |
|
13697 | 454 |
# Find all property files to be copied and cleaned from source to bin. |
455 |
ifneq (,$$($1_CLEAN)) |
|
456 |
# Rewrite list of patterns into a find statement. |
|
457 |
$1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN)) |
|
458 |
# Search for all files to be copied. |
|
459 |
$1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f)) |
|
460 |
# Copy and clean must also respect filters. |
|
461 |
ifneq (,$$($1_INCLUDES)) |
|
462 |
$1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS)) |
|
463 |
endif |
|
464 |
ifneq (,$$($1_EXCLUDES)) |
|
465 |
$1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS)) |
|
466 |
endif |
|
467 |
ifneq (,$$($1_EXCLUDE_FILES)) |
|
468 |
$1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS)) |
|
469 |
endif |
|
470 |
ifneq (,$$($1_ALL_CLEANS)) |
|
471 |
# Yep, there are files to be copied and cleaned! |
|
472 |
$1_ALL_COPY_CLEAN_TARGETS:= |
|
473 |
$$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i))) |
|
474 |
# Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files! |
|
475 |
endif |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
476 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
477 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
478 |
# Prep the source paths. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
479 |
ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
480 |
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
481 |
else |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
482 |
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC))) |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
483 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
484 |
|
12801 | 485 |
ifneq (,$$($1_HEADERS)) |
13697 | 486 |
$1_HEADERS_ARG := -h $$($1_HEADERS) |
12801 | 487 |
endif |
488 |
||
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
489 |
# Create a sed expression to remove the source roots and to replace / with . |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
490 |
# and remove .java at the end. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
491 |
$1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g' |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
492 |
|
13697 | 493 |
ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes) |
494 |
# Using sjavac to compile. |
|
495 |
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
496 |
|
13697 | 497 |
$$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS) |
498 |
$(MKDIR) -p $$(@D) |
|
499 |
$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp) |
|
500 |
$(ECHO) Compiling $1 |
|
501 |
$$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.sjavac.Main \ |
|
502 |
$$($1_REMOTE) $$($1_SJAVAC_ARGS) --permit-unidentified-artifacts -mfl $$($1_BIN)/_the.batch.tmp \ |
|
503 |
$$($1_FLAGS) \ |
|
504 |
-implicit:none -d $$($1_BIN) $$($1_HEADERS_ARG) |
|
505 |
else |
|
506 |
# Using plain javac to batch compile everything. |
|
507 |
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
508 |
|
13697 | 509 |
# When not using sjavac, pass along all sources to javac using an @file. |
510 |
$$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS) |
|
511 |
$(MKDIR) -p $$(@D) |
|
512 |
$(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp |
|
513 |
$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp) |
|
514 |
$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1 |
|
515 |
($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \ |
|
516 |
-implicit:none -sourcepath "$$($1_SRCROOTSC)" \ |
|
517 |
-d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \ |
|
518 |
$(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
519 |
endif |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
520 |
|
13697 | 521 |
# Check if a jar file was specified, then setup the rules for the jar. |
522 |
ifneq (,$$($1_JAR)) |
|
523 |
# If no suffixes was explicitly set for this jar file. |
|
524 |
# Use class and the cleaned/copied properties file suffixes as the default |
|
525 |
# for the types of files to be put into the jar. |
|
526 |
ifeq (,$$($1_SUFFIXES)) |
|
527 |
$1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY) |
|
528 |
endif |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
529 |
|
13697 | 530 |
$$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1),\ |
531 |
SRCS:=$$($1_BIN),\ |
|
532 |
SUFFIXES:=$$($1_SUFFIXES),\ |
|
533 |
EXCLUDE:=$$($1_EXCLUDES),\ |
|
534 |
INCLUDES:=$$($1_INCLUDES),\ |
|
535 |
EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS),\ |
|
536 |
JAR:=$$($1_JAR),\ |
|
537 |
JARMAIN:=$$($1_JARMAIN),\ |
|
538 |
MANIFEST:=$$($1_MANIFEST),\ |
|
539 |
EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\ |
|
540 |
JARINDEX:=$$($1_JARINDEX),\ |
|
541 |
HEADERS:=$$($1_HEADERS),\ |
|
542 |
SETUP:=$$($1_SETUP))) |
|
543 |
endif |
|
544 |
||
545 |
# Check if a srczip was specified, then setup the rules for the srczip. |
|
546 |
ifneq (,$$($1_SRCZIP)) |
|
547 |
$$(eval $$(call SetupZipArchive,ARCHIVE_$1,\ |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
548 |
SRC:=$$($1_SRC),\ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
549 |
ZIP:=$$($1_SRCZIP),\ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
550 |
INCLUDES:=$$($1_INCLUDES),\ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
551 |
EXCLUDES:=$$($1_EXCLUDES),\ |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
552 |
EXCLUDE_FILES:=$$($1_EXCLUDE_FILES))) |
13697 | 553 |
endif |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
554 |
|
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
555 |
endef |