author | vlivanov |
Thu, 18 Jan 2018 02:25:18 +0300 | |
changeset 48596 | 860326263d1f |
parent 47879 | 3812717dc3e9 |
child 54380 | e297c7bb6469 |
permissions | -rw-r--r-- |
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
1 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
2 |
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
4 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
10 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
15 |
# accompanied this code). |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
16 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
20 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
23 |
# questions. |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
24 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
25 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
26 |
default: all |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
27 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
28 |
include $(SPEC) |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
29 |
include MakeBase.gmk |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
30 |
include UtilsForTests.gmk |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
31 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
32 |
THIS_FILE := $(TOPDIR)/test/make/TestCopyFiles.gmk |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
33 |
DEPS := $(THIS_FILE) \ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
34 |
$(TOPDIR)/make/common/MakeBase.gmk \ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
35 |
# |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
36 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
37 |
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/copy-files |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
38 |
$(call MakeDir, $(OUTPUT_DIR)) |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
39 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
40 |
################################################################################ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
41 |
# Test SetupCopyFiles with CacheFind and files with spaces in their names. |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
42 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
43 |
SRC_DIR := $(OUTPUT_DIR)/src |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
44 |
DEST_DIR := $(OUTPUT_DIR)/dest |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
45 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
46 |
$(OUTPUT_DIR)/_src_created: $(DEPS) |
47751
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
47 |
$(RM) -r $(DEST_DIR) |
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
48 |
$(RM) -r $(SRC_DIR) |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
49 |
$(MKDIR) -p $(SRC_DIR) |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
50 |
$(MKDIR) -p $(SRC_DIR)/foo |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
51 |
$(TOUCH) $(SRC_DIR)/file |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
52 |
$(TOUCH) $(SRC_DIR)/foo/foofile |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
53 |
$(TOUCH) "$(SRC_DIR)/foo/foo file" |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
54 |
# Spaces in directories only works with gnu make 4.0 or later |
47879 | 55 |
ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION)))) |
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
56 |
$(MKDIR) -p "$(SRC_DIR)/foo bar" |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
57 |
$(TOUCH) "$(SRC_DIR)/foo bar/foobarfile" |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
58 |
$(TOUCH) "$(SRC_DIR)/foo bar/foo bar file" |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
59 |
endif |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
60 |
$(LN) -s file "$(SRC_DIR)/link to file" |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
61 |
$(TOUCH) $@ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
62 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
63 |
$(eval $(call SetupCopyFiles, COPY_1, \ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
64 |
SRC := $(SRC_DIR), \ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
65 |
DEST := $(DEST_DIR), \ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
66 |
FILES := $(call CacheFind, $(SRC_DIR)), \ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
67 |
)) |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
68 |
|
47751
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
69 |
# Optionally define a rule that deletes all the target files after the makefile |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
70 |
# has been parsed. GNU make has specific problems with this in combination with |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
71 |
# spaces in directory names. |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
72 |
ifeq ($(DELETE_FIRST), true) |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
73 |
delete-targets: |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
74 |
$(RM) -r $(DEST_DIR) |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
75 |
$(ECHO) '$(DEST_DIR)/foo' '$(wildcard $(DEST_DIR)/foo)' |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
76 |
|
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
77 |
$(COPY_1): delete-targets |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
78 |
endif |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
79 |
|
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
80 |
do-copy1: $(COPY_1) |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
81 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
82 |
run-test1: $(OUTPUT_DIR)/_src_created |
47751
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
83 |
$(ECHO) "Copy 1 first time" |
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
84 |
+$(MAKE) -f $(THIS_FILE) do-copy1 |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
85 |
$(DIFF) -r $(SRC_DIR) $(DEST_DIR) |
47751
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
86 |
# Rerun the copy a second time, with the targets present at make parse |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
87 |
# time, but then deleted by a prerequisite rule. |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
88 |
$(ECHO) "Copy 1 second time" |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
89 |
+$(MAKE) -f $(THIS_FILE) do-copy1 DELETE_FIRST=true |
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
90 |
$(DIFF) -r $(SRC_DIR) $(DEST_DIR) |
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
91 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
92 |
TEST_TARGETS += run-test1 |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
93 |
|
47751
f7e430cbfe34
8190702: JMC packaging causing errors in JDK 10 consolidated repo (macOS)
erikj
parents:
47334
diff
changeset
|
94 |
.PHONY: do-copy1 run-test1 delete-targets |
47334
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
95 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
96 |
################################################################################ |
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
97 |
|
09d386ddaa42
8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff
changeset
|
98 |
all: $(TEST_TARGETS) |