BaseTools/tools_def: use separate PP definition for DTC
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 27 Feb 2018 17:47:06 +0000 (17:47 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 28 Feb 2018 08:11:48 +0000 (08:11 +0000)
Clang's preprocessor behaves differently from GCC's, and produces
intermediate device tree source that still contains #pragma pack()
and other directives that the device tree compiler chokes on.

For assembling device tree sources, it matters very little which
preprocessor is being used, so let's just use GNU CPP explicitly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Conf/build_rule.template
BaseTools/Conf/tools_def.template

index 77ed282..9248234 100755 (executable)
         $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb\r
 \r
     <Command.GCC>\r
-        "$(PP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i\r
+        "$(DTCPP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i\r
         "$(DTC)" $(DTC_FLAGS) -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i\r
 \r
 [Visual-Form-Representation-File]\r
index 427ad60..a546379 100755 (executable)
@@ -237,6 +237,7 @@ DEFINE IPHONE_TOOLS            = /Developer/Platforms/iPhoneOS.platform/Develope
 \r
 DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin\r
 \r
+DEFINE DTCPP_BIN               = ENV(DTCPP_PREFIX)cpp\r
 DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc\r
 \r
 ####################################################################################\r
@@ -4499,6 +4500,8 @@ DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
 RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =\r
 NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug\r
 *_*_*_DTC_FLAGS                    = -H epapr\r
+*_*_*_DTCPP_PATH                   = DEF(DTCPP_BIN)\r
+*_*_*_DTC_PATH                     = DEF(DTC_BIN)\r
 \r
 DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common\r
 DEFINE GCC_IA32_CC_FLAGS           = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe\r
@@ -4912,7 +4915,6 @@ RELEASE_GCC45_X64_CC_FLAGS       = DEF(GCC45_X64_CC_FLAGS) -Os
 *_GCC46_*_MAKE_PATH                    = DEF(GCC46_IA32_PREFIX)make\r
 *_GCC46_*_*_DLL                        = ENV(GCC46_DLL)\r
 *_GCC46_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)\r
-*_GCC46_*_DTC_PATH                     = DEF(DTC_BIN)\r
 \r
 *_GCC46_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)\r
 *_GCC46_*_ASLPP_FLAGS                  = DEF(GCC_ASLPP_FLAGS)\r
@@ -5023,7 +5025,6 @@ RELEASE_GCC46_ARM_CC_FLAGS       = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v
 *_GCC47_*_MAKE_PATH                    = DEF(GCC47_IA32_PREFIX)make\r
 *_GCC47_*_*_DLL                        = ENV(GCC47_DLL)\r
 *_GCC47_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)\r
-*_GCC47_*_DTC_PATH                     = DEF(DTC_BIN)\r
 \r
 *_GCC47_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)\r
 *_GCC47_*_ASLPP_FLAGS                  = DEF(GCC_ASLPP_FLAGS)\r
@@ -5163,7 +5164,6 @@ RELEASE_GCC47_AARCH64_CC_FLAGS   = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
 *_GCC48_*_MAKE_PATH                    = DEF(GCC48_IA32_PREFIX)make\r
 *_GCC48_*_*_DLL                        = ENV(GCC48_DLL)\r
 *_GCC48_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)\r
-*_GCC48_*_DTC_PATH                     = DEF(DTC_BIN)\r
 \r
 *_GCC48_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)\r
 *_GCC48_*_ASLPP_FLAGS                  = DEF(GCC_ASLPP_FLAGS)\r
@@ -5303,7 +5303,6 @@ RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
 *_GCC49_*_MAKE_PATH                    = DEF(GCC49_IA32_PREFIX)make\r
 *_GCC49_*_*_DLL                        = ENV(GCC49_DLL)\r
 *_GCC49_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)\r
-*_GCC49_*_DTC_PATH                     = DEF(DTC_BIN)\r
 \r
 *_GCC49_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)\r
 *_GCC49_*_ASLPP_FLAGS                  = DEF(GCC_ASLPP_FLAGS)\r
@@ -5449,7 +5448,6 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS  = DEF(GCC49_AARCH64_DLINK_FLAGS)
 *_GCC5_*_MAKE_PATH               = DEF(GCC5_IA32_PREFIX)make\r
 *_GCC5_*_*_DLL                   = ENV(GCC5_DLL)\r
 *_GCC5_*_ASL_PATH                = DEF(UNIX_IASL_BIN)\r
-*_GCC5_*_DTC_PATH                = DEF(DTC_BIN)\r
 \r
 *_GCC5_*_PP_FLAGS                = DEF(GCC_PP_FLAGS)\r
 *_GCC5_*_ASLPP_FLAGS             = DEF(GCC_ASLPP_FLAGS)\r
@@ -5606,7 +5604,6 @@ RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(W
 *_CLANG35_*_MAKE_PATH            = make\r
 *_CLANG35_*_*_DLL                = ENV(CLANG35_DLL)\r
 *_CLANG35_*_ASL_PATH             = DEF(UNIX_IASL_BIN)\r
-*_CLANG35_*_DTC_PATH             = DEF(DTC_BIN)\r
 \r
 *_CLANG35_*_PP_FLAGS             = DEF(GCC_PP_FLAGS)\r
 *_CLANG35_*_ASLCC_FLAGS          = DEF(GCC_ASLCC_FLAGS)\r
@@ -5684,7 +5681,6 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_CLANG38_*_MAKE_PATH               = make\r
 *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)\r
 *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)\r
-*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)\r
 \r
 *_CLANG38_*_APP_FLAGS               =\r
 *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)\r