]> git.saurik.com Git - apple/ld64.git/blame - unit-tests/test-cases/llvm-integration/Makefile
ld64-77.1.tar.gz
[apple/ld64.git] / unit-tests / test-cases / llvm-integration / Makefile
CommitLineData
a61fdf0a
A
1##
2# Copyright (c) 2006 Apple Computer, 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##
23TESTROOT = ../..
24include ${TESTROOT}/include/common.makefile
25LLVMGCC = /usr/local/bin/llvm-gcc
26LLVMGXX = /usr/local/bin/llvm-g++
27#
28# Test the we set the stack execution bit properly.
29
30run:
31 @if [ -f /usr/local/bin/llvm-gcc ] ; then \
32 $(MAKE) all ; \
33 else \
34 ${PASS_IFF} /usr/bin/true ; \
35 fi
36
37all: zero one two three four five six seven eight nine ten eleven twelve thirteen
38
39
40zero:
41 #
42 # llvm : a.c : Dfoo3
43 # llvm : b.c : Dfoo2
44 # MachO : main.c : Ufoo2, Ufoo3
45 #
46 #echo "Zero..."
47 ${LLVMGCC} ${CCFLAGS} --emit-llvm a.c -c -o a-${ARCH}.o ${OTHER}
48 ${LLVMGCC} ${CCFLAGS} --emit-llvm b.c -c -o b-${ARCH}.o
49 ${LLVMGCC} ${CCFLAGS} main.c -c -o main-${ARCH}.o
50 ${LLVMGCC} ${CCFLAGS} a-${ARCH}.o b-${ARCH}.o main-${ARCH}.o -o main-${ARCH}
51 ${PASS_IFF_GOOD_MACHO} main-${ARCH}
52 ${PASS_IFF} ./main-${ARCH}
53
54one:
55 #
56 # llvm : a1.c : Dfoo3, Ufoo4
57 # llvm : b1.c : Dfoo2, Ufoo4
58 # MachO : main1.c : Dfoo4, Ufoo2, Ufoo3
59 #
60 #echo "One..."
61 ${LLVMGCC} ${CCFLAGS} --emit-llvm a1.c -c -o a1-${ARCH}.o
62 ${LLVMGCC} ${CCFLAGS} --emit-llvm b1.c -c -o b1-${ARCH}.o
63 ${LLVMGCC} ${CCFLAGS} main1.c -c -o main1-${ARCH}.o
64 ${LLVMGCC} ${CCFLAGS} a1-${ARCH}.o b1-${ARCH}.o main1-${ARCH}.o -o main1-${ARCH}
65 ${PASS_IFF_GOOD_MACHO} main1-${ARCH}
66 ${PASS_IFF} ./main1-${ARCH}
67
68two:
69 #
70 # llvm : a2.c : Dfoo3, Ufoo4
71 # llvm : b2.c : Dfoo2, Dfoo4
72 # MachO : main2.c : Ufoo2, Ufoo3
73 #
74 #echo "Two..."
75 ${LLVMGCC} ${CCFLAGS} --emit-llvm a2.c -c -o a2-${ARCH}.o
76 ${LLVMGCC} ${CCFLAGS} --emit-llvm b2.c -c -o b2-${ARCH}.o
77 ${LLVMGCC} ${CCFLAGS} main2.c -c -o main2-${ARCH}.o
78 ${LLVMGCC} ${CCFLAGS} a2-${ARCH}.o b2-${ARCH}.o main2-${ARCH}.o -o main2-${ARCH}
79 ${PASS_IFF_GOOD_MACHO} main2-${ARCH}
80 ${PASS_IFF} ./main2-${ARCH}
81
82three:
83 #
84 # llvm : a3.c : Dfoo1, Dbar
85 # llvm : b3.c : Dfoo2, Ubar
86 # MachO : main3.c : Ufoo1, Ufoo2, Ubar
87 #
88 #echo "Three..."
89 ${LLVMGCC} ${CCFLAGS} --emit-llvm a3.c -c -o a3-${ARCH}.o
90 ${LLVMGCC} ${CCFLAGS} --emit-llvm b3.c -c -o b3-${ARCH}.o
91 ${LLVMGCC} ${CCFLAGS} main3.c -c -o main3-${ARCH}.o
92 ${LLVMGCC} ${CCFLAGS} a3-${ARCH}.o b3-${ARCH}.o main3-${ARCH}.o -o main3-${ARCH}
93 ${PASS_IFF_GOOD_MACHO} main3-${ARCH}
94 ${PASS_IFF} ./main3-${ARCH}
95
96four:
97 #
98 # llvm : a4.c : Dfoo3, Ufoo4
99 # llvm : b4.c : Dfoo2, DLmyfoo, Ufoo4
100 # MachO : main4.c : Dfoo4, Ufoo2, Ufoo3
101 #
102 #echo "Four..."
103 ${LLVMGCC} ${CCFLAGS} --emit-llvm a4.c -c -o a4-${ARCH}.o
104 ${LLVMGCC} ${CCFLAGS} --emit-llvm b4.c -c -o b4-${ARCH}.o
105 ${LLVMGCC} ${CCFLAGS} main4.c -c -o main4-${ARCH}.o
106 ${LLVMGCC} ${CCFLAGS} a4-${ARCH}.o b4-${ARCH}.o main4-${ARCH}.o -o main4-${ARCH}
107 ${PASS_IFF_GOOD_MACHO} main4-${ARCH}
108 ${PASS_IFF} ./main4-${ARCH}
109
110five:
111 #
112 # llvm : a5.c : Dfoo1, Ufoo2, Ufoo3
113 # llvm : b5.c : Dfoo2
114 # MachO : main5.c : Dfoo3, Ufoo1
115 #
116 #echo "Five..."
117 ${LLVMGCC} ${CCFLAGS} --emit-llvm a5.c -c -o a5-${ARCH}.o
118 ${LLVMGCC} ${CCFLAGS} --emit-llvm b5.c -c -o b5-${ARCH}.o
119 ${LLVMGCC} ${CCFLAGS} main5.c -c -o main5-${ARCH}.o
120 ${LLVMGCC} ${CCFLAGS} a5-${ARCH}.o b5-${ARCH}.o main5-${ARCH}.o -o main5-${ARCH} -Wl,-dead_strip
121 ${PASS_IFF_GOOD_MACHO} main5-${ARCH}
122 ${PASS_IFF} ./main5-${ARCH}
123 ${OTOOL} -tV main5-${ARCH} | grep foo3 | ${PASS_IFF_EMPTY}
124
125six:
126 #
127 # llvm : a6.c : Dfoo1, Dfoo2
128 # MachO : main6.c : Ufoo1
129 #
130 #echo "Six..."
131 ${LLVMGCC} ${CCFLAGS} --emit-llvm a6.c -c -o a6-${ARCH}.o
132 ${LLVMGCC} ${CCFLAGS} main6.c -c -o main6-${ARCH}.o
133 ${LLVMGCC} ${CCFLAGS} a6-${ARCH}.o main6-${ARCH}.o -o main6-${ARCH} -Wl,-dead_strip
134 ${PASS_IFF_GOOD_MACHO} main6-${ARCH}
135 ${PASS_IFF} ./main6-${ARCH}
136 ${OTOOL} -tV main6-${ARCH} | grep foo2 | ${PASS_IFF_EMPTY}
137
138seven:
139 #
140 # llvm : a7.c : Dfoo1, Dfoo2, Ufoo3
141 # llvm : b7.c : Dfoo3, ufoo2
142 # MachO : main7.c : Ufoo1
143 #
144 #echo "Seven..."
145 ${LLVMGCC} ${CCFLAGS} --emit-llvm a7.c -c -o a7-${ARCH}.o
146 ${LLVMGCC} ${CCFLAGS} --emit-llvm b7.c -c -o b7-${ARCH}.o
147 ${LLVMGCC} ${CCFLAGS} main7.c -c -o main7-${ARCH}.o
148 ${LLVMGCC} ${CCFLAGS} a7-${ARCH}.o b7-${ARCH}.o main7-${ARCH}.o -o main7-${ARCH}
149 ${PASS_IFF_GOOD_MACHO} main7-${ARCH}
150 ${PASS_IFF} ./main7-${ARCH}
151
152eight:
153 #
154 # llvm : a8.c : Dfoo1, Dfoo2
155 # MachO : main8.c : Ufoo1
156 #
157 #echo "Eight..."
158 ${LLVMGCC} ${CCFLAGS} --emit-llvm a8.c -c -o a8-${ARCH}.o
159 ${LLVMGCC} ${CCFLAGS} main8.c -c -o main8-${ARCH}.o
160 ${LLVMGCC} ${CCFLAGS} a8-${ARCH}.o main8-${ARCH}.o -o main8-${ARCH} -Wl,-dead_strip
161 ${PASS_IFF} ./main8-${ARCH}
162 ${OTOOL} -tV main8-${ARCH} | grep foo2 | ${PASS_IFF_EMPTY}
163 ${OTOOL} -tV main8-${ARCH} | grep unnamed_2_1 | ${PASS_IFF_EMPTY}
164
165nine:
166 #
167 # llvm : a9.c : Dfoo1, Dfoo2, Dfoo3, Ufoo3, Ufoo4
168 # MachO : main9.c : Ufoo1, Dfoo4
169 #
170 #echo "Nine..."
171 ${LLVMGCC} ${CCFLAGS} --emit-llvm a9.c -c -o a9-${ARCH}.o
172 ${LLVMGCC} ${CCFLAGS} main9.c -c -o main9-${ARCH}.o
173 ${LLVMGCC} ${CCFLAGS} a9-${ARCH}.o main9-${ARCH}.o -o main9-${ARCH} -Wl,-dead_strip
174 ${PASS_IFF} ./main9-${ARCH}
175 ${OTOOL} -tV main9-${ARCH} | grep foo2 | ${PASS_IFF_EMPTY}
176 ${OTOOL} -tV main9-${ARCH} | grep foo4 | ${PASS_IFF_EMPTY}
177 ${OTOOL} -tV main9-${ARCH} | grep unnamed_2_1 | ${PASS_IFF_EMPTY}
178
179ten:
180 #
181 # llvm : a10.c
182 # llvm : b10.c
183 # MachO : main10.c
184 #
185 #echo "Ten..."
186 ${LLVMGCC} ${CCFLAGS} --emit-llvm a10.c -c -o a10-${ARCH}.o
187 ${LLVMGCC} ${CCFLAGS} --emit-llvm b10.c -c -o b10-${ARCH}.o
188 ${LLVMGCC} ${CCFLAGS} main10.c -c -o main10-${ARCH}.o
189 ${LLVMGCC} ${CCFLAGS} a10-${ARCH}.o b10-${ARCH}.o main10-${ARCH}.o -o main10-${ARCH}
190 ${PASS_IFF_GOOD_MACHO} main10-${ARCH}
191
192eleven:
193 #
194 # llvm : a11.c
195 # MachO : main11.c
196 #
197 #echo "Eleven..."
198 ${LLVMGCC} ${CCFLAGS} --emit-llvm a11.c -c -o a11-${ARCH}.o
199 ${LLVMGCC} ${CCFLAGS} main11.c -c -o main11-${ARCH}.o
200 ${LLVMGCC} ${CCFLAGS} a11-${ARCH}.o main11-${ARCH}.o -o main11-${ARCH}
201 ${PASS_IFF_GOOD_MACHO} main11-${ARCH}
202 ./main11-${ARCH} >& /dev/null
203
204twelve:
205 #
206 # llvm : a12.c
207 # MachO : main12.c
208 #
209 #echo "Tweleve..."
210 ${LLVMGCC} ${CCFLAGS} --emit-llvm a12.c -c -o a12-${ARCH}.o
211 ${LLVMGCC} ${CCFLAGS} main12.c -c -o main12-${ARCH}.o
212 ${LLVMGCC} ${CCFLAGS} a12-${ARCH}.o main12-${ARCH}.o -o main12-${ARCH}
213 ${PASS_IFF_GOOD_MACHO} main12-${ARCH}
214 ./main12-${ARCH}
215
216thirteen:
217 #
218 # llvm : a13.cc
219 # MachO : main13.cc
220 #
221 # echo "Thirteen..."
222 ${LLVMGCC} ${CXXFLAGS} --emit-llvm a13.cc -c -o a13-${ARCH}.o
223 ${LLVMGCC} ${CXXFLAGS} main13.cc -c -o main13-${ARCH}.o
224 ${LLVMGXX} a13-${ARCH}.o main13-${ARCH}.o -o main13-${ARCH}
225 ${PASS_IFF_GOOD_MACHO} main13-${ARCH}
226
227
228clean:
229 rm -rf *.o main*-* big.*