diff --git a/Makefile.rules b/Makefile.rules index fdad178ea25..9f0e58c4284 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -208,7 +208,7 @@ endif # TableGen stuff... ifneq ($(BUILT_SOURCES),) -BUILD_AUTOGENERATED_INC=1 +LLVMC_BUILD_AUTOGENERATED_INC=1 endif endif # LLVMC_PLUGIN @@ -1303,50 +1303,20 @@ $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS) $(Echo) "Compiling $*.ll for $(BuildMode) build" $(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 ############################################################################### ifdef TARGET +TABLEGEN_INC_FILES_COMMON = 1 +endif + +ifdef LLVMC_BUILD_AUTOGENERATED_INC +TABLEGEN_INC_FILES_COMMON = 1 +endif + +ifdef TABLEGEN_INC_FILES_COMMON -TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \ - $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \ - $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \ - $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \ - $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \ - $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \ - $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td) INCFiles := $(filter %.inc,$(BUILT_SOURCES)) INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp) .PRECIOUS: $(INCTMPFiles) $(INCFiles) @@ -1363,6 +1333,18 @@ $(INCTMPFiles) : $(TBLGEN) $(TDFiles) $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ +endif # TABLEGEN_INC_FILES_COMMON + +ifdef TARGET + +TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \ + $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \ + $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \ + $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \ + $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \ + $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \ + $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td) + $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \ $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir $(Echo) "Building $(