Ensure target triple is propagated correctly to DerivedSources.make
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Feb 2018 23:45:40 +0000 (23:45 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Feb 2018 23:45:40 +0000 (23:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183189
<rdar://problem/37959694>

Reviewed by Dan Bernstein.

If we don't propagate the target triple, we can sometimes build with
the wrong options enabled.

* Configurations/Base.xcconfig:
Mentioning LLVM_TARGET_TRIPLE_SUFFIX here is required to get it to be available to scripts.

* DerivedSources.make:
Propagate the target triple into our compiler invocations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229081 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Configurations/Base.xcconfig
Source/WebCore/DerivedSources.make
Source/WebKit/ChangeLog
Source/WebKit/Configurations/Base.xcconfig
Source/WebKit/DerivedSources.make

index 0610160..a8b9071 100644 (file)
@@ -1,3 +1,20 @@
+2018-02-27  Tim Horton  <timothy_horton@apple.com>
+
+        Ensure target triple is propagated correctly to DerivedSources.make
+        https://bugs.webkit.org/show_bug.cgi?id=183189
+        <rdar://problem/37959694>
+
+        Reviewed by Dan Bernstein.
+
+        If we don't propagate the target triple, we can sometimes build with
+        the wrong options enabled.
+
+        * Configurations/Base.xcconfig:
+        Mentioning LLVM_TARGET_TRIPLE_SUFFIX here is required to get it to be available to scripts.
+
+        * DerivedSources.make:
+        Propagate the target triple into our compiler invocations.
+
 2018-02-27  Doug Russell  <doug@getitdownonpaper.com>
 
         AX: Spell check and style attributes should be optional when fetching attributed string
index e09429f..56f0f04 100644 (file)
@@ -117,3 +117,6 @@ SDKROOT = macosx.internal;
 OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
 OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS) -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders;
 OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
+
+// This is required to make LLVM_TARGET_TRIPLE_SUFFIX propagate into scripts.
+LLVM_TARGET_TRIPLE_SUFFIX = $(inherited);
index b62629c..ec1aab8 100644 (file)
@@ -1001,25 +1001,28 @@ ifeq ($(OS),MACOS)
 
 FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
 HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));')
-TEXT_PREPROCESSOR_FLAGS=-E -P -x c -traditional
 
 ifneq ($(SDKROOT),)
     SDK_FLAGS=-isysroot $(SDKROOT)
 endif
 
-ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
+ifeq ($(USE_LLVM_TARGET_TRIPLES_FOR_CLANG),YES)
+       TARGET_TRIPLE_FLAGS=-target $(CURRENT_ARCH)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(LLVM_TARGET_TRIPLE_OS_VERSION)$(LLVM_TARGET_TRIPLE_SUFFIX)
+endif
+
+ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
     WTF_PLATFORM_IOS = 1
 else
     WTF_PLATFORM_IOS = 0
 endif
 
-ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep USE_APPLE_INTERNAL_SDK | cut -d' ' -f3), 1)
+ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep USE_APPLE_INTERNAL_SDK | cut -d' ' -f3), 1)
     USE_APPLE_INTERNAL_SDK = 1
 else
     USE_APPLE_INTERNAL_SDK = 0
 endif
 
-ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ENABLE_ORIENTATION_EVENTS | cut -d' ' -f3), 1)
+ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ENABLE_ORIENTATION_EVENTS | cut -d' ' -f3), 1)
     ENABLE_ORIENTATION_EVENTS = 1
 endif
 
index 4bd71e8..80db2c6 100644 (file)
@@ -1,3 +1,15 @@
+2018-02-27  Tim Horton  <timothy_horton@apple.com>
+
+        Ensure target triple is propagated correctly to DerivedSources.make
+        https://bugs.webkit.org/show_bug.cgi?id=183189
+        <rdar://problem/37959694>
+
+        Reviewed by Dan Bernstein.
+
+        * Configurations/Base.xcconfig:
+        * DerivedSources.make:
+        Ditto the WebCore ChangeLog.
+
 2018-02-27  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         Make it possible to set suggestions in extra zoom mode.
index 8410108..a4319a8 100644 (file)
@@ -127,3 +127,6 @@ SUPPORTS_TEXT_BASED_API[sdk=appletv*] = NO;
 SUPPORTS_TEXT_BASED_API[sdk=watch*] = NO;
 OTHER_TAPI_FLAGS[sdk=iphone*] = -x objective-c++ -std=c++14 -fno-rtti -DRELEASE_WITHOUT_OPTIMIZATIONS;
 TAPI_VERIFY_MODE[sdk=iphone*] = Pedantic;
+
+// This is required to make LLVM_TARGET_TRIPLE_SUFFIX propagate into scripts.
+LLVM_TARGET_TRIPLE_SUFFIX = $(inherited);
index c4e3c84..71a804b 100644 (file)
@@ -230,6 +230,10 @@ ifneq ($(SDKROOT),)
        SDK_FLAGS=-isysroot $(SDKROOT)
 endif
 
+ifeq ($(USE_LLVM_TARGET_TRIPLES_FOR_CLANG),YES)
+       TARGET_TRIPLE_FLAGS=-target $(CURRENT_ARCH)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(LLVM_TARGET_TRIPLE_OS_VERSION)$(LLVM_TARGET_TRIPLE_SUFFIX)
+endif
+
 SANDBOX_PROFILES = \
        com.apple.WebProcess.sb \
        com.apple.WebKit.Storage.sb \
@@ -240,7 +244,7 @@ all: $(SANDBOX_PROFILES)
 
 %.sb : %.sb.in
        @echo Pre-processing $* sandbox profile...
-       $(CC) $(SDK_FLAGS) $(TEXT_PREPROCESSOR_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" $< > $@
+       $(CC) $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(TEXT_PREPROCESSOR_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" $< > $@
 
 AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS = \
        $(JavaScriptCore_SCRIPTS_DIR)/cpp_generator_templates.py \
@@ -269,7 +273,7 @@ AUTOMATION_PROTOCOL_OUTPUT_FILES = \
 #
 
 ifeq ($(OS),MACOS)
-ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
+ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
        AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform iOS
 else
        AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform macOS