Build system tweaks to make it more convenient for the plugin authors.

Plugins can be now compiled in with a slight Makefile change.
For example, to compile the new Clang driver, use:

cd $LLVMC2_DIR
make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mikhail Glushenkov 2008-10-02 21:15:05 +00:00
parent 88ab90b475
commit e4a5ea3130
11 changed files with 62 additions and 40 deletions

View File

@ -1,15 +0,0 @@
//===--- 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"

View File

@ -6,24 +6,39 @@
# Source License. See LICENSE.TXT for details. # Source License. See LICENSE.TXT for details.
# #
##===----------------------------------------------------------------------===## ##===----------------------------------------------------------------------===##
# Compiled-in plugins
BUILTIN_PLUGINS = Base
LEVEL = ../.. LEVEL = ../..
TOOLNAME = llvmc2 TOOLNAME = llvmc2
BUILT_SOURCES = AutoGenerated.inc
LINK_COMPONENTS = support system LINK_COMPONENTS = support system
REQUIRES_EH := 1 REQUIRES_EH := 1
ifneq ($(BUILTIN_PLUGINS),)
export BUILTIN_LLVMC_PLUGIN=1
USEDLIBS = $(patsubst %,LLVMC%,$(BUILTIN_PLUGINS))
endif
include $(LEVEL)/Makefile.common include $(LEVEL)/Makefile.common
GRAPH=Graph.td TD_COMMON = $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td)
$(GRAPH) : Common.td
Graph.td : Tools.td
TOOLS_SOURCE=$(GRAPH)
# TOFIX: integrate this part into Makefile.rules? # There is probably a better way to do this: currently we enter the
# The degree of horrorshowness in that file is too much for me atm. # subdirectory 2 times - the second time is not needed.
$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir $(TBLGEN) # This probably also needs to be integrated into Makefile.rules.
$(Echo) "Building LLVMC configuration library with tblgen" define PLUGIN_template
$(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< PLUGIN_$(1)_SOURCES=$$(wildcard plugins/$(1)/*.cpp)
PLUGIN_$(1)_TD_SOURCES=$$(wildcard plugins/$(1)/*.cpp)
AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp $$(LibDir)/LLVMC$(1).o: $$(PLUGIN_$(1)_SOURCES) $$(PLUGIN_$(1)_TD_SOURCES) \
$(Verb) $(CMP) -s $@ $< || $(CP) $< $@ $$(TD_COMMON)
@$$(MAKE) -C plugins/$(1)
$$(RecursiveTargets) ::
@$$(MAKE) -C plugins/$(1) $$@
endef
$(foreach plugin,$(BUILTIN_PLUGINS),$(eval $(call PLUGIN_template,$(plugin))))

View File

@ -0,0 +1 @@
#include "AutoGenerated.inc"

View File

@ -11,8 +11,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
include "Common.td" include "llvm/CompilerDriver/Common.td"
include "Tools.td" include "llvm/CompilerDriver/Tools.td"
// Toolchains // Toolchains

View File

@ -0,0 +1,12 @@
##===- 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

View File

@ -0,0 +1 @@
#include "AutoGenerated.inc"

View File

@ -1,11 +1,11 @@
// A (first stab at a) replacement for the Clang's ccc script. // A (first stab at a) replacement for the Clang's ccc script.
// To compile, use this command: // 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<[ def Options : OptionList<[
(switch_option "E", (switch_option "E",
(help "Stop after the preprocessing stage, do not run the compiler")) (help "Stop after the preprocessing stage, do not run the compiler"))

View File

@ -0,0 +1,13 @@
##===- 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

View File

@ -1,4 +1,4 @@
##===- lib/Transforms/Hello/Makefile -----------------------*- Makefile -*-===## ##===- tools/llvmc2/plugins/Hello/Makefile -----------------*- Makefile -*-===##
# #
# The LLVM Compiler Infrastructure # The LLVM Compiler Infrastructure
# #
@ -7,11 +7,6 @@
# #
##===----------------------------------------------------------------------===## ##===----------------------------------------------------------------------===##
LEVEL = ../../../.. LLVMC_PLUGIN = Hello
LIBRARYNAME = LLVMCHello
LOADABLE_MODULE = 1
REQUIRES_EH = 1
USEDLIBS =
include $(LEVEL)/Makefile.common
include ../Makefile.common