-LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
-CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
- -I$(PROJ_OBJ_ROOT)/include \
- -I$(PROJ_SRC_ROOT)/include \
- -I$(LLVM_OBJ_ROOT)/include \
- -I$(LLVM_SRC_ROOT)/include \
- -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
+# If we are building a universal binary on Mac OS/X, pass extra options. This is
+# useful to people that want to link the LLVM libraries into their universal apps.
+ifdef UNIVERSAL
+ CompileCommonOpts += \
+ -arch i386 -arch ppc -isysroot /Developer/SDKs/MACOSX10.4u.sdk/
+ Relink.Flags := -XCClinker -arch -XCClinker i386 -XCClinker -arch \
+ -XCClinker ppc -XCClinker \
+ -isysroot -XCClinker /Developer/SDKs/MACOSX10.4u.sdk/
+ DISABLE_AUTO_DEPENDENCIES=1
+endif
+
+# Temporary workaround for a Mac OSX / x86 compatibility issue.
+ifeq ($(OS),Darwin)
+ifeq ($(ARCH),x86)
+ CXX.Flags += -fno-use-cxa-atexit
+endif
+endif
+
+LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
+CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
+# All -I flags should go here, so that they don't confuse llvm-config.
+CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
+ -I$(PROJ_OBJ_ROOT)/include \
+ -I$(PROJ_SRC_ROOT)/include \
+ -I$(LLVM_OBJ_ROOT)/include \
+ -I$(LLVM_SRC_ROOT)/include \
+ $(CPP.BaseFlags)