[llvm-commits] CVS: llvm/Makefile.rules
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 13 21:12:13 PST 2006
Changes in directory llvm:
Makefile.rules updated: 1.341 -> 1.342
---
Log message:
Implement an alternative way of handling generated lex files in CVS. This
should solve the "updating cvs when .l files change give me conflict markers
that break my build" issue.
---
Diffs of the changes: (+14 -4)
Makefile.rules | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
Index: llvm/Makefile.rules
diff -u llvm/Makefile.rules:1.341 llvm/Makefile.rules:1.342
--- llvm/Makefile.rules:1.341 Mon Feb 13 22:27:15 2006
+++ llvm/Makefile.rules Mon Feb 13 23:12:00 2006
@@ -1204,6 +1204,8 @@
%.c: %.l
%.cpp: %.l
+all:: $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs)
+
# Note the extra sed filtering here, used to cut down on the warnings emited
# by GCC. The last line is a gross hack to work around flex aparently not
# being able to resize the buffer on a large token input. Currently, for
@@ -1217,10 +1219,18 @@
$(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
$(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
> $(PROJ_SRC_DIR)/$*.cpp
- $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp (generated file)"
+
+# IFF the .l file has changed since it was last checked into CVS, copy the .l
+# file to .l.cvs and the generated .cpp file to .cpp.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.
+$(LexFiles:%.l=$(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)
-LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles))
-$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
+$(LexFiles:%.l=$(ObjDir)/%.o) : \
+$(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
clean-local::
-$(Verb) $(RM) -f $(LexOutput)
@@ -1323,7 +1333,7 @@
# Get the list of dependency files
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
-DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles))
+DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
-include /dev/null $(DependFiles)
More information about the llvm-commits
mailing list