]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/sym-link-load/Makefile
dyld-45.3.tar.gz
[apple/dyld.git] / unit-tests / test-cases / sym-link-load / 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 ### This test case is to verify that dyld cannot be tricked into loading
28 ### the "same" library twice.
29 ###
30 ### The tricky scenario is:
31 ### 1) a library dyld is to load is specified with a symlink path
32 ### 2) the library the that is the target of the symlink is already loaded
33 ### via a different path. In this case becuase of DYLD_LIBRARY_PATH.
34 ###
35 ###
36 ###
37 ###
38
39
40
41 run: all
42 ./main
43 export DYLD_LIBRARY_PATH="`pwd`/fake" && ./main
44
45
46 all: main real/liblink.dylib real/libtest.dylib fake/libtest.dylib
47
48
49 main: main.c stub/libtest.dylib stub/liblink.dylib real/libbase.dylib
50 ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c stub/libtest.dylib stub/liblink.dylib real/libbase.dylib
51
52 stub/libtest.dylib: test.c
53 mkdir -p stub
54 ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib test.c -DDO_NOTHING -o stub/libtest.dylib -install_name "`pwd`/real/libtest.dylib"
55
56 stub/liblink.dylib: link.c
57 mkdir -p stub
58 ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib link.c -o stub/liblink.dylib -install_name "`pwd`/real/liblink.dylib"
59
60
61 real/libbase.dylib: base.c
62 mkdir -p real
63 ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib base.c -o "`pwd`/real/libbase.dylib"
64
65 real/libtest.dylib: test.c real/libbase.dylib
66 mkdir -p real
67 ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib test.c real/libbase.dylib -o "`pwd`/real/libtest.dylib"
68
69 real/liblink.dylib: link.c
70 mkdir -p real
71 cd real && ln -s libtest.dylib liblink.dylib
72
73
74 fake/libtest.dylib: test.c real/libbase.dylib
75 mkdir -p fake
76 ${CC} ${CCFLAGS} -I${TESTROOT}/include -dynamiclib test.c real/libbase.dylib -o "`pwd`/fake/libtest.dylib" -install_name "`pwd`/real/libtest.dylib"
77
78
79
80
81 clean:
82 ${RM} ${RMFLAGS} *~ main real stub fake
83