Bug 1062219 - Don't build build/clang-plugin as an external directory. r=jcranmer
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 04 Sep 2014 17:44:01 +0900
changeset 214802 17e91b558001d3aa1deb44f5c4a6751df92d2300
parent 214697 7bfd030e8fc8b4c8d6f5e004a6f19269e7b1a402
child 214803 3b31478e8a85afb81b5b1b2162b72e9e489e600d
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-esr52@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1062219
milestone35.0a1
Bug 1062219 - Don't build build/clang-plugin as an external directory. r=jcranmer
Makefile.in
aclocal.m4
build/autoconf/clang-plugin.m4
build/clang-plugin/Makefile.in
build/clang-plugin/configure
build/clang-plugin/moz.build
build/clang-plugin/tests/Makefile.in
build/clang-plugin/tests/moz.build
build/unix/stdc++compat/Makefile.in
config/recurse.mk
configure.in
js/src/aclocal.m4
js/src/configure.in
moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -310,32 +310,9 @@ source-package install:
 
 # Every export rule depends on config/export, but the rule for config/export
 # doesn't exist when building js non-standalone.
 .PHONY: config/export
 config/export:
 
 endif
 
-# Interdependencies for parallel export.
-js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
-accessible/xpcom/export: xpcom/xpidl/export
-ifdef ENABLE_CLANG_PLUGIN
-js/src/export config/host: build/clang-plugin/export
-endif
-
-# Interdependencies that moz.build world don't know about yet for compilation.
-# Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
-toolkit/library/target: widget/gtk/mozgtk/gtk3/target
-endif
-ifdef MOZ_LDAP_XPCOM
-ldap/target: config/external/nss/target mozglue/build/target
-toolkit/library/target: ldap/target
-endif
-ifndef MOZ_FOLD_LIBS
-ifndef MOZ_NATIVE_SQLITE
-config/external/nss/target: db/sqlite3/src/target
-endif
-endif
-ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
-mozglue/build/target: memory/replace/dummy/target
-endif
+# There used to be build interdependencies here. They are now in config/recurse.mk
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -29,16 +29,17 @@ builtin(include, build/autoconf/expandli
 builtin(include, build/autoconf/arch.m4)dnl
 builtin(include, build/autoconf/android.m4)dnl
 builtin(include, build/autoconf/zlib.m4)dnl
 builtin(include, build/autoconf/linux.m4)dnl
 builtin(include, build/autoconf/python-virtualenv.m4)dnl
 builtin(include, build/autoconf/winsdk.m4)dnl
 builtin(include, build/autoconf/icu.m4)dnl
 builtin(include, build/autoconf/ffi.m4)dnl
+builtin(include, build/autoconf/clang-plugin.m4)dnl
 
 MOZ_PROG_CHECKMSYS()
 
 # Read the user's .mozconfig script.  We can't do this in
 # configure.in: autoconf puts the argument parsing code above anything
 # expanded from configure.in, and we need to get the configure options
 # from .mozconfig in place before that argument parsing code.
 MOZ_READ_MOZCONFIG(.)
new file mode 100644
--- /dev/null
+++ b/build/autoconf/clang-plugin.m4
@@ -0,0 +1,56 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_CONFIG_CLANG_PLUGIN], [
+
+MOZ_ARG_ENABLE_BOOL(clang-plugin,
+[  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
+   ENABLE_CLANG_PLUGIN=1,
+   ENABLE_CLANG_PLUGIN= )
+if test -n "$ENABLE_CLANG_PLUGIN"; then
+    if test -z "$CLANG_CC"; then
+        AC_MSG_ERROR([Can't use clang plugin without clang.])
+    fi
+
+    AC_MSG_CHECKING([for llvm-config])
+    if test -z "$LLVMCONFIG"; then
+      LLVMCONFIG=`which llvm-config`
+    fi
+
+    if test -z "$LLVMCONFIG"; then
+      LLVMCONFIG=`$CXX -print-prog-name=llvm-config`
+    fi
+
+    if test ! -x "$LLVMCONFIG"; then
+      AC_MSG_RESULT([not found])
+      AC_MSG_ERROR([Cannot find an llvm-config binary for building a clang plugin])
+    fi
+
+    AC_MSG_RESULT([$LLVMCONFIG])
+
+    if test -z "$LLVMCONFIG"; then
+        AC_MSG_ERROR([Cannot find an llvm-config binary for building a clang plugin])
+    fi
+    LLVM_CXXFLAGS=`$LLVMCONFIG --cxxflags`
+    LLVM_LDFLAGS=`$LLVMCONFIG --ldflags --libs core mc analysis asmparser mcparser bitreader | xargs`
+
+    if test "${OS_ARCH}" = "Darwin"; then
+        CLANG_LDFLAGS="-lclangFrontend -lclangDriver -lclangSerialization"
+        CLANG_LDFLAGS="$CLANG_LDFLAGS -lclangParse -lclangSema -lclangAnalysis"
+        CLANG_LDFLAGS="$CLANG_LDFLAGS -lclangEdit -lclangAST -lclangLex"
+        CLANG_LDFLAGS="$CLANG_LDFLAGS -lclangBasic -lclangASTMatchers"
+    else
+        CLANG_LDFLAGS="-lclangASTMatchers"
+    fi
+
+    AC_DEFINE(MOZ_CLANG_PLUGIN)
+fi
+
+AC_SUBST(LLVM_CXXFLAGS)
+AC_SUBST(LLVM_LDFLAGS)
+AC_SUBST(CLANG_LDFLAGS)
+
+AC_SUBST(ENABLE_CLANG_PLUGIN)
+
+])
--- a/build/clang-plugin/Makefile.in
+++ b/build/clang-plugin/Makefile.in
@@ -1,59 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-CXX      := @CXX@
-CXXFLAGS := @CXXFLAGS@
-LDFLAGS  := @LDFLAGS@
-VPATH		 := @srcdir@
-DSO_LDOPTS := @DSO_LDOPTS@
-DLL_SUFFIX := @DLL_SUFFIX@
-
-# Helper for end
-NULL :=
-
-CPPSRCS := \
-	clang-plugin.cpp \
-	$(NULL)
+# LLVM_CXXFLAGS comes with its own optimization flags.
+MOZ_OPTIMIZE =
 
-TESTSRCS := \
-	TestCustomHeap.cpp \
-	TestMustOverride.cpp \
-	TestNonHeapClass.cpp \
-	TestStackClass.cpp \
-	$(NULL)
+MOZ_GLUE_LDFLAGS =
 
-OBJS := $(patsubst %.cpp,%.o,$(CPPSRCS))
-TESTS := $(patsubst %.cpp,test-%,$(TESTSRCS))
-
-PLUGIN := libclang-plugin.$(DLL_SUFFIX)
-
-all: $(PLUGIN) $(TESTS)
+include $(topsrcdir)/config/config.mk
 
-$(OBJS): %.o: %.cpp Makefile
-	$(CXX) -o $@ -c $(CXXFLAGS) $<
-
-$(PLUGIN): $(OBJS)
-	rm -f $@
-	$(CXX) $(DSO_LDOPTS) -o $@ $(CXXFLAGS) $(OBJS) $(LDFLAGS)
-
-TESTFLAGS := -fsyntax-only -Xclang -verify \
-	-Xclang -load -Xclang $(CURDIR)/$(PLUGIN) \
-	-Xclang -add-plugin -Xclang moz-check
-
-$(TESTS): test-%: tests/%.cpp $(PLUGIN)
-	$(CXX) $(TESTFLAGS) $<
-
-compile libs export tools: all
-
-distclean clean:
-	rm -f $(OBJS) $(TESTS) $(PLUGIN)
-
-check:
-
-libs: binaries
-
-binaries: all
-	@touch $@
-
-.PHONY: compile libs export tools distclean clean check
+# In the current moz.build world, we need to override essentially every
+# variable to limit ourselves to what we need to build the clang plugin.
+OS_CXXFLAGS := $(LLVM_CXXFLAGS) -fno-rtti -fno-exceptions
+OS_COMPILE_CXXFLAGS :=
+OS_LDFLAGS := $(LLVM_LDFLAGS) $(CLANG_LDFLAGS)
+DSO_LDOPTS := -shared
deleted file mode 100755
--- a/build/clang-plugin/configure
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-PLATFORM=`uname`
-
-# Default srcdir to this directory
-srcdir=$(dirname $0)
-
-for option; do
-  case "$option" in
-  -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) optarg= ;;
-  esac
-
-  case "$option" in
-  --srcdir=*) srcdir="$optarg";;
-  esac
-done
-
-if test -z "$CXX"; then
-  CXX=`which clang++`
-fi
-
-echo -n "checking for llvm-config... "
-
-if test -z "$LLVMCONFIG"; then
-  LLVMCONFIG=`which llvm-config`
-fi
-
-if test -z "$LLVMCONFIG"; then
-  LLVMCONFIG=`dirname $CXX`/llvm-config
-fi
-
-if test ! -x "$LLVMCONFIG"; then
-  echo "configure: error: Cannot find an llvm-config binary for building a clang plugin" 1>&2
-  exit 1
-fi
-
-echo "$LLVMCONFIG"
-
-LLVMLIBS="core mc analysis asmparser mcparser bitreader"
-LLVMCXXFLAGS=`$LLVMCONFIG --cxxflags`
-LLVMLDFLAGS=`$LLVMCONFIG --ldflags`
-LLVMLDFLAGS="$LLVMLDFLAGS `$LLVMCONFIG --libs $LLVMLIBS`"
-
-if [ $PLATFORM == Darwin ]; then
-  DSO_LDOPTS="-dynamiclib -shared"
-  CLANGLDFLAGS="-lclangFrontend -lclangDriver -lclangSerialization \
-                 -lclangParse -lclangSema -lclangAnalysis -lclangEdit -lclangAST \
-                 -lclangLex -lclangBasic -lclangASTMatchers"
-  DLL_SUFFIX="dylib"
-else
-  DSO_LDOPTS="-shared"
-  CLANGLDFLAGS=-lclangASTMatchers
-  DLL_SUFFIX="so"
-fi
-
-CXXFLAGS="$CXXFLAGS $LLVMCXXFLAGS -fno-rtti -fno-exceptions"
-LDFLAGS="$LDFLAGS $LLVMLDFLAGS $CLANGLDFLAGS"
-
-cat $srcdir/Makefile.in | sed \
-  -e "s%@CXX@%$CXX%" \
-  -e "s%@CXXFLAGS@%$CXXFLAGS%" \
-  -e "s%@LDFLAGS@%$LDFLAGS%" \
-  -e "s%@srcdir@%$srcdir%" \
-  -e "s%@DSO_LDOPTS@%$DSO_LDOPTS%" \
-  -e "s%@DLL_SUFFIX@%$DLL_SUFFIX%" \
-  > Makefile
new file mode 100644
--- /dev/null
+++ b/build/clang-plugin/moz.build
@@ -0,0 +1,18 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SharedLibrary('clang-plugin')
+
+SOURCES += [
+    'clang-plugin.cpp',
+]
+
+DISABLE_STL_WRAPPING = True
+NO_VISIBILITY_FLAGS = True
+
+DIRS += [
+    'tests',
+]
new file mode 100644
--- /dev/null
+++ b/build/clang-plugin/tests/Makefile.in
@@ -0,0 +1,14 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Build without any warning flags, and with clang verify flag for a
+# syntax-only build (no codegen).
+OS_CXXFLAGS := $(filter-out -W%,$(OS_CXXFLAGS)) -fsyntax-only -Xclang -verify
+
+include $(topsrcdir)/config/rules.mk
+
+target:: $(OBJS)
+
+# We don't actually build anything.
+.PHONY: $(OBJS)
new file mode 100644
--- /dev/null
+++ b/build/clang-plugin/tests/moz.build
@@ -0,0 +1,15 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SOURCES += [
+    'TestCustomHeap.cpp',
+    'TestMustOverride.cpp',
+    'TestNonHeapClass.cpp',
+    'TestStackClass.cpp',
+]
+
+DISABLE_STL_WRAPPING = True
+NO_VISIBILITY_FLAGS = True
--- a/build/unix/stdc++compat/Makefile.in
+++ b/build/unix/stdc++compat/Makefile.in
@@ -1,10 +1,11 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 NO_EXPAND_LIBS = 1
+ENABLE_CLANG_PLUGIN :=
 
 include $(topsrcdir)/config/rules.mk
 
 CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
 HOST_CXXFLAGS += -DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_HOST_VERSION)
--- a/config/recurse.mk
+++ b/config/recurse.mk
@@ -70,26 +70,24 @@ export NO_RECURSE_MAKELEVEL=$(word $(MAK
 endif
 endif
 
 # Get all directories traversed for all subtiers in the current tier, or use
 # directly the $(*_dirs) variables available in root.mk when there is no
 # TIERS (like for js/src).
 CURRENT_DIRS := $($(CURRENT_TIER)_dirs)
 
-# The compile tier has different rules from other tiers.
-ifeq ($(CURRENT_TIER),compile)
-
 # Need a list of compile targets because we can't use pattern rules:
 # https://savannah.gnu.org/bugs/index.php?42833
 .PHONY: $(compile_targets)
 $(compile_targets):
 	$(call SUBMAKE,$(@F),$(@D))
 
-else
+# The compile tier has different rules from other tiers.
+ifneq ($(CURRENT_TIER),compile)
 
 # Recursion rule for all directories traversed for all subtiers in the
 # current tier.
 $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
 	$(call SUBMAKE,$(CURRENT_TIER),$*)
 
 .PHONY: $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS))
 
@@ -103,21 +101,16 @@ ifeq ($(CURRENT_TIER),export)
 
 # The export tier requires nsinstall, which is built from config. So every
 # subdirectory traversal needs to happen after building nsinstall in config, which
 # is done with the config/host target. Note the config/host target only exists if
 # nsinstall is actually built, which it is not on Windows, because we use
 # nsinstall.py there.
 ifneq (,$(filter config/host, $(compile_targets)))
 $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): config/host
-
-# Ensure rules for config/host and its possible dependencies.
-.PHONY: $(filter %/host, $(compile_targets))
-$(filter %/host, $(compile_targets)):
-	$(call SUBMAKE,host,$(@D))
 endif
 endif
 
 endif # ifeq ($(CURRENT_TIER),compile)
 
 else
 
 # Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
@@ -158,8 +151,37 @@ endif # ifdef TIERS
 
 endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
 
 endif # ifeq (.,$(DEPTH))
 
 recurse:
 	@$(RECURSED_COMMAND)
 	$(LOOP_OVER_DIRS)
+
+ifeq (.,$(DEPTH))
+# Interdependencies for parallel export.
+js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
+accessible/xpcom/export: xpcom/xpidl/export
+ifdef ENABLE_CLANG_PLUGIN
+$(filter-out build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
+build/clang-plugin/tests/target: build/clang-plugin/target
+endif
+
+# Interdependencies that moz.build world don't know about yet for compilation.
+# Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
+ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
+toolkit/library/target: widget/gtk/mozgtk/gtk3/target
+endif
+ifdef MOZ_LDAP_XPCOM
+ldap/target: config/external/nss/target mozglue/build/target
+toolkit/library/target: ldap/target
+endif
+ifndef MOZ_FOLD_LIBS
+ifndef MOZ_NATIVE_SQLITE
+config/external/nss/target: db/sqlite3/src/target
+endif
+endif
+ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
+mozglue/build/target: memory/replace/dummy/target
+endif
+
+endif
--- a/configure.in
+++ b/configure.in
@@ -7245,28 +7245,17 @@ if test -n "$DEHYDRA_PATH"; then
     AC_DEFINE(NS_STATIC_CHECKING)
 fi
 AC_SUBST(DEHYDRA_PATH)
 
 dnl ========================================================
 dnl = Enable using the clang plugin to build
 dnl ========================================================
 
-MOZ_ARG_ENABLE_BOOL(clang-plugin,
-[  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
-   ENABLE_CLANG_PLUGIN=1,
-   ENABLE_CLANG_PLUGIN= )
-if test -n "$ENABLE_CLANG_PLUGIN"; then
-    if test -z "$CLANG_CC"; then
-        AC_MSG_ERROR([Can't use clang plugin without clang.])
-    fi
-    AC_DEFINE(MOZ_CLANG_PLUGIN)
-fi
-
-AC_SUBST(ENABLE_CLANG_PLUGIN)
+MOZ_CONFIG_CLANG_PLUGIN
 
 dnl ========================================================
 dnl = Enable stripping of libs & executables
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(strip,
 [  --enable-strip          Enable stripping of libs & executables ],
     ENABLE_STRIP=1,
     ENABLE_STRIP= )
@@ -9107,21 +9096,16 @@ CPPFLAGS="$_SUBDIR_CPPFLAGS"
 CXXFLAGS="$_SUBDIR_CXXFLAGS"
 LDFLAGS="$_SUBDIR_LDFLAGS"
 HOST_CC="$_SUBDIR_HOST_CC"
 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
 RC=
 
-if test -n "$ENABLE_CLANG_PLUGIN"; then
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
-    AC_OUTPUT_SUBDIRS(build/clang-plugin)
-fi
-
 # Run the SpiderMonkey 'configure' script.
 dist=$MOZ_BUILD_ROOT/dist
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
 # and $NSPR_LIBS.
 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
 
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -28,16 +28,17 @@ builtin(include, ../../build/autoconf/ex
 builtin(include, ../../build/autoconf/arch.m4)dnl
 builtin(include, ../../build/autoconf/android.m4)dnl
 builtin(include, ../../build/autoconf/zlib.m4)dnl
 builtin(include, ../../build/autoconf/linux.m4)dnl
 builtin(include, ../../build/autoconf/python-virtualenv.m4)dnl
 builtin(include, ../../build/autoconf/winsdk.m4)dnl
 builtin(include, ../../build/autoconf/icu.m4)dnl
 builtin(include, ../../build/autoconf/ffi.m4)dnl
+builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
 
 define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
 define([AC_INIT_PREPARE],
 [if test -z "$srcdir"; then
   srcdir=`dirname "[$]0"`
 fi
 srcdir="$srcdir/../.."
 __MOZ_AC_INIT_PREPARE($1)
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3384,28 +3384,17 @@ if test -n "$DEHYDRA_PATH"; then
     AC_DEFINE(NS_STATIC_CHECKING)
 fi
 AC_SUBST(DEHYDRA_PATH)
 
 dnl ========================================================
 dnl = Enable using the clang plugin to build
 dnl ========================================================
 
-MOZ_ARG_ENABLE_BOOL(clang-plugin,
-[  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
-   ENABLE_CLANG_PLUGIN=1,
-   ENABLE_CLANG_PLUGIN= )
-if test -n "$ENABLE_CLANG_PLUGIN"; then
-    if test -z "$CLANG_CC"; then
-        AC_MSG_ERROR([Can't use clang plugin without clang.])
-    fi
-    AC_DEFINE(MOZ_CLANG_PLUGIN)
-fi
-
-AC_SUBST(ENABLE_CLANG_PLUGIN)
+MOZ_CONFIG_CLANG_PLUGIN
 
 dnl ========================================================
 dnl = Enable static checking using sixgill
 dnl ========================================================
 
 MOZ_ARG_WITH_STRING(sixgill,
 [  --with-sixgill=path/to/sixgill
                           Enable static checking of code using sixgill],
--- a/moz.build
+++ b/moz.build
@@ -5,17 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 CONFIGURE_SUBST_FILES += [
     'config/autoconf.mk',
     'config/emptyvars.mk',
 ]
 
 if CONFIG['ENABLE_CLANG_PLUGIN']:
-    add_tier_dir('base', 'build/clang-plugin', external=True)
+    add_tier_dir('base', 'build/clang-plugin')
 
 add_tier_dir('base', ['config', 'python'])
 if not CONFIG['JS_STANDALONE']:
     CONFIGURE_SUBST_FILES += [
         'mozilla-config.h',
         'tools/update-packaging/Makefile',
     ]
 
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1177,17 +1177,19 @@ class RecursiveMakeBackend(CommonBackend
         build_target = self._build_target_for_obj(obj)
         self._compile_graph[build_target]
 
         # Until MOZ_GLUE_LDFLAGS/MOZ_GLUE_PROGRAM_LDFLAGS are properly
         # handled in moz.build world, assume any program or shared library
         # we build depends on it.
         if obj.KIND == 'target' and not isinstance(obj, StaticLibrary) and \
                 build_target != 'mozglue/build/target' and \
-                not obj.config.substs.get('JS_STANDALONE'):
+                not obj.config.substs.get('JS_STANDALONE') and \
+                (not isinstance(obj, SharedLibrary) or
+                 obj.basename != 'clang-plugin'):
             self._compile_graph[build_target].add('mozglue/build/target')
             if obj.config.substs.get('MOZ_MEMORY'):
                 self._compile_graph[build_target].add('memory/build/target')
 
         # Until STLPORT_LIBS are properly handled in moz.build world, assume
         # any program or shared library we build depends on it.
         if obj.KIND == 'target' and not isinstance(obj, StaticLibrary) and \
                 build_target != 'build/stlport/target' and \