]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/cpu-sub-types/Makefile
ld64-127.2.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 test: test-${ARCH}
31
32 test-ppc64:
33 ${PASS_IFF} true
34
35 test-i386:
36 ${PASS_IFF} true
37
38 test-x86_64:
39 ${PASS_IFF} true
40
41 test-armv6: test-arm
42 test-armv7: test-arm
43
44 test-arm:
45 clang foo.c -arch armv4t -c -o foo-v4.o
46 ${FAIL_IF_BAD_OBJ} foo-v4.o
47 clang foo.c -arch armv5 -c -o foo-v5.o
48 ${FAIL_IF_BAD_OBJ} foo-v5.o
49 clang foo.c -arch armv6 -c -o foo-v6.o
50 ${FAIL_IF_BAD_OBJ} foo-v6.o
51 clang foo.c -arch armv7 -c -o foo-v7.o
52 ${FAIL_IF_BAD_OBJ} foo-v7.o
53 clang foo.c -arch xscale -c -o foo-xscale.o
54 ${FAIL_IF_BAD_OBJ} foo-xscale.o
55 clang main.c -arch armv4t -c -o main-v4.o
56 ${FAIL_IF_BAD_OBJ} main-v4.o
57 clang main.c -arch armv5 -c -o main-v5.o
58 ${FAIL_IF_BAD_OBJ} main-v5.o
59 clang main.c -arch armv6 -c -o main-v6.o
60 ${FAIL_IF_BAD_OBJ} main-v6.o
61 clang main.c -arch xscale -c -o main-xscale.o
62 ${FAIL_IF_BAD_OBJ} main-xscale.o
63 clang main.c -arch armv7 -c -o main-v7.o
64 ${FAIL_IF_BAD_OBJ} main-v7.o
65
66 # check V4+V4 -> V4
67 ${LD} -r main-v4.o foo-v4.o -o all.o
68 ${FAIL_IF_BAD_OBJ} all.o
69 otool -hv all.o | grep V4T | ${FAIL_IF_EMPTY}
70
71 # check V4+V5 -> V5
72 #${LD} -r main-v4.o foo-v5.o -o all.o
73 #${FAIL_IF_BAD_OBJ} all.o
74 #otool -hv all.o | grep V5 | ${FAIL_IF_EMPTY}
75
76 # check V4+V6 -> V6
77 #${LD} -r main-v4.o foo-v6.o -o all.o
78 #${FAIL_IF_BAD_OBJ} all.o
79 #otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
80
81 # check V4+xscale -> xscale
82 #${LD} -r main-v4.o foo-xscale.o -o all.o
83 #${FAIL_IF_BAD_OBJ} all.o
84 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
85
86 # check V5+V5 -> V5
87 ${LD} -r main-v5.o foo-v5.o -o all.o
88 ${FAIL_IF_BAD_OBJ} all.o
89 otool -hv all.o | grep V5 | ${FAIL_IF_EMPTY}
90
91 # check V5+V6 -> V6
92 #${LD} -r main-v5.o foo-v6.o -o all.o
93 #${FAIL_IF_BAD_OBJ} all.o
94 #otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
95
96 # check V5+xscale -> xscale
97 #${LD} -r main-v5.o foo-xscale.o -o all.o
98 #${FAIL_IF_BAD_OBJ} all.o
99 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
100
101 # check V6+V6 -> V6
102 ${LD} -r main-v6.o foo-v6.o -o all.o
103 ${FAIL_IF_BAD_OBJ} all.o
104 otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
105
106 # check V7+V7 -> V7
107 ${LD} -r main-v7.o foo-v7.o -o all.o
108 ${FAIL_IF_BAD_OBJ} all.o
109 otool -hv all.o | grep V7 | ${FAIL_IF_EMPTY}
110
111 # check xscale+xscale -> xscale
112 #${LD} -r main-xscale.o foo-xscale.o -o all.o
113 #${FAIL_IF_BAD_OBJ} all.o
114 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
115
116 ${PASS_IFF} true
117
118
119 test-ppc:
120 gcc foo.c -arch ppc -mmacosx-version-min=10.4 -c -o foo.o
121 ${FAIL_IF_BAD_OBJ} foo.o
122 gcc foo.c -arch ppc750 -c -o foo-G3.o
123 ${FAIL_IF_BAD_OBJ} foo-G3.o
124 gcc foo.c -arch ppc7400 -c -o foo-G4.o
125 ${FAIL_IF_BAD_OBJ} foo-G4.o
126 gcc foo.c -arch ppc970 -c -o foo-G5.o
127 ${FAIL_IF_BAD_OBJ} foo-G5.o
128 gcc main.c -arch ppc -mmacosx-version-min=10.4 -c -o main.o
129 ${FAIL_IF_BAD_OBJ} main.o
130 gcc main.c -arch ppc970 -c -o main-G5.o
131 ${FAIL_IF_BAD_OBJ} main-G5.o
132
133 # check ALL+ALL -> ALL
134 ${LD} -r main.o foo.o -o main-r.o
135 ${FAIL_IF_BAD_OBJ} main-r.o
136 otool -hv main-r.o | grep ALL | ${FAIL_IF_EMPTY}
137
138 # check G3+ALL -> G3
139 ${LD} -r main.o foo-G3.o -o main-r.o
140 ${FAIL_IF_BAD_OBJ} main-r.o
141 otool -hv main-r.o | grep ppc750 | ${FAIL_IF_EMPTY}
142
143 # check G4+ALL -> G4
144 ${LD} -r main.o foo-G4.o -o main-r.o
145 ${FAIL_IF_BAD_OBJ} main-r.o
146 otool -hv main-r.o | grep ppc7400 | ${FAIL_IF_EMPTY}
147
148 # check G5+ALL -> G5
149 ${LD} -r main.o foo-G5.o -o main-r.o
150 ${FAIL_IF_BAD_OBJ} main-r.o
151 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
152
153 # check G5+G4 -> G5
154 ${LD} -r main-G5.o foo-G4.o -o main-r.o
155 ${FAIL_IF_BAD_OBJ} main-r.o
156 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
157
158 # check G4+G5 -> G5
159 ${LD} -r foo-G4.o main-G5.o -o main-r.o
160 ${FAIL_IF_BAD_OBJ} main-r.o
161 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
162
163 # check -force_cpusubtype_ALL
164 ${LD} -r main.o foo-G5.o -o main-r.o -force_cpusubtype_ALL
165 ${FAIL_IF_BAD_OBJ} main-r.o
166 otool -hv main-r.o | grep ALL | ${PASS_IFF_STDIN}
167
168 clean:
169 rm -f *.o