flex output compiling with g++

git-svn-id: svn://anubis/fart/trunk@115 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-17 01:37:39 +00:00
parent 6e67597dc7
commit ecc06433fc
3 changed files with 9 additions and 20 deletions

View File

@ -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)

View File

@ -1,4 +1,6 @@
%option nounput
%{
#include "nodes.h"

View File

@ -11,9 +11,7 @@
#include "nodes.h"
using namespace std;
extern "C" {
int yylex(void);
}
int yylex(void);
extern FILE * yyin;