Eclipse c++ How to work with existing makefile

匿名 (未验证) 提交于 2019-12-03 08:36:05

问题:

I'm a newbie and I've a problem! I've to work with a c++ code and I don't know how to import it and how to compile it on eclips ( I compiled it by command line). The code has a particular structure and it is organized in this way:

repos____lib____configure (execute the configure file inside the libraries folders)                   I           I___makefile (execute the make file inside the libraries folders,                                                         requires make/make.def)       I           I___ib1____.cpp       I           I            I____.h       I           ...          I____configure (it requires make/configure_lib and                                                               make/configure_includes       I           ...          I____makefile (generated by configure)       I           I___lib2___....       i           I___.......       I           I___libn____.cpp       i                        I____.h       i                        I____configure       i                        I____makefile (generated by configure)       I       I___make(folder)__bashrc (are set the some environment variables)       I                               I__configure_bin       I                               I__configure_includes       I                               I__configure_lib       I                               I__make.def (are set all the include path and library path used       I                                                         in the configure file)       I___application__main.cpp                                    I__configure                                    I__makefile(generated by the configure file) 

to be sure that you understand my problem...(sure... :) )

the first configure file is:

cd lib1; ./configure cd ../lib2; ./configure ..... .... cd ../libn; ./configure cd 

and the first makefile is

include /media/Dati/WORKHOME/repos/make/make.def 

this is the makefile for the whole library

lib:     make -C lib1     make -C lib2     make -C libn 

an example of configure file (the one inside lib1):

   #!/usr/bin/perl  $INC = '$(OPENCVINC) $(FLTKINC) $(DC1394V2INC)';  ##<-DEFINED IN /make.def $LIB = '$(OPENCVLIB) $(FLTKLIB) $(DC1394V2LIB)';      #####################  #-------------------------------------------------------------------------------  require '/media/Dati/WORKHOME/repos/make/configure_lib'; print "Created Makefile.\n";  # this will create a include file for the whole directory,  # using the template <dirname>.h.templ require '/media/Dati/WORKHOME/repos/make/configure_includes'; print "Created $libname.h\n"; 

compile it without eclipse is simple

  1. type /.configure in the lib folder
  2. type make
  3. go into the application folder
  4. type ./configure
  5. type make
  6. run the program

my question is....in eclipse??? I imported the three with import/ import existing code as makefile project but now I don't know how compile it. could you please help me? it's important!

thank you very much gabriele

回答1:

You have done the right thing by using "import existing code as makefile project". Now eclipse know that it needs to call make and use your makefile. But Your build process is not only driven by make.

One solution is to write a makefile that call all your build steps. Something Like :

all:     cd dir1 && ./configure && make     cd dir2 && ./configure && make      etc. 

my2c

Edit:

I currently have no eclipse installed, so I can not send you detailled steps ... sorry



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!