test/make/TestCopyFiles.gmk
author erikj
Fri, 13 Oct 2017 13:42:10 +0200
changeset 47334 09d386ddaa42
child 47751 f7e430cbfe34
permissions -rw-r--r--
8189095: Import JMC from artifactory using Jib and main makefiles Reviewed-by: ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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)
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    47
	$(RM) -r $(SRC_DIR)
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    48
	$(MKDIR) -p $(SRC_DIR)
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    49
	$(MKDIR) -p $(SRC_DIR)/foo
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    50
	$(TOUCH) $(SRC_DIR)/file
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    51
	$(TOUCH) $(SRC_DIR)/foo/foofile
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    52
	$(TOUCH) "$(SRC_DIR)/foo/foo file"
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    53
        # Spaces in directories only works with gnu make 4.0 or later
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    54
        ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION))))
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    55
	  $(MKDIR) -p "$(SRC_DIR)/foo bar"
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    56
	  $(TOUCH) "$(SRC_DIR)/foo bar/foobarfile"
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    57
	  $(TOUCH) "$(SRC_DIR)/foo bar/foo bar file"
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    58
        endif
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    59
	$(LN) -s file "$(SRC_DIR)/link to file"
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    60
	$(TOUCH) $@
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    61
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    62
$(eval $(call SetupCopyFiles, COPY_1, \
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    63
    SRC := $(SRC_DIR), \
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    64
    DEST := $(DEST_DIR), \
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    65
    FILES := $(call CacheFind, $(SRC_DIR)), \
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    66
))
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
do-copy1: $(COPY_1)
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    69
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    70
run-test1: $(OUTPUT_DIR)/_src_created
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    71
	+$(MAKE) -f $(THIS_FILE) do-copy1
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    72
	$(DIFF) -r $(SRC_DIR) $(DEST_DIR)
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    73
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    74
TEST_TARGETS += run-test1
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    75
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    76
.PHONY: do-copy1 run-test1
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    77
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    78
################################################################################
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    79
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents:
diff changeset
    80
all: $(TEST_TARGETS)