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 PARSER := parser
COBJS := lex.yy.o OBJS := lex.yy.o $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc))
CXXOBJS := $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc))
OBJS := $(COBJS) $(CXXOBJS)
all: $(OBJS) all: $(OBJS)
%.o: %.c
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
%.o: %.cc %.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
$(PARSER).tab.cc $(PARSER).tab.hh: $(PARSER).yy $(PARSER).tab.cc $(PARSER).tab.hh: $(PARSER).yy
$(BISON) -d $< $(BISON) -d $<
lex.yy.o: lex.yy.c lex.yy.o: lex.yy.cc
lex.yy.c: $(PARSER).tab.hh lex.yy.cc: $(PARSER).tab.hh
lex.yy.c: $(PARSER).lex lex.yy.cc: $(PARSER).lex
$(FLEX) $< $(FLEX) -o $@ $<
# Make dependency files # Make dependency files
%.dep: %.c
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.dep: %.cc %.dep: %.cc
@set -e; rm -f $@; \ @set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
@ -39,7 +28,7 @@ lex.yy.c: $(PARSER).lex
rm -f $@.$$$$ rm -f $@.$$$$
clean: 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 dependency files
include $(OBJS:.o=.dep) include $(OBJS:.o=.dep)

View File

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

View File

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