summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-15 07:16:57 +0000
committerChris Lattner <sabre@nondot.org>2006-02-15 07:16:57 +0000
commit6599c75cccf24a2910a49be4eeb9085e8cfbdec8 (patch)
tree5d6b686417024bf191c382c8f4aa47cc9880eafe /Makefile.rules
parent45090476be69a3f860e83f2c0fe2a2df7e1b4c89 (diff)
downloadllvm-6599c75cccf24a2910a49be4eeb9085e8cfbdec8.tar.gz
llvm-6599c75cccf24a2910a49be4eeb9085e8cfbdec8.tar.bz2
llvm-6599c75cccf24a2910a49be4eeb9085e8cfbdec8.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules19
1 files changed, 16 insertions, 3 deletions
diff --git a/Makefile.rules b/Makefile.rules
index be173700ec..943eaaaf62 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1252,6 +1252,8 @@ ifneq ($(YaccFiles),)
.PRECIOUS: $(YaccOutput)
+all:: $(YaccFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs)
+
# Cancel built-in rules for yacc
%.c: %.y
%.cpp: %.y
@@ -1265,10 +1267,21 @@ $(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
$(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)