]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/allowable-client/Makefile
88e215bdeff57b598542e67f644d1e092454f630
[apple/ld64.git] / unit-tests / test-cases / allowable-client / Makefile
1 ##
2 # Copyright (c) 2005 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 ##
23 TESTROOT = ../..
24 include ${TESTROOT}/include/common.makefile
25
26 #
27 # Test that the -allowable_client and -client options
28 # work when linking against subframeworks.
29 #
30
31 run: all
32
33 all:
34 # build with two allowable_clients
35 ${CC} ${CCFLAGS} -dynamiclib -umbrella foo -allowable_client bar -allowable_client baz foo.c -o foo.${ARCH}.dylib
36 ${FAIL_IF_BAD_MACHO} foo.${ARCH}.dylib
37
38 # test that -o works
39 ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.${ARCH}.dylib foo.${ARCH}.dylib
40 ${FAIL_IF_BAD_MACHO} libbar.${ARCH}.dylib
41
42 # test that a framework style output works
43 mkdir -p bar.framework
44 ${CC} ${CCFLAGS} -dynamiclib bar.c -o bar.framework/bar foo.${ARCH}.dylib
45 ${FAIL_IF_BAD_MACHO} bar.framework/bar
46
47 # test that second -o works
48 ${CC} ${CCFLAGS} -dynamiclib baz.c -o libbaz.${ARCH}.dylib foo.${ARCH}.dylib
49
50 # test that -o and -install_name works with install_name as an allowable
51 ${CC} ${CCFLAGS} -dynamiclib bar.c -o temp.${ARCH}.dylib -install_name /tmp/libbar.${ARCH}.dylib foo.${ARCH}.dylib
52 ${FAIL_IF_BAD_MACHO} temp.${ARCH}.dylib
53
54 # test that -o and -install_name fails with install_name different than allowable
55 ### ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} -dynamiclib bar.c -o bar.${ARCH}.dylib -install_name /tmp/fail.${ARCH}.dylib foo.${ARCH}.dylib >& fail.log
56
57 # test that a bundle and no client_name fails
58 ### ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} -bundle bar.c -o temp.${ARCH}.bundle foo.${ARCH}.dylib >& fail.log
59
60 # test that a bundle and an allowable client_name passes
61 ${CC} ${CCFLAGS} -bundle bar.c -client_name bar -o bar.${ARCH}.bundle foo.${ARCH}.dylib
62 ${FAIL_IF_BAD_MACHO} bar.${ARCH}.bundle
63
64 # test umbrella can link against subs
65 mkdir -p foo.framework
66 ${CC} ${CCFLAGS} -dynamiclib foo.${ARCH}.dylib -o foo.framework/foo
67 ${FAIL_IF_BAD_MACHO} foo.framework/foo
68
69 # test sibling in umbrella can link against subs
70 ${CC} ${CCFLAGS} -dynamiclib main.c -umbrella foo foo.${ARCH}.dylib -o ./main.dylib
71 ${FAIL_IF_BAD_MACHO} main.dylib
72
73 # test anyone can link against umbrella
74 ${CC} ${CCFLAGS} main.c -o main.${ARCH} -framework foo -F.
75 ${FAIL_IF_BAD_MACHO} main.${ARCH}
76
77 # test that an executable and no client_name fails
78 ### ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} main.c -o main.${ARCH} foo.${ARCH}.dylib >& fail.log
79
80 # test that an executable and an allowable client_name passes
81 # ${CC} ${CCFLAGS} main.c -o main.${ARCH} -client_name bar foo.${ARCH}.dylib
82 # ${PASS_IFF_GOOD_MACHO} main.${ARCH}
83
84
85 # print final pass
86 ${PASS_IFF_GOOD_MACHO} foo.${ARCH}.dylib
87
88 clean:
89
90 rm -rf *.${ARCH}.dylib *.${ARCH}.bundle main.${ARCH} fail.log foo.framework bar.framework main.dylib