build/pymake/tests/ifdefs.mk

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

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

mercurial