Search code examples
xcodexcode4.5

Where to put makefile flags in a Xcode project?


In the makefile:

 CUSTOM_CFLAGS=-Wall -ggdb3 -O3 -std=gnu99 -frename-registers -pthread -Wsign-compare -D_GNU_SOURCE

 SYS_CFLAGS=-DNO_THREAD_LOCAL
 LDFLAGS=-pthread -rdynamic
 LIBS=-lm -ldl

Where should I put the above in Xcode project?


Solution

  • Makefile flags correspond to Xcode build settings. Look into the following build settings:

    Optimization Level for the -O3 flag. C Language Dialect for the -std=gnu99 flag. Other C Flags for the other flags in the CUSTOM_CFLAGS and SYS_CFLAGS flags. Other Linker Flags for the LDFLAGS and LIBS flags.

    Xcode may have build settings for some of the flags in the makefile's CUSTOM_CFLAGS flag list and the linker flags. I haven't memorized the build settings list. If you open the Quick Help inspector, you can read a description of each build setting by selecting the build setting from the build settings list. Choose View > Utilities > Show Quick Help Inspector to show the Quick Help inspector.

    If you don't know where to find Xcode's build settings, read the following article:

    Xcode 4: Accessing Build Settings