summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-08-27 18:50:39 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-08-27 18:50:39 +0000
commit68a24bdba4e19cb09dada5039a46e7ec41e848e8 (patch)
tree6e36d49d91d60f06d995ec5a96330c7ba802daa3 /Makefile.rules
parent88b9c159120703555a30314411af26f425597d90 (diff)
downloadllvm-68a24bdba4e19cb09dada5039a46e7ec41e848e8.tar.gz
llvm-68a24bdba4e19cb09dada5039a46e7ec41e848e8.tar.bz2
llvm-68a24bdba4e19cb09dada5039a46e7ec41e848e8.tar.xz
Implement PR614:
These changes modify the makefiles so that the output of flex and bison are placed in the SRC directory, not the OBJ directory. It is intended that they be checked in as any other LLVM source so that platforms without convenient access to flex/bison can be compiled. From now on, if you change a .y or .l file you *must* also commit the generated .cpp and .h files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules28
1 files changed, 16 insertions, 12 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 656609802f..8a0ff5bb0a 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1158,9 +1158,9 @@ LexFiles := $(filter %.l,$(Sources))
ifneq ($(LexFiles),)
-LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
-
-.PRECIOUS: $(LexOutput)
+# Cancel built-in rules for lex
+%.c: %.l
+%.cpp: %.l
# 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
@@ -1168,13 +1168,17 @@ LexOutput := $(strip $(patsubst %.l,%.cpp,$(LexFiles)))
# uninitialized string buffers in LLVM we can generate very long tokens, so
# this is a hack around it.
# FIXME. (f.e. char Buffer[10000] )
-%.cpp: %.l
+$(PROJ_SRC_DIR)/%.cpp: $(PROJ_SRC_DIR)/%.l
$(Echo) Flexing $*.l
- $(Verb) $(FLEX) -t $< | \
+ $(Verb) $(FLEX) -t $(PROJ_SRC_DIR)/$*.l | \
$(SED) 's/void yyunput/inline void yyunput/' | \
$(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
clean-local::
-$(Verb) $(RM) -f $(LexOutput)
@@ -1189,7 +1193,7 @@ endif
YaccFiles := $(filter %.y,$(Sources))
ifneq ($(YaccFiles),)
-YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
+YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output)
.PRECIOUS: $(YaccOutput)
@@ -1199,14 +1203,14 @@ YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.h .cpp .output)
%.h: %.y
# Rule for building the bison parsers...
-%.cpp %.h : %.y
+$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
$(Echo) "Bisoning $*.y"
- $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
- $(Verb) $(MV) -f $*.tab.c $*.cpp
- $(Verb) $(MV) -f $*.tab.h $*.h
+ $(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
+ $(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
+ $(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
+ $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)"
clean-local::
- -$(Verb) $(RM) -f $(YaccOutput)
$(Verb) $(RM) -f $(YaccOutput)
endif