[llvm-commits] [llvm] r65834 - /llvm/trunk/Makefile.rules

Mikhail Glushenkov foldr at codedgers.com
Mon Mar 2 01:42:59 PST 2009


Author: foldr
Date: Mon Mar  2 03:42:59 2009
New Revision: 65834

URL: http://llvm.org/viewvc/llvm-project?rev=65834&view=rev
Log:
Remove duplication in Makefile.rules.

Merge common bits from the LLVMC and TABLEGEN sections.

Modified:
    llvm/trunk/Makefile.rules

Modified: llvm/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=65834&r1=65833&r2=65834&view=diff

==============================================================================
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Mon Mar  2 03:42:59 2009
@@ -208,7 +208,7 @@
 
 # TableGen stuff...
 ifneq ($(BUILT_SOURCES),)
-BUILD_AUTOGENERATED_INC=1
+LLVMC_BUILD_AUTOGENERATED_INC=1
 endif
 
 endif # LLVMC_PLUGIN
@@ -1304,19 +1304,19 @@
 	$(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 @@
 # 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 @@
            $(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 @@
 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





More information about the llvm-commits mailing list