Expose most of the rest of IRBuilder's functions to llvm-c.
[oota-llvm.git] / Makefile.rules
index 94d8e98c16b24b59cc2dc7fe1ef1f495e7f7f492..c29b5b26fd65d2a62bcd22c535e2cc3cbd346e09 100644 (file)
@@ -128,8 +128,11 @@ reconfigure:
          $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
          $(ConfigStatusScript)
 
+# FIXME: The {PIC16,MSP430}/AsmPrinter line here is a hack to force a reconfigure to pick
+# up AsmPrinter changes. Remove it after a reasonable delay from 2009-08-13.
+
 .PRECIOUS: $(ConfigStatusScript)
-$(ConfigStatusScript): $(ConfigureScript)
+$(ConfigStatusScript): $(ConfigureScript) $(LLVM_SRC_ROOT)/lib/Target/PIC16/AsmPrinter/Makefile $(LLVM_SRC_ROOT)/lib/Target/MSP430/AsmPrinter/Makefile
        $(Echo) Reconfiguring with $<
        $(Verb) cd $(PROJ_OBJ_ROOT) && \
          if test -w $(PROJ_OBJ_ROOT)/config.cache ; then \
@@ -198,21 +201,75 @@ install-bytecode:: install-bytecode-local
 ifdef LLVMC_PLUGIN
 
 LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN))
+CPP.Flags += -DLLVMC_PLUGIN_NAME=$(LLVMC_PLUGIN)
 REQUIRES_EH := 1
 
+ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
+  LD.Flags += -lCompilerDriver
+endif
+
 # Build a dynamic library if the user runs `make` directly from the plugin
 # directory.
 ifndef LLVMC_BUILTIN_PLUGIN
-LOADABLE_MODULE = 1
+  LOADABLE_MODULE = 1
 endif
 
 # TableGen stuff...
 ifneq ($(BUILT_SOURCES),)
-LLVMC_BUILD_AUTOGENERATED_INC=1
+  LLVMC_BUILD_AUTOGENERATED_INC=1
 endif
 
 endif # LLVMC_PLUGIN
 
+ifdef LLVMC_BASED_DRIVER
+
+TOOLNAME = $(LLVMC_BASED_DRIVER)
+
+REQUIRES_EH := 1
+
+ifeq ($(ENABLE_LLVMC_DYNAMIC),1)
+  LD.Flags += -lCompilerDriver
+else
+  LLVMLIBS = CompilerDriver.a
+  LINK_COMPONENTS = support system
+endif
+
+# Preprocessor magic that generates references to static variables in built-in
+# plugins.
+ifneq ($(LLVMC_BUILTIN_PLUGINS),)
+
+USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
+
+LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
+LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
+endif
+
+ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
+CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
+endif
+
+endif
+
+endif # LLVMC_BASED_DRIVER
+
 ###############################################################################
 # VARIABLES: Set up various variables based on configuration data
 ###############################################################################
@@ -458,8 +515,7 @@ ifeq ($(OS),Darwin)
 else
   ifeq ($(OS),Cygwin)
     SharedLinkOptions=-shared -nostdlib -Wl,--export-all-symbols \
-                      -Wl,--enable-auto-import -Wl,--enable-auto-image-base \
-                      -Wl,--enable-runtime-pseudo-relocs
+                      -Wl,--enable-auto-import -Wl,--enable-auto-image-base
   else
     SharedLinkOptions=-shared
   endif
@@ -519,10 +575,10 @@ endif
 #----------------------------------------------------------
 
 ifndef NO_PEDANTIC
-CompileCommonOpts += -pedantic
+CompileCommonOpts += -pedantic -Wno-long-long
 endif
-CompileCommonOpts += -Wall -W -Wwrite-strings -Wno-long-long \
-                     -Wunused -Wno-unused-parameter $(EXTRA_OPTIONS)
+CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
+                     $(EXTRA_OPTIONS)
 
 ifeq ($(OS),HP-UX)
   CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
@@ -1159,7 +1215,7 @@ install-local::
 uninstall-local::
        $(Echo) Uninstall circumvented with NO_INSTALL
 else
-DestTool = $(PROJ_bindir)/$(TOOLNAME)
+DestTool = $(PROJ_bindir)/$(TOOLNAME)$(EXEEXT)
 
 install-local:: $(DestTool)
 
@@ -1397,6 +1453,11 @@ $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) assembly writer #1 with tblgen"
        $(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
 
+$(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
+$(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir
+       $(Echo) "Building $(<F) assembly matcher with tblgen"
+       $(Verb) $(TableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
+
 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
        $(Echo) "Building $(<F) code emitter with tblgen"