]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/kext-basic/Makefile
ld64-127.2.tar.gz
[apple/ld64.git] / unit-tests / test-cases / kext-basic / Makefile
1
2 TESTROOT = ../..
3 include ${TESTROOT}/include/common.makefile
4
5 #
6 # Sanity check that ld can link a kext
7 #
8 FILE_TYPE = OBJECT
9 ifeq (${ARCH},x86_64)
10 FILE_TYPE = KEXTBUNDLE
11 endif
12 ifeq (${FILEARCH},arm)
13 FILE_TYPE = KEXTBUNDLE
14 endif
15
16 #CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang
17
18 run: all
19
20 all:
21 ${CC} ${CCFLAGS} -static -mkernel -c mykext.c -o mykext.o
22 ${CC} ${CCFLAGS} -static -mkernel -c mykextinfo.c -o mykextinfo.o
23 ${CC} ${CCFLAGS} -Wl,-kext mykext.o mykextinfo.o -nostdlib -lkmodc++ -lkmod -lcc_kext -o mykext -Wl,-w -Wl,-new_linker
24 otool -hv mykext | grep ${FILE_TYPE} | ${FAIL_IF_EMPTY}
25 nm -nm mykext | grep '(undefined) external _extern_global' | ${FAIL_IF_EMPTY}
26 nm -nm mykext | grep '(__DATA,__data) external _my_global' | ${FAIL_IF_EMPTY}
27 otool -rv mykext | grep '_extern_global' | ${FAIL_IF_EMPTY}
28 ${PASS_IFF} true
29
30 clean:
31 rm -f mykext.o mykextinfo.o mykext