Simplify subdirectory makefiles, and be more robust by checking that they define the appropriate variables.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@93714 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/make/util.mk b/make/util.mk
index 4f65790..2ce9a46 100644
--- a/make/util.mk
+++ b/make/util.mk
@@ -3,6 +3,18 @@
 ###
 # Utility functions
 
+# Function: streq LHS RHS
+#
+# Return "true" if LHS == RHS, otherwise "".
+#
+# LHS == RHS <=> (LHS subst RHS is empty) and (RHS subst LHS is empty)
+streq = $(if $(1),$(if $(subst $(1),,$(2))$(subst $(2),,$(1)),,true),$(if $(2),,true))
+
+# Function: strneq LHS RHS
+#
+# Return "true" if LHS != RHS, otherwise "".
+strneq = $(if $(call streq,$(1),$(2)),,true)
+
 # Function: Set variable value
 #
 # Set the given make variable to the given value.