test/make/TestMakeBase.gmk
author erikj
Mon, 26 Jan 2015 10:28:53 +0100
changeset 28600 09dd1740f176
parent 25854 98ce0879ab4c
child 28607 380f123263d8
permissions -rw-r--r--
8069261: Create make dependencies on make variable values Reviewed-by: ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     1
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     2
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     4
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    10
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    15
# accompanied this code).
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    16
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    20
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    23
# questions.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    24
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    25
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    26
default: all
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    27
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    28
include $(SPEC)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    29
include MakeBase.gmk
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    30
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    31
THIS_FILE := $(SRC_ROOT)/test/make/TestMakeBase.gmk
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    32
DEPS := $(THIS_FILE) \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    33
    $(SRC_ROOT)/make/common/MakeBase.gmk \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    34
    #
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    35
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    36
# On macosx, file system timestamps only have 1 second resultion so must add
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    37
# sleeps to properly test dependencies.
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    38
ifeq ($(OPENJDK_BUILD_OS), macosx)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    39
  SLEEP_ON_MAC := sleep 1
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    40
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    41
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    42
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/make-base
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    43
$(call MakeDir, $(OUTPUT_DIR))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    44
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    45
################################################################################
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    46
# Escape $
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    47
ifneq ($(call EscapeDollar, foo$$bar), foo\$$bar)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    48
  $(error EscapeDollar failed $(call EscapeDollar, foo$$bar) foo\$$bar)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    49
endif
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    50
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    51
ESCAPE_DOLLAR_DIR := $(OUTPUT_DIR)/escape-dollar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    52
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    53
$(ESCAPE_DOLLAR_DIR)/_escape_dollar: $(DEPS)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    54
	$(RM) -r $(@D)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    55
	$(MKDIR) -p $(@D)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    56
	$(ECHO) foo\$$bar > $(@D)/file1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    57
	$(ECHO) $(call EscapeDollar, foo$$bar) > $(@D)/file2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    58
	$(ECHO) $(call EscapeDollar, foo\$$bar) > $(@D)/file3
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    59
	$(DIFF) $(@D)/file1 $(@D)/file2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    60
	$(DIFF) $(@D)/file1 $(@D)/file3
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    61
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    62
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    63
TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    64
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    65
################################################################################
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    66
# Test ShellQuote
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    67
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    68
SHELL_QUOTE_VALUE := foo '""' "''" bar
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    69
SHELL_QUOTE_RESULT := $(shell $(ECHO) $(call ShellQuote, \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    70
    $(SHELL_QUOTE_VALUE)))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    71
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    72
ifneq ($(SHELL_QUOTE_VALUE), $(SHELL_QUOTE_RESULT))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    73
  $(error Expected: >$(SHELL_QUOTE_VALUE)< - Result: >$(SHELL_QUOTE_RESULT)<)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    74
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    75
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    76
################################################################################
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    77
# Test read and write to file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    78
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    79
READ_WRITE_FILE := $(OUTPUT_DIR)/read-write
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    80
READ_WRITE_VALUE := foo '""' "''" \t\n\\ bar
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    81
$(call WriteFile, $(READ_WRITE_VALUE), $(READ_WRITE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    82
READ_WRITE_RESULT := $(call ReadFile, $(READ_WRITE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    83
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    84
ifneq ($(READ_WRITE_VALUE), $(READ_WRITE_RESULT))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    85
  $(error Expected: >$(READ_WRITE_VALUE)< - Result: >$(READ_WRITE_RESULT)<)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    86
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    87
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    88
################################################################################
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    89
# Test creating dependencies on make variables
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    90
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    91
VARDEP_DIR := $(OUTPUT_DIR)/vardep
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    92
VARDEP_SRC_FILE := $(VARDEP_DIR)/src-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    93
VARDEP_TARGET_FILE := $(VARDEP_DIR)/target-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    94
VARDEP_FLAG_FILE := $(VARDEP_DIR)/flag-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    95
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    96
$(VARDEP_DIR)/src-file:
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    97
	$(MKDIR) -p $(@D)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    98
	$(ECHO) "some string XXX" > $@
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    99
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   100
$(VARDEP_TARGET_FILE): $(VARDEP_DIR)/src-file \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   101
    $(call DependOnVariable, VARDEP_TEST_VAR)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   102
	$(MKDIR) -p $(@D)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   103
	$(SED) -e 's/XXX/$(VARDEP_TEST_VAR)/g' $< > $@
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   104
	$(TOUCH) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   105
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   106
test-vardep:
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   107
	$(RM) $(VARDEP_SRC_FILE) $(VARDEP_TARGET_FILE) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   108
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   109
        # Simply create the target file and verify that it has the correct value
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   110
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   111
	$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value1 $(VARDEP_TARGET_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   112
	$(PRINTF) "Expecting value1: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   113
	test "some string value1" = "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   114
	test -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   115
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   116
        # Make the target file again and verify that the value is updated with 
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   117
        # the new value
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   118
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   119
	$(SLEEP_ON_MAC)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   120
	$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   121
	$(PRINTF) "Expecting value2: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   122
	test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   123
	test -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   124
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   125
        # Make the target again with the same value and verify that the recipe
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   126
        # was never run by checking that the flag file was not recreated
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   127
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   128
	$(SLEEP_ON_MAC)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   129
	$(RM) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   130
	$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=value2 $(VARDEP_TARGET_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   131
	$(PRINTF) "Expecting value2: %s\n" "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   132
	test "some string value2" = "`$(CAT) $(VARDEP_DIR)/target-file`"
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   133
	test ! -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   134
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   135
        # Test running with spaces at the end and the middle of the value
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   136
        # and verify that the file isn't rewritten the second time
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   137
        #
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   138
	$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="value3  foo " $(VARDEP_TARGET_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   139
	$(RM) $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   140
	$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR="value3 foo" $(VARDEP_TARGET_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   141
	test ! -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   142
	$(MAKE) -f $(THIS_FILE) VARDEP_TEST_VAR=" value3  foo" $(VARDEP_TARGET_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   143
	test ! -e $(VARDEP_FLAG_FILE)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   144
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   145
# Test specifying a specific value file to store variable in
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   146
VARDEP_VALUE_FILE := $(VARDEP_DIR)/value-file
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   147
VARDEP_TEST_VAR2 := value3
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   148
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   149
VARDEP_RETURN_VALUE := $(call DependOnVariable, VARDEP_TEST_VAR2, $(VARDEP_VALUE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   150
ifneq ($(VARDEP_VALUE_FILE), $(VARDEP_RETURN_VALUE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   151
  $(error Expected: $(VARDEP_VALUE_FILE) - DependOnVariable: $(VARDEP_RETURN_VALUE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   152
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   153
VARDEP_FILE_CONTENTS := $(shell $(CAT) $(VARDEP_VALUE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   154
ifneq ($(VARDEP_TEST_VAR2), $(VARDEP_FILE_CONTENTS))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   155
  $(error Expected: $(VARDEP_TEST_VAR2) - DependOnVariable file contained: \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   156
      $(VARDEP_FILE_CONTENTS))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   157
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   158
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   159
# Test with a variable value containing some problematic characters
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   160
VARDEP_TEST_VAR3 := foo '""' "''" bar
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   161
VARDEP_VALUE_FILE := $(call DependOnVariable, VARDEP_TEST_VAR3)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   162
VARDEP_FILE_CONTENTS := $(shell $(CAT) $(VARDEP_VALUE_FILE))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   163
ifneq ($(VARDEP_TEST_VAR3), $(VARDEP_FILE_CONTENTS))
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   164
  $(error Expected: >$(VARDEP_TEST_VAR3)< - DependOnVariable file contained: \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   165
      >$(VARDEP_FILE_CONTENTS)<)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   166
endif
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   167
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   168
TEST_TARGETS += test-vardep
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   169
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   170
################################################################################
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   171
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   172
all: $(TEST_TARGETS)