]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/cpu-sub-types/Makefile
ld64-236.3.tar.gz
[apple/ld64.git] / unit-tests / test-cases / cpu-sub-types / Makefile
1 ##
2 # Copyright (c) 2007 Apple Inc. All rights reserved.
3 #
4 # @APPLE_LICENSE_HEADER_START@
5 #
6 # This file contains Original Code and/or Modifications of Original Code
7 # as defined in and that are subject to the Apple Public Source License
8 # Version 2.0 (the 'License'). You may not use this file except in
9 # compliance with the License. Please obtain a copy of the License at
10 # http://www.opensource.apple.com/apsl/ and read it before using this
11 # file.
12 #
13 # The Original Code and all software distributed under the License are
14 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 # Please see the License for the specific language governing rights and
19 # limitations under the License.
20 #
21 # @APPLE_LICENSE_HEADER_END@
22 ##
23 TESTROOT = ../..
24 include ${TESTROOT}/include/common.makefile
25
26 #
27 # Validate cpu subtypes processing
28 #
29
30 CC_ARM = $(shell xcrun -find clang) -miphoneos-version-min=5.0 -isysroot ${IOS_SDK}
31
32 test: test-${ARCH}
33
34 test-ppc64:
35 ${PASS_IFF} true
36
37 test-i386:
38 ${PASS_IFF} true
39
40 test-x86_64:
41 ${PASS_IFF} true
42
43 test-armv6: test-arm
44 test-armv7: test-arm
45
46 test-arm:
47 ${CC_ARM} foo.c -arch armv4t -c -o foo-v4.o
48 ${FAIL_IF_BAD_OBJ} foo-v4.o
49 ${CC_ARM} foo.c -arch armv5 -c -o foo-v5.o
50 ${FAIL_IF_BAD_OBJ} foo-v5.o
51 ${CC_ARM} foo.c -arch armv6 -c -o foo-v6.o
52 ${FAIL_IF_BAD_OBJ} foo-v6.o
53 ${CC_ARM} foo.c -arch armv7 -c -o foo-v7.o
54 ${FAIL_IF_BAD_OBJ} foo-v7.o
55 ${CC_ARM} foo.c -arch xscale -c -o foo-xscale.o
56 ${FAIL_IF_BAD_OBJ} foo-xscale.o
57 ${CC_ARM} main.c -arch armv4t -c -o main-v4.o
58 ${FAIL_IF_BAD_OBJ} main-v4.o
59 ${CC_ARM} main.c -arch armv5 -c -o main-v5.o
60 ${FAIL_IF_BAD_OBJ} main-v5.o
61 ${CC_ARM} main.c -arch armv6 -c -o main-v6.o
62 ${FAIL_IF_BAD_OBJ} main-v6.o
63 ${CC_ARM} main.c -arch xscale -c -o main-xscale.o
64 ${FAIL_IF_BAD_OBJ} main-xscale.o
65 ${CC_ARM} main.c -arch armv7 -c -o main-v7.o
66 ${FAIL_IF_BAD_OBJ} main-v7.o
67
68 # check V4+V4 -> V4
69 # ${LD} -r main-v4.o foo-v4.o -o all.o
70 # ${FAIL_IF_BAD_OBJ} all.o
71 # otool -hv all.o | grep V4T | ${FAIL_IF_EMPTY}
72
73 # check V4+V5 -> V5
74 #${LD} -r main-v4.o foo-v5.o -o all.o
75 #${FAIL_IF_BAD_OBJ} all.o
76 #otool -hv all.o | grep V5 | ${FAIL_IF_EMPTY}
77
78 # check V4+V6 -> V6
79 #${LD} -r main-v4.o foo-v6.o -o all.o
80 #${FAIL_IF_BAD_OBJ} all.o
81 #otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
82
83 # check V4+xscale -> xscale
84 #${LD} -r main-v4.o foo-xscale.o -o all.o
85 #${FAIL_IF_BAD_OBJ} all.o
86 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
87
88 # check V5+V5 -> V5
89 # ${LD} -r main-v5.o foo-v5.o -o all.o
90 # ${FAIL_IF_BAD_OBJ} all.o
91 # otool -hv all.o | grep V5 | ${FAIL_IF_EMPTY}
92
93 # check V5+V6 -> V6
94 #${LD} -r main-v5.o foo-v6.o -o all.o
95 #${FAIL_IF_BAD_OBJ} all.o
96 #otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
97
98 # check V5+xscale -> xscale
99 #${LD} -r main-v5.o foo-xscale.o -o all.o
100 #${FAIL_IF_BAD_OBJ} all.o
101 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
102
103 # check V6+V6 -> V6
104 ${LD} -r main-v6.o foo-v6.o -o all.o
105 ${FAIL_IF_BAD_OBJ} all.o
106 otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
107
108 # check V7+V7 -> V7
109 ${LD} -r main-v7.o foo-v7.o -o all.o
110 ${FAIL_IF_BAD_OBJ} all.o
111 otool -hv all.o | grep V7 | ${FAIL_IF_EMPTY}
112
113 # check xscale+xscale -> xscale
114 #${LD} -r main-xscale.o foo-xscale.o -o all.o
115 #${FAIL_IF_BAD_OBJ} all.o
116 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
117
118 ${PASS_IFF} true
119
120
121 test-ppc:
122 gcc foo.c -arch ppc -mmacosx-version-min=10.4 -c -o foo.o
123 ${FAIL_IF_BAD_OBJ} foo.o
124 gcc foo.c -arch ppc750 -c -o foo-G3.o
125 ${FAIL_IF_BAD_OBJ} foo-G3.o
126 gcc foo.c -arch ppc7400 -c -o foo-G4.o
127 ${FAIL_IF_BAD_OBJ} foo-G4.o
128 gcc foo.c -arch ppc970 -c -o foo-G5.o
129 ${FAIL_IF_BAD_OBJ} foo-G5.o
130 gcc main.c -arch ppc -mmacosx-version-min=10.4 -c -o main.o
131 ${FAIL_IF_BAD_OBJ} main.o
132 gcc main.c -arch ppc970 -c -o main-G5.o
133 ${FAIL_IF_BAD_OBJ} main-G5.o
134
135 # check ALL+ALL -> ALL
136 ${LD} -r main.o foo.o -o main-r.o
137 ${FAIL_IF_BAD_OBJ} main-r.o
138 otool -hv main-r.o | grep ALL | ${FAIL_IF_EMPTY}
139
140 # check G3+ALL -> G3
141 ${LD} -r main.o foo-G3.o -o main-r.o
142 ${FAIL_IF_BAD_OBJ} main-r.o
143 otool -hv main-r.o | grep ppc750 | ${FAIL_IF_EMPTY}
144
145 # check G4+ALL -> G4
146 ${LD} -r main.o foo-G4.o -o main-r.o
147 ${FAIL_IF_BAD_OBJ} main-r.o
148 otool -hv main-r.o | grep ppc7400 | ${FAIL_IF_EMPTY}
149
150 # check G5+ALL -> G5
151 ${LD} -r main.o foo-G5.o -o main-r.o
152 ${FAIL_IF_BAD_OBJ} main-r.o
153 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
154
155 # check G5+G4 -> G5
156 ${LD} -r main-G5.o foo-G4.o -o main-r.o
157 ${FAIL_IF_BAD_OBJ} main-r.o
158 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
159
160 # check G4+G5 -> G5
161 ${LD} -r foo-G4.o main-G5.o -o main-r.o
162 ${FAIL_IF_BAD_OBJ} main-r.o
163 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
164
165 # check -force_cpusubtype_ALL
166 ${LD} -r main.o foo-G5.o -o main-r.o -force_cpusubtype_ALL
167 ${FAIL_IF_BAD_OBJ} main-r.o
168 otool -hv main-r.o | grep ALL | ${PASS_IFF_STDIN}
169
170 clean:
171 rm -f *.o