[llvm-commits] CVS: llvm/Makefile.rules
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 14 23:17:09 PST 2006
Changes in directory llvm:
Makefile.rules updated: 1.344 -> 1.345
---
Log message:
Convert the bison-output-checked-into-cvs makefile handling stuff to work
like the flex stuff, which actually works when people do cvs updates and
get conflicts in the updated checked in file.
---
Diffs of the changes: (+16 -3)
Makefile.rules | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
Index: llvm/Makefile.rules
diff -u llvm/Makefile.rules:1.344 llvm/Makefile.rules:1.345
--- llvm/Makefile.rules:1.344 Tue Feb 14 21:23:26 2006
+++ llvm/Makefile.rules Wed Feb 15 01:16:57 2006
@@ -1252,6 +1252,8 @@
.PRECIOUS: $(YaccOutput)
+all:: $(YaccFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs)
+
# Cancel built-in rules for yacc
%.c: %.y
%.cpp: %.y
@@ -1265,10 +1267,21 @@
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
$(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)"
-YaccObjs := $(patsubst %.y,$(ObjDir)/%.o,$(YaccFiles))
-$(YaccObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
+# IFF the .y file has changed since it was last checked into CVS, copy the .y
+# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this
+# mechanism so that people without flex can build LLVM by copying the .cvs files
+# to the source location and building them.
+$(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \
+$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
+ $(Verb) $(CMP) -s $@ $< || \
+ ($(CP) $< $@; \
+ $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs; \
+ $(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs)
+
+
+$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
-YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output)
+YaccOutput := $(YaccFiles:%.y=%.output)
clean-local::
-$(Verb) $(RM) -f $(YaccOutput)
More information about the llvm-commits
mailing list