I have the following makefile, which is working fine, to build my application. How can I configure an IDE (say, codeblocks, eclipse) to compile this.
The C/C++ files associated with yacc
are giving some errors when I try from eclipse/codeblocks. Is there any way to make eclipse/codeblocks to use an object file for some components directly while building/linking without specifying (including in project) the correponding .cc file?
If so, I can use y.tab.o
and lex.yy.o
directly as those are not changing 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
If you already have Makefile, you can use 'Makefile project' in Eclipse. In this case Eclipse will use 'make' instead of internal builder to build the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With