aboutsummaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-03-02 09:04:13 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-03-02 09:04:13 +0000
commit540d73f0cb32a3c520a6951c68393135008e8a17 (patch)
tree4d76cdd5e061d6f4f4ef6526e6b378eb27ff6e76 /Makefile.rules
parentb14f5b5e9d6a8cc9337a99ff3a31ff2bc1ba2fa0 (diff)
Move the rules for building plugins to Makefile.rules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules55
1 files changed, 54 insertions, 1 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 56d3a8739e..fdad178ea2 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -192,6 +192,28 @@ install-local:: all-local
install-bytecode:: install-bytecode-local
###############################################################################
+# LLVMC: Provide rules for compiling llvmc plugins
+###############################################################################
+
+ifdef LLVMC_PLUGIN
+
+LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN))
+REQUIRES_EH := 1
+
+# 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),)
+BUILD_AUTOGENERATED_INC=1
+endif
+
+endif # LLVMC_PLUGIN
+
+###############################################################################
# VARIABLES: Set up various variables based on configuration data
###############################################################################
@@ -1282,6 +1304,37 @@ $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
$(Verb) $(LLVMAS) $< -f -o $@
###############################################################################
+# LLVMC: Provide rules for compiling llvmc plugins, pt. 2
+###############################################################################
+
+ifdef BUILD_AUTOGENERATED_INC
+
+# This needs to be in a separate section, otherwise we get an infinite loop:)
+
+# This stuff is mostly copied from the TABLEGEN section below
+# TODO: merge
+
+LLVMCPluginSrc := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td))
+TDFiles := $(LLVMCPluginSrc) \
+ $(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))
+INCFiles := $(filter %.inc,$(BUILT_SOURCES))
+INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
+.PRECIOUS: $(INCTMPFiles) $(INCFiles)
+
+# All of these files depend on tblgen and the .td files.
+$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
+
+$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
+ $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
+
+$(ObjDir)/AutoGenerated.inc.tmp: $(LLVMCPluginSrc) $(ObjDir)/.dir \
+ $(TBLGEN) $(TD_COMMON)
+ $(Echo) "Building LLVMC configuration library with tblgen"
+ $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $<
+
+endif # BUILD_AUTOGENERATED_INC
+
+###############################################################################
# TABLEGEN: Provide rules for running tblgen to produce *.inc files
###############################################################################
@@ -1784,5 +1837,5 @@ printvars::
# General debugging rule, use 'make print-XXX' to print the
# definition, value and origin of XXX.
-print-%:
+print-%:
$(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))