diff options
author | Chris Lattner <sabre@nondot.org> | 2006-02-14 05:12:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-02-14 05:12:00 +0000 |
commit | 342567c987b1b68cb3e217c4de306d938e0cd12e (patch) | |
tree | d2e5988cd139c491cdff889f653f7d6a3da8a08a | |
parent | 77efe27ef1b2d3c305bb0f95cc19a5185d80b7b7 (diff) | |
download | external_llvm-342567c987b1b68cb3e217c4de306d938e0cd12e.zip external_llvm-342567c987b1b68cb3e217c4de306d938e0cd12e.tar.gz external_llvm-342567c987b1b68cb3e217c4de306d938e0cd12e.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26160 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Makefile.rules | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Makefile.rules b/Makefile.rules index 9a3c505..b6178d6 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -1204,6 +1204,8 @@ ifneq ($(LexFiles),) %.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 @@ $(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l $(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)" - -LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles)) -$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp + +# 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) + +$(LexFiles:%.l=$(ObjDir)/%.o) : \ +$(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp clean-local:: -$(Verb) $(RM) -f $(LexOutput) @@ -1323,7 +1333,7 @@ ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),) # 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) |