diff --git a/tools/llvmc/Makefile b/tools/llvmc/Makefile index 60961769d19..f70c4b5e11c 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 diff --git a/tools/llvmc/Makefile.llvmc b/tools/llvmc/Makefile.llvmc deleted file mode 100644 index 79ec6426e8d..00000000000 --- a/tools/llvmc/Makefile.llvmc +++ /dev/null @@ -1,49 +0,0 @@ -##===- tools/llvmc/Makefile.llvmc --------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open -# Source License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -# TODO: This must be eventually merged into Makefile.rules. - -ifdef LLVMC_PLUGIN - -# We are included from plugins/PluginName/Makefile... - -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 diff --git a/tools/llvmc/plugins/Base/Makefile b/tools/llvmc/plugins/Base/Makefile index eb6ed010c6f..017dcebc022 100644 --- a/tools/llvmc/plugins/Base/Makefile +++ b/tools/llvmc/plugins/Base/Makefile @@ -12,4 +12,4 @@ LEVEL = ../.. LLVMC_PLUGIN = Base BUILT_SOURCES = AutoGenerated.inc -include $(LEVEL)/Makefile.llvmc +include $(LEVEL)/Makefile diff --git a/tools/llvmc/plugins/Clang/Makefile b/tools/llvmc/plugins/Clang/Makefile index a1b011e90db..bf5429c16a3 100644 --- a/tools/llvmc/plugins/Clang/Makefile +++ b/tools/llvmc/plugins/Clang/Makefile @@ -12,4 +12,4 @@ LEVEL = ../.. LLVMC_PLUGIN = Clang BUILT_SOURCES = AutoGenerated.inc -include $(LEVEL)/Makefile.llvmc +include $(LEVEL)/Makefile diff --git a/tools/llvmc/plugins/Hello/Makefile b/tools/llvmc/plugins/Hello/Makefile index 8e9fa6f3135..b309bff6626 100644 --- a/tools/llvmc/plugins/Hello/Makefile +++ b/tools/llvmc/plugins/Hello/Makefile @@ -11,4 +11,4 @@ LEVEL = ../.. LLVMC_PLUGIN = Hello -include $(LEVEL)/Makefile.llvmc +include $(LEVEL)/Makefile diff --git a/tools/llvmc/plugins/Simple/Makefile b/tools/llvmc/plugins/Simple/Makefile index c38cda51719..b108e7018d5 100644 --- a/tools/llvmc/plugins/Simple/Makefile +++ b/tools/llvmc/plugins/Simple/Makefile @@ -12,4 +12,4 @@ LEVEL = ../.. LLVMC_PLUGIN = Simple BUILT_SOURCES = AutoGenerated.inc -include $(LEVEL)/Makefile.llvmc +include $(LEVEL)/Makefile