aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-03-02 09:42:59 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-03-02 09:42:59 +0000
commit1386ae4b0f00abf0f13c2a7b4e0007e77e35077b (patch)
treee8ee2b408002327303eff3302c14a61fdb209267
parent09c9ed44092e099b6238f213b3c3deab4d648779 (diff)
Remove duplication in Makefile.rules.
Merge common bits from the LLVMC and TABLEGEN sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65834 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile.rules67
1 files changed, 32 insertions, 35 deletions
diff --git a/Makefile.rules b/Makefile.rules
index fdad178ea2..9f0e58c428 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
@@ -1304,19 +1304,19 @@ $(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS)
$(Verb) $(LLVMAS) $< -f -o $@
###############################################################################
-# LLVMC: Provide rules for compiling llvmc plugins, pt. 2
+# TABLEGEN: Provide rules for running tblgen to produce *.inc files
###############################################################################
-ifdef BUILD_AUTOGENERATED_INC
+ifdef TARGET
+TABLEGEN_INC_FILES_COMMON = 1
+endif
-# This needs to be in a separate section, otherwise we get an infinite loop:)
+ifdef LLVMC_BUILD_AUTOGENERATED_INC
+TABLEGEN_INC_FILES_COMMON = 1
+endif
-# This stuff is mostly copied from the TABLEGEN section below
-# TODO: merge
+ifdef TABLEGEN_INC_FILES_COMMON
-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)
@@ -1324,19 +1324,16 @@ INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
# All of these files depend on tblgen and the .td files.
$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
+# INCFiles rule: All of the tblgen generated files are emitted to
+# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
+# us to only "touch" the real file if the contents of it change. IOW, if
+# tblgen is modified, all of the .inc.tmp files are regenerated, but no
+# dependencies of the .inc files are, unless the contents of the .inc file
+# changes.
$(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
-###############################################################################
+endif # TABLEGEN_INC_FILES_COMMON
ifdef TARGET
@@ -1347,21 +1344,6 @@ TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.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)
-
-# All of these files depend on tblgen and the .td files.
-$(INCTMPFiles) : $(TBLGEN) $(TDFiles)
-
-# INCFiles rule: All of the tblgen generated files are emitted to
-# $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
-# us to only "touch" the real file if the contents of it change. IOW, if
-# tblgen is modified, all of the .inc.tmp files are regenerated, but no
-# dependencies of the .inc files are, unless the contents of the .inc file
-# changes.
-$(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
- $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
@@ -1431,7 +1413,22 @@ $(ObjDir)/%GenIntrinsics.inc.tmp : Intrinsics%.td $(ObjDir)/.dir
clean-local::
-$(Verb) $(RM) -f $(INCFiles)
-endif
+endif # TARGET
+
+ifdef LLVMC_BUILD_AUTOGENERATED_INC
+
+LLVMCPluginSrc := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td))
+
+TDFiles := $(LLVMCPluginSrc) \
+ $(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))
+
+$(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 # LLVMC_BUILD_AUTOGENERATED_INC
+
###############################################################################
# OTHER RULES: Other rules needed