DiscussionXcodeIn cross-development programming, the options are described in this article.XcodeIn cross-programming, let's look at the content first.
Select the OS SDK for development
To select the SDK in makefile, you must add the appropriate option to the compilation and connection commands of the project, that is, add the-isysroot option to the compiler, and add the-syslibroot option to the connector. If you use GCC 4.0 for compilation and connection, you should add both options to the command line at the same time.
-The isysroot and-syslibroot options both require specifying the full path of the SDK directory you want to use. The best practice is to create a makefile directory variable to specify this path. The following example shows how to assign a value to the makefile variable in a simple C program:
- SDK=/Developer/SDKs/MacOSX10.4.0.sdk
- CFLAGS= -isysroot ${SDK}
- LDFLAGS= -isysroot ${SDK} -Wl,-syslibroot,${SDK}
NOTE: If your makefile directly passes the LDFLAGS option to ld instead of gcc, you should specify the connector option as LDFLAGS =-syslibroot $ {SDK }, because ld does not support the-Wl syntax.
The SDK directory is located in the/Developer/SDKs path. Your own connector switch should naturally include other compiler and connector options required by the program.
Important: GCC 4.0 supports the-isysroot switch, but it is not described on the compiler man page, because this function may change in the future. If this function is formally added to the compiler, corresponding update information will be added to the man page. Earlier GCC versions do not support this switch.
Select OS Deployment
You must use another makefile variable to set the deployment target in makefile. The format is as follows:
- ENVP= MACOSX_DEPLOYMENT_TARGET=10.3
The value of the MACOSX_DEPLOYMENT_TARGET option determines the earliest target system version that your software needs to support. In the previous example, the target system is 10.3. In makefile, include this variable before your compilation and connection commands. For example, a simple C program may use the following concatenation command:
- testapp: main.o
- ${ENVP} ${CC} ${LDFLAGS} -o testapp main.o
- main.o:
- ${ENVP} ${CC} ${CFLAGS} -c main.c -o main.o
Summary: IntroductionXcodeThe option content in cross-development programming is introduced. I hope this article will help you in your learning process!