build/pymake/tests/ifdefs.mk

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 ifdef FOO
     2 $(error FOO is not defined!)
     3 endif
     5 FOO = foo
     6 FOOFOUND = false
     7 BARFOUND = false
     8 BAZFOUND = false
    10 ifdef FOO
    11 FOOFOUND = true
    12 else ifdef BAR
    13 BARFOUND = true
    14 else
    15 BAZFOUND = true
    16 endif
    18 BAR2 = bar2
    19 FOO2FOUND = false
    20 BAR2FOUND = false
    21 BAZ2FOUND = false
    23 ifdef FOO2
    24 FOO2FOUND = true
    25 else ifdef BAR2
    26 BAR2FOUND = true
    27 else
    28 BAZ2FOUND = true
    29 endif
    31 FOO3FOUND = false
    32 BAR3FOUND = false
    33 BAZ3FOUND = false
    35 ifdef FOO3
    36 FOO3FOUND = true
    37 else ifdef BAR3
    38 BAR3FOUND = true
    39 else
    40 BAZ3FOUND = true
    41 endif
    43 ifdef RANDOM
    44 CONTINUATION = \
    45 else           \
    46 endif
    47 endif
    49 ifndef ASDFJK
    50 else
    51 $(error ASFDJK was not set)
    52 endif
    54 TESTSET =
    56 ifdef TESTSET
    57 $(error TESTSET was not set)
    58 endif
    60 TESTEMPTY = $(NULL)
    61 ifndef TESTEMPTY
    62 $(error TEST-FAIL TESTEMPTY was probably expanded!)
    63 endif
    65 # ifneq ( a,a)
    66 # $(error Arguments to ifeq should be stripped before evaluation)
    67 # endif
    69 XSPACE = x # trick
    71 ifneq ($(NULL),$(NULL))
    72 $(error TEST-FAIL ifneq)
    73 endif
    75 ifneq (x , x)
    76 $(error argument-stripping1)
    77 endif
    79 ifeq ( x,x )
    80 $(error argument-stripping2)
    81 endif
    83 ifneq ($(XSPACE), x )
    84 $(error argument-stripping3)
    85 endif
    87 ifeq 'x ' ' x'
    88 $(error TEST-FAIL argument-stripping4)
    89 endif
    91 all:
    92 	test $(FOOFOUND) = true   # FOOFOUND
    93 	test $(BARFOUND) = false  # BARFOUND
    94 	test $(BAZFOUND) = false  # BAZFOUND
    95 	test $(FOO2FOUND) = false # FOO2FOUND
    96 	test $(BAR2FOUND) = true  # BAR2FOUND
    97 	test $(BAZ2FOUND) = false # BAZ2FOUND
    98 	test $(FOO3FOUND) = false # FOO3FOUND
    99 	test $(BAR3FOUND) = false # BAR3FOUND
   100 	test $(BAZ3FOUND) = true  # BAZ3FOUND
   101 ifneq ($(FOO),foo)
   102 	echo TEST-FAIL 'FOO neq foo: "$(FOO)"'
   103 endif
   104 ifneq ($(FOO), foo) # Whitespace after the comma is stripped
   105 	echo TEST-FAIL 'FOO plus whitespace'
   106 endif
   107 ifeq ($(FOO), foo ) # But not trailing whitespace
   108 	echo TEST-FAIL 'FOO plus trailing whitespace'
   109 endif
   110 ifeq ( $(FOO),foo) # Not whitespace after the paren
   111 	echo TEST-FAIL 'FOO with leading whitespace'
   112 endif
   113 ifeq ($(FOO),$(NULL) foo) # Nor whitespace after expansion
   114 	echo TEST-FAIL 'FOO with embedded ws'
   115 endif
   116 ifeq ($(BAR2),bar)
   117 	echo TEST-FAIL 'BAR2 eq bar'
   118 endif
   119 ifeq '$(BAR3FOUND)' 'false'
   120 	echo BAR3FOUND is ok
   121 else
   122 	echo TEST-FAIL BAR3FOUND is not ok
   123 endif
   124 ifndef FOO
   125 	echo TEST-FAIL "foo not defined?"
   126 endif
   127 	@echo TEST-PASS

mercurial