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