-CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
-
-LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
-CPP.Flags += -I$(BUILD_OBJ_DIR) \
- -I$(BUILD_SRC_DIR) \
- -I$(BUILD_SRC_ROOT)/include \
- -I$(BUILD_OBJ_ROOT)/include \
- -I$(LLVM_OBJ_ROOT)/include \
- -I$(LLVM_SRC_ROOT)/include \
- -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
-
-Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
-LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
-BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
- $(C.Flags) -c
-Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
-LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
-BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
- $(CXX.Flags) -c
-Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
- $(CompileCommonOpts) $(LD.Flags) $(Strip)
-Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
- $(CompileCommonOpts)
-LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
-Burg = $(BURG) -I $(BUILD_SRC_DIR)
-TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
+ifndef NO_PEDANTIC
+CompileCommonOpts += -pedantic -Wno-long-long
+endif
+CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
+ $(EXTRA_OPTIONS)
+
+ifeq ($(HOST_OS),HP-UX)
+ CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
+endif
+
+# 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.
+#
+# The following can be optionally specified:
+# UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
+# For Mac OS/X 10.4 Intel machines, the traditional one is:
+# UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
+# UNIVERSAL_ARCH can be optionally specified to be a list of architectures
+# to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
+# i386/ppc only.
+ifdef UNIVERSAL
+ ifndef UNIVERSAL_ARCH
+ UNIVERSAL_ARCH := i386 ppc
+ endif
+ UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
+ CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
+ ifdef UNIVERSAL_SDK_PATH
+ CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
+ endif
+
+ # Building universal cannot compute dependencies automatically.
+ DISABLE_AUTO_DEPENDENCIES=1
+else
+ ifeq ($(TARGET_OS),Darwin)
+ ifeq ($(ARCH),x86_64)
+ TargetCommonOpts = -m64
+ else
+ ifeq ($(ARCH),x86)
+ TargetCommonOpts = -m32
+ endif
+ endif
+ endif
+endif
+
+ifeq ($(HOST_OS),SunOS)
+CPP.BaseFlags += -include llvm/System/Solaris.h
+endif
+
+ifeq ($(HOST_OS),AuroraUX)
+CPP.BaseFlags += -include llvm/System/Solaris.h
+endif # !HOST_OS - AuroraUX.
+
+LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
+CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
+# All -I flags should go here, so that they don't confuse llvm-config.
+CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
+ $(patsubst %,-I%/include,\
+ $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
+ $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
+ $(CPP.BaseFlags)
+
+ifeq ($(BUILD_COMPONENT), 1)
+ Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) -c
+ Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
+ $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) -c
+ Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
+ $(CompileCommonOpts) $(CXX.Flags) -E
+ Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
+ $(LDFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
+else
+ Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) -c
+ Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) -c
+ Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
+ $(CompileCommonOpts) $(CXX.Flags) -E
+ Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LDFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
+endif
+
+BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CFLAGS) \
+ $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts)
+Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts) -E
+
+BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
+ $(CPPFLAGS) \
+ $(TargetCommonOpts) $(CompileCommonOpts)
+
+ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
+ScriptInstall = $(INSTALL) -m 0755
+DataInstall = $(INSTALL) -m 0644
+
+# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
+# paths. In this case, the SYSPATH function (defined in
+# Makefile.config) transforms Unix paths into Windows paths.
+TableGen = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
+ -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
+ -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
+ -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
+