From ecc06433fca8ea6d8085622cc079033f388be8cd Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 17 Feb 2009 01:37:39 +0000 Subject: [PATCH] flex output compiling with g++ git-svn-id: svn://anubis/fart/trunk@115 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- parser/Makefile | 23 ++++++----------------- parser/parser.lex | 2 ++ parser/parser.yy | 4 +--- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/parser/Makefile b/parser/Makefile index 36224ba..f2670eb 100644 --- a/parser/Makefile +++ b/parser/Makefile @@ -4,34 +4,23 @@ BISON := bison PARSER := parser -COBJS := lex.yy.o -CXXOBJS := $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc)) -OBJS := $(COBJS) $(CXXOBJS) +OBJS := lex.yy.o $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc)) all: $(OBJS) -%.o: %.c - $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $< - %.o: %.cc $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< $(PARSER).tab.cc $(PARSER).tab.hh: $(PARSER).yy $(BISON) -d $< -lex.yy.o: lex.yy.c +lex.yy.o: lex.yy.cc -lex.yy.c: $(PARSER).tab.hh -lex.yy.c: $(PARSER).lex - $(FLEX) $< +lex.yy.cc: $(PARSER).tab.hh +lex.yy.cc: $(PARSER).lex + $(FLEX) -o $@ $< # Make dependency files -%.dep: %.c - @set -e; rm -f $@; \ - $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ - rm -f $@.$$$$ - %.dep: %.cc @set -e; rm -f $@; \ $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ @@ -39,7 +28,7 @@ lex.yy.c: $(PARSER).lex rm -f $@.$$$$ clean: - -rm -f lex.yy.c $(PARSER).tab.cc $(PARSER).tab.hh *~ *.o *.dep + -rm -f lex.yy.cc $(PARSER).tab.cc $(PARSER).tab.hh *~ *.o *.dep # Include dependency files include $(OBJS:.o=.dep) diff --git a/parser/parser.lex b/parser/parser.lex index cec7f35..717351f 100644 --- a/parser/parser.lex +++ b/parser/parser.lex @@ -1,4 +1,6 @@ +%option nounput + %{ #include "nodes.h" diff --git a/parser/parser.yy b/parser/parser.yy index 59c7d62..540b89c 100644 --- a/parser/parser.yy +++ b/parser/parser.yy @@ -11,9 +11,7 @@ #include "nodes.h" using namespace std; -extern "C" { - int yylex(void); -} +int yylex(void); extern FILE * yyin;