diff options
Diffstat (limited to 'tools/llvmc/Makefile')
-rw-r--r-- | tools/llvmc/Makefile | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/llvmc/Makefile b/tools/llvmc/Makefile index 6096176..f70c4b5 100644 --- a/tools/llvmc/Makefile +++ b/tools/llvmc/Makefile @@ -9,6 +9,8 @@ LEVEL = ../.. +#ifndef LLVMC_PLUGIN + # The current plan is to make the user copy the skeleton project and change only # this file (and plugins/UserPlugin, of course). @@ -18,3 +20,43 @@ export LLVMC_BUILTIN_PLUGINS = Base Clang DIRS = plugins driver include $(LEVEL)/Makefile.common + +else # LLVMC_PLUGIN + +# We are included from plugins/PluginName/Makefile... +# TODO: This part must be merged into Makefile.rules. + +LEVEL = ../../../.. + +LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN)) +REQUIRES_EH := 1 + +# Build a dynamic library if the user runs `make` from plugins/PluginName +ifndef LLVMC_BUILTIN_PLUGIN +LOADABLE_MODULE = 1 +endif + +# TableGen stuff... +ifneq ($(BUILT_SOURCES),) +BUILD_AUTOGENERATED_INC=1 +endif + +include $(LEVEL)/Makefile.common + +ifdef BUILD_AUTOGENERATED_INC + +TOOLS_SOURCE := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) + +TD_COMMON :=$(strip $(wildcard \ + $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td)) + +$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir \ + $(TBLGEN) $(TD_COMMON) + $(Echo) "Building LLVMC configuration library with tblgen" + $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< + +AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp + $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ +endif # BUILD_AUTOGENERATED_INC + +endif # LLVMC_PLUGIN |