+++ /dev/null
-//===--- AutoGenerated.cpp - The LLVM Compiler Driver -----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Auto-generated tool descriptions - implementation.
-//
-//===----------------------------------------------------------------------===//
-
-// The auto-generated file
-#include "AutoGenerated.inc"
# Source License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
+
+# Compiled-in plugins
+BUILTIN_PLUGINS = Base
+
LEVEL = ../..
TOOLNAME = llvmc2
-BUILT_SOURCES = AutoGenerated.inc
LINK_COMPONENTS = support system
REQUIRES_EH := 1
+ifneq ($(BUILTIN_PLUGINS),)
+
+export BUILTIN_LLVMC_PLUGIN=1
+USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS))
+
+endif
+
include $(LEVEL)/Makefile.common
-GRAPH=Graph.td
-$(GRAPH) : Common.td
-Graph.td : Tools.td
-TOOLS_SOURCE=$(GRAPH)
+TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td)
+
+# There is probably a better way to do this: currently we enter the
+# subdirectory 2 times - the second time is not needed.
+# This probably also needs to be integrated into Makefile.rules.
+define PLUGIN_template
+PLUGIN_$(1)_SOURCES=$$(wildcard plugins/$(1)/*.cpp)
+PLUGIN_$(1)_TD_SOURCES=$$(wildcard plugins/$(1)/*.cpp)
+
+$$(LibDir)/LLVMC$(1).o: $$(PLUGIN_$(1)_SOURCES) $$(PLUGIN_$(1)_TD_SOURCES) \
+ $$(TD_COMMON)
+ @$$(MAKE) -C plugins/$(1)
-# TOFIX: integrate this part into Makefile.rules?
-# The degree of horrorshowness in that file is too much for me atm.
-$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir $(TBLGEN)
- $(Echo) "Building LLVMC configuration library with tblgen"
- $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $<
+$$(RecursiveTargets) ::
+ @$$(MAKE) -C plugins/$(1) $$@
+endef
-AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp
- $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
+$(foreach plugin,$(BUILTIN_PLUGINS),$(eval $(call PLUGIN_template,$(plugin))))
--- /dev/null
+#include "AutoGenerated.inc"
//
//===----------------------------------------------------------------------===//
-include "Common.td"
-include "Tools.td"
+include "llvm/CompilerDriver/Common.td"
+include "llvm/CompilerDriver/Tools.td"
// Toolchains
--- /dev/null
+##===- tools/llvmc2/plugins/Base/Makefile ------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLVMC_PLUGIN = Base
+
+include ../Makefile.common
--- /dev/null
+#include "AutoGenerated.inc"
// A (first stab at a) replacement for the Clang's ccc script.
// To compile, use this command:
-// make TOOLNAME=ccc2 GRAPH=examples/Clang.td
+// cd $LLVMC2_DIR
+// make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang
-include "Common.td"
+include "llvm/CompilerDriver/Common.td"
-// TOFIX: Add an explicit option list for aliases and things like this.
def Options : OptionList<[
(switch_option "E",
(help "Stop after the preprocessing stage, do not run the compiler"))
--- /dev/null
+##===- tools/llvmc2/plugins/Clang/Makefile -----------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LLVMC_PLUGIN = Clang
+
+include ../Makefile.common
+
-##===- lib/Transforms/Hello/Makefile -----------------------*- Makefile -*-===##
+##===- tools/llvmc2/plugins/Hello/Makefile -----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
#
##===----------------------------------------------------------------------===##
-LEVEL = ../../../..
-LIBRARYNAME = LLVMCHello
-LOADABLE_MODULE = 1
-REQUIRES_EH = 1
-USEDLIBS =
-
-include $(LEVEL)/Makefile.common
+LLVMC_PLUGIN = Hello
+include ../Makefile.common