-###############################################################################
-# LLVMC: Provide rules for compiling llvmc plugins
-###############################################################################
-
-ifdef LLVMC_PLUGIN
-
-LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN))
-CPP.Flags += -DLLVMC_PLUGIN_NAME=$(LLVMC_PLUGIN)
-
-ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
- LD.Flags += -lCompilerDriver
-endif
-
-# Build a dynamic library if the user runs `make` directly from the plugin
-# directory.
-ifndef LLVMC_BUILTIN_PLUGIN
- LOADABLE_MODULE = 1
-endif
-
-# TableGen stuff...
-ifneq ($(BUILT_SOURCES),)
- LLVMC_BUILD_AUTOGENERATED_INC=1
-endif
-
-endif # LLVMC_PLUGIN
-
-ifdef LLVMC_BASED_DRIVER
-
-TOOLNAME = $(LLVMC_BASED_DRIVER)
-
-ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
- LD.Flags += -lCompilerDriver
-else
- LLVMLIBS = CompilerDriver.a
- LINK_COMPONENTS = support system
-endif
-
-# Preprocessor magic that generates references to static variables in built-in
-# plugins.
-ifneq ($(LLVMC_BUILTIN_PLUGINS),)
-
-USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
-
-LLVMC_BUILTIN_PLUGINS.pre := \
- $(patsubst %,-DLLVMC_BUILTIN_PLUGIN_%=, \
- 1 2 3 4 5 6 7 8 9 10)
-
-CPP.Flags += \
- $(filter-out $(LLVMC_BUILTIN_PLUGINS.pre) $(LLVMC_BUILTIN_PLUGINS), \
- $(join $(LLVMC_BUILTIN_PLUGINS.pre), $(LLVMC_BUILTIN_PLUGINS)))
-
-endif
-
-endif # LLVMC_BASED_DRIVER
-