Creating a C ++ project in CodeBlocks / Eclipse that uses yacc and lex

I have the following makefile that works great for building my application. How can I configure an IDE (e.g. code blocks, eclipse) to compile this. The C / C ++ related files yaccgive some errors when I try to use eclipse / codeblocks. Is there a way to force eclipse / codeblocks to use the object file for some components directly when building / linking without specifying (including in the project) the .cc corrector file? If so, I can use y.tab.oit lex.yy.odirectly, since they do not change in my project.

CC = g++ -O2 -Wno-deprecated 

tag = -i

ifdef linux
tag = -n
endif

main.out: Sentence.o XOperation.o XOperationEngine.o Schema.o Doc.o TaskMan.o y.tab.o lex.yy.o test.o
    $(CC) -o main.out Sentence.o XOperation.o XOperationEngine.o Schema.o Doc.o TaskMan.o y.tab.o lex.yy.o test.o -lfl

main.o: main.cc
    $(CC) -g -c main.cc

XOperation.o: XOperation.cc
    $(CC) -g -c XOperation.cc

XOperationEngine.o: XOperationEngine.cc
    $(CC) -g -c XOperationEngine.cc

TaskMan.o: TaskMan.cc
    $(CC) -g -c TaskMan.cc

Doc.o: Doc.cc
    $(CC) -g -c Doc.cc

Sentence.o: Sentence.cc
    $(CC) -g -c Sentence.cc

Schema.o: Schema.cc
    $(CC) -g -c Schema.cc

y.tab.o: Parser.y
    yacc -d Parser.y
    sed $(tag) y.tab.c -e "s/  __attribute__ ((__unused__))$$/# ifndef __cplusplus\n  __attribute__ ((__unused__));\n# endif/" 
    g++ -c y.tab.c

lex.yy.o: Lexer.l
    lex  Lexer.l
    gcc  -c lex.yy.c

clean: 
    rm -f *.o
    rm -f *.out
    rm -f y.tab.c
    rm -f lex.yy.c
    rm -f y.tab.h
+5
source share
1

Makefile, "Makefile project" Eclipse. Eclipse make .

+4

All Articles