c++ - Makefile with Bison and Lex -


i doing simple interpreter using bison , lex. make file content.

# # makefile ccalc # objs += mylang.o sm.o lex.o parse.o  # rules %.c: %.y     bison -o $(@:%.o=%.d) $<  %.c: %.l     flex -o$(@:%.o=%.d) -i $<  # dependencies mylang: mylang.yy.tab.c lex.c $(objs)     @echo g++ -os -std=c++0x -omylang $(objs)     @g++ -os -std=c++0x  -omylang $(objs)     @echo ' '  # source mylang.o: mylang.cpp  sm.o: sm.cpp sm.h  lex.o: lex.c  parse.o: mylang.yy.tab.c  mylang.yy.tab.c: mylang.yy  lex.c: mylang.ll 

when run make file, command running

g++    -c -o sm.o sm.cpp 

but want run as,

g++ -os -std=c++0x -c -o sm.o sm.cpp 

what should change in make file run c++0x compiler version.

set cxxflags flags accordingly:

cxxflags="-os -std=c++0" 

make uses internal defaults rule compile c++ files .o files. can display them make -p.

the rules in case are

compile.cc = $(cxx) $(cxxflags) $(cppflags) $(target_arch) -c compile.cpp = $(compile.cc)  %.o: %.cpp     #  recipe execute (built-in):     $(compile.cpp) $(output_option) $< 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -