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