home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vos2-121.zip / v / vide / mmakerbc.cpp < prev    next >
C/C++ Source or Header  |  1999-02-23  |  18KB  |  678 lines

  1. //===============================================================
  2. // mmaker.cpp    - makefileMaker Class for VIDE
  3. //
  4. // Copyright (C) 1995,1996, 1997, 1998  Bruce E. Wampler
  5. //
  6. // This file is part of the V C++ GUI Framework, and is covered
  7. // under the terms of the GNU Library General Public License,
  8. // Version 2. This library has NO WARRANTY. See the source file
  9. // vapp.cxx for more complete information about license terms.
  10. //===============================================================
  11.  
  12. #include <v/vnotice.h>
  13. #include <v/vos.h>
  14. #include "mmaker.h"
  15. #include "videapp.h"
  16.  
  17. //==================>>>   makefileMaker::fieldLen    <<<============================
  18.  
  19.     const int makefileMaker::fieldLen = 256;
  20.     static const char SecProjOpts[] = "//% Section 1 - PROJECT OPTIONS";
  21.     static const char SecProjOptsEnd[] = "//%end-proj-opts";
  22.     static const char SecMakefile[] = "//% Section 2 - MAKEFILE";
  23.     static const char SecOptions[] = "//% Section 3 - OPTIONS";
  24.     static const char SecOptionsEnd[] = "//%end-options";
  25.     static const char SecHomeV[] = "//% Section 4 - HOMEV";
  26.     static const char SecTarget[] = "//% Section 5  - TARGET FILE";
  27.     static const char SecObjFiles[] = "//% Section 6  - SOURCE FILES";
  28.     static const char SecObjFilesEnd[] = "//%end-srcfiles";
  29.     static const char SecCompiler[] = "//% Section 7  - COMPILER NAME";
  30.     static const char SecIncDirs[] = "//% Section 8  - INCLUDE DIRECTORIES";
  31.     static const char SecIncDirsEnd[] = "//%end-include-dirs";
  32.     static const char SecLibDirs[] = "//% Section 9 - LIBRARY DIRECTORIES";
  33.     static const char SecLibDirsEnd[] = "//%end-library-dirs";
  34.     static const char SecDefs[] = "//% Section 10  - DEFINITIONS";
  35.     static const char SecDefsPoolEnd[] = "//%end-defs-pool";
  36.     static const char SecDefsEnd[] = "//%end-defs";
  37.     static const char SecCFlags[] = "//% Section 11  - C FLAGS";
  38.     static const char SecLibFlags[] = "//% Section 12  - LIBRARY FLAGS";
  39.     static const char SecSrcDir[] = "//% Section 13  - SRC DIRECTORY";
  40.     static const char SecObjDir[] = "//% Section 14  - OBJ DIRECTORY";
  41.     static const char SecBinDir[] = "//% Section 15 - BIN DIRECTORY";
  42.     static const char SecUserTargets[] = "//% Section 16 - USER TARGETS";
  43.     static const char SecUserTargetsEnd[] = "//%end-user-targets";
  44.  
  45.  
  46. //==================>>> makefileMaker::makefileMaker <<<=========================
  47.   makefileMaker::makefileMaker()
  48.   {
  49.     makeName = new char[fieldLen];
  50.     homeV =   new char[fieldLen];
  51.     exeName = new char[fieldLen];
  52.     cc =      new char[fieldLen];
  53.     cFlags =  new char[fieldLen];
  54.     Libs =    new char[fieldLen];
  55.     ObjDir =  new char[fieldLen];
  56.     BinDir =  new char[fieldLen];
  57.     SrcDir =  new char[fieldLen];
  58.  
  59.     setDefaults();
  60.     cmdw = ((videApp*)theApp)->GetMsgWindow();
  61.  
  62.   }
  63.  
  64. //======================>>> makefileMaker::~makefileMaker <<<============================
  65.   makefileMaker::~makefileMaker()
  66.   {
  67.     delete [] makeName;
  68.     delete [] homeV;
  69.     delete [] exeName;
  70.     delete [] cc;
  71.     delete [] cFlags;
  72.     delete [] Libs;
  73.     delete [] BinDir;
  74.     delete [] SrcDir;
  75.     delete [] ObjDir;
  76.   }
  77.  
  78. //======================>>> makefileMaker::srcN2ObjN <<<=========================
  79.   char* makefileMaker::srcN2ObjN(char* n)
  80.   {
  81.     static char objn[fieldLen];
  82.     strcpy(objn, n);
  83.     int len = strlen(objn);
  84.     int ix;
  85.  
  86.     // replace .cpp with .o
  87.     for (ix = len - 1 ; ix >= 0 ; --ix)
  88.     if (objn[ix] == '.')
  89.         break;
  90.  
  91.     objn[ix] = 0;
  92.     strcat(objn,".o");
  93.     return stripDir(objn);
  94.   }
  95.  
  96. //======================>>> makefileMaker::eraseAll <<============================
  97.   void makefileMaker::eraseAll()
  98.   {
  99.     projOpts.erase();
  100.     incDirs.erase();
  101.     libDirs.erase();
  102.  
  103.     objFiles.erase();
  104.     defsPool.erase();
  105.     curDefs.erase();
  106.     curOpts.erase();
  107.     rules.erase();
  108.     userTargets.erase();
  109.     strcpy(makeName,"");
  110.     strcpy(homeV,"");
  111.     strcpy(exeName,"");
  112.     strcpy(cc,"");
  113.     strcpy(cFlags,"");
  114.     strcpy(Libs, "");
  115.     strcpy(ObjDir,"");
  116.     strcpy(BinDir,"");
  117.     strcpy(SrcDir,"");
  118.   }
  119.  
  120. //======================>>> makefileMaker::setDefaults <<============================
  121.   void makefileMaker::setDefaults()
  122.   {
  123.     //erase previous definitions
  124.     eraseAll();
  125.  
  126.     // init each one
  127.     strcpy(makeName,"Makefile.v");
  128.     vOS vos;
  129.     if (vos.vGetEnvVal("HOMEV",homeV,fieldLen) < 1)
  130.     strcpy(homeV,"C:/v");
  131.     strcpy(exeName,"foo.exe");
  132.     strcpy(cc,"g++");
  133.     strcpy(cFlags,"-O");
  134.     strcpy(Libs, "-lV -lcomctl32 -mwindows");
  135.     strcpy(ObjDir,".");
  136.     strcpy(BinDir,".");
  137.     strcpy(SrcDir,".");
  138.     libDirs.insert(-1,"$(HOMEV)/lib");
  139.     incDirs.insert(-1,"$(HOMEV)/include");
  140.   }
  141.  
  142. //======================>>> makefileMaker::stripDir <<<============================
  143.   char * makefileMaker::stripDir(char* n)
  144.   {
  145.     for (int ix = strlen(n) - 1 ; ix >= 0 ; --ix)
  146.       {
  147.     if (n[ix] == '/' || n[ix] == '\\')
  148.       {
  149.         return &n[ix+1];
  150.       }
  151.       }
  152.     return n;
  153.  }
  154.  
  155. //======================>>> makefileMaker::addFile <<<============================
  156.   BOOL makefileMaker::addFile(char *n)
  157.   {
  158.     //adds a new source file to the list
  159.  
  160.     if (!*n)
  161.     return false;
  162.  
  163.     // Filter name here... (add a behavior switch eventually)
  164.  
  165.     char* addName = stripDir(n);    // strip leading dir part
  166.  
  167.     for (int ix = 0 ; objFiles.list[ix] != 0 ; ++ix)
  168.     if (strcmp(objFiles.list[ix], addName) == 0)
  169.         return false; //don't add a obj file twice
  170.  
  171.     objFiles.insert(-1,addName);
  172.     return true;
  173.   }
  174.  
  175. //======================>>> makefileMaker::findRule <<<============================
  176.   void makefileMaker::findRule(char* name)
  177.   {
  178.     //finds the rules to build object file pointed by name
  179.  
  180.     vOS vos;        // To execute g++
  181.  
  182.     char command[500]; // command line
  183.     char hvbuff[256];
  184.  
  185.     cmdw = ((videApp*)theApp)->GetMsgWindow();
  186.  
  187.     strcpy(command,"g++");
  188.     for (int ix = 0 ; incDirs.list[ix] != 0 ; ++ix)
  189.       {
  190.     char *incdir = incDirs.list[ix];
  191.     char *hvp = strstr(incdir,"$(HOMEV)/");
  192.  
  193.     if (hvp != 0)
  194.       {
  195.         // Have $(HOMEV) in the path, so we must replace the
  196.         // $(HOMEV) with the real homeV path.
  197.         strcpy(hvbuff,homeV);
  198.         strcat(hvbuff, hvp+strlen("$(HOMEV)") );
  199.         incdir = hvbuff;
  200.       }
  201.  
  202.     strcat(command," -I");
  203.     strcat(command,incdir);
  204.     if (strlen(command) > 480)
  205.         break;
  206.       }
  207.     strcat(command," -MM "); strcat(command, name);
  208.  
  209.     static char makedep[] = "makedep.vtm";
  210.     static char makeerr[] = "makeerr.vtm";
  211.     char currlin[256];
  212.  
  213.     if (vos.vRunProcess(command, makedep, makeerr, 1, 1) != 0)
  214.       {
  215. CANTMAKE:
  216.     cmdw->AddLine(command);
  217.     vos.vDeleteFile(makedep);
  218.         ifstream em(makeerr);
  219.         if (em)
  220.           {
  221.             while(em.getline(currlin,256,'\n'))
  222.               cmdw->AddLine(currlin);
  223.             em.close();
  224.           }
  225.         vos.vDeleteFile(makeerr);
  226.     return;
  227.       }
  228.  
  229.     ifstream deps(makedep);
  230.     if (!deps)
  231.     goto CANTMAKE;
  232.  
  233.  
  234.     while ( deps.getline(currlin, 256, '\n'))
  235.       {
  236.         rules.insert(-1,currlin);
  237.       }
  238.  
  239.     deps.close();
  240.     vos.vDeleteFile(makedep);
  241.     vos.vDeleteFile(makeerr);
  242.   }
  243.  
  244. //======================>>> makefileMaker::saveMakefile <<<============================
  245.   void makefileMaker::saveMakefile()
  246.   {
  247.     //builds the file named makefile using infos stored in project
  248.     cmdw = ((videApp*)theApp)->GetMsgWindow();
  249.  
  250.     ofstream mkf(makeName);        // where to write makefile
  251.     //header
  252.     char buff[120];
  253.     char date[20];
  254.     vGetLocalTime(buff);
  255.     vGetLocalDate(date);
  256.  
  257.     cmdw->AddLine("Building Makefile -- Running g++ to generate dependencies...");
  258.  
  259.     mkf << "#=======================================================================\n";
  260.     mkf << "#@V@:Note: File generated by VIDE makefile maker ";
  261.     mkf << "(" << buff << " " << date << ").\n";
  262.     mkf << "#=======================================================================\n\n";
  263.     mkf << "# Standard and User define options:\n";
  264.  
  265.     // Options
  266.     int nxtOpts = curOpts.size();
  267.     int ix;
  268.     for (ix = 0 ; ix < nxtOpts ; ++ix)
  269.       {
  270.     mkf << curOpts.list[ix] << endl;
  271.       }
  272.     mkf << endl;
  273.  
  274.     //Compiler
  275.     mkf << "CC     \t=\t" << cc << "\n\n";
  276.  
  277.     // HomeV
  278.     mkf << "HOMEV\t=\t" << homeV << endl;
  279.  
  280.     //Dirs
  281.     mkf << "VPATH\t=\t$(HOMEV)/include" << endl;
  282.     mkf << "oDir\t=\t" << ObjDir << endl; //Obj Dir
  283.     mkf << "Bin\t=\t" << BinDir << endl; //Bin Dir
  284.     mkf << "Src\t=\t" << SrcDir << endl; //Src Dir
  285.  
  286.     mkf << "libDirs\t=";
  287.  
  288.     int nxtld = libDirs.size();
  289.  
  290.     for ( ix = 0 ; ix < nxtld ; ++ix)
  291.       {
  292.     mkf << "\t-L" << libDirs.list[ix];
  293.     if (ix + 1 < nxtld)
  294.         mkf << " \\";
  295.     mkf << endl;
  296.       }
  297.     mkf << endl;
  298.  
  299.     mkf << "incDirs\t="; 
  300.  
  301.     int nxtid = incDirs.size();
  302.  
  303.     for ( ix = 0 ; ix < nxtid ; ++ix)
  304.       {
  305.     mkf << "\t-I" << incDirs.list[ix];
  306.     if (ix + 1 < nxtid)
  307.         mkf << " \\";
  308.     mkf << endl;
  309.       }
  310.     mkf << endl;
  311.  
  312.     //Libs
  313.     mkf << "LIBS\t=\t" << Libs << endl;
  314.  
  315.     //C_FLAGS & paths to includes
  316.  
  317.     mkf << "C_FLAGS\t=\t" << cFlags;
  318.  
  319.     //defines
  320.     int nxtcd = curDefs.size();
  321.  
  322.     for ( ix = 0 ; ix < nxtcd ; ++ix)
  323.       {
  324.     mkf << "\\\n\t" << curDefs.list[ix];
  325.       }
  326.     mkf << endl << endl;
  327.  
  328.     //sources
  329.     int nxtof = objFiles.size();
  330.  
  331.     mkf << "SRCS\t=";
  332.  
  333.     for ( ix = 0 ; ix < nxtof ; ++ix)
  334.       {
  335.     mkf << "\\\n\t$(Src)/" << objFiles.list[ix];
  336.       }
  337.     mkf << endl << endl;
  338.  
  339.     //objects
  340.  
  341.     mkf << "EXOBJS\t=";
  342.  
  343.     for ( ix = 0 ; ix < nxtof ; ++ix)
  344.       {
  345.     char *objn = srcN2ObjN(objFiles.list[ix]);
  346.     mkf << "\\\n\t$(oDir)/" << objn;
  347.       }
  348.     mkf << endl << endl;
  349.  
  350.     mkf << "#@# Targets follow ---------------------------------" 
  351.     << endl << endl;
  352.     //target file
  353.     //all:
  354.     mkf << "all:    $(Bin)/" << exeName << endl << endl;
  355.     //objs:
  356.     mkf << "objs:    $(EXOBJS)\n\n";
  357.  
  358.     //cleanobjs:
  359.     mkf << "cleanobjs:\n\trm -f $(EXOBJS)" << endl << endl;
  360.  
  361.     // cleanbin
  362.     mkf << "cleanbin:\n\trm -f $(Bin)/" << exeName << endl << endl;
  363.  
  364.     // clean
  365.     mkf << "clean:\t cleanobjs" << endl << endl;
  366.  
  367.     // cleanall
  368.     mkf << "cleanall:\t cleanobjs cleanbin" << endl << endl;
  369.  
  370.     mkf << "#@# User Targets follow ---------------------------------" 
  371.     << endl << endl;
  372.  
  373.     for ( ix = 0 ; userTargets.list[ix] != 0 ; ++ix)
  374.     mkf << userTargets.list[ix] << endl;
  375.     mkf << endl;
  376.  
  377.     mkf << "#@# Dependency rules follow -----------------------------"
  378.     << endl << endl;
  379.     //dependency rules
  380.     mkf << "$(Bin)/" << exeName
  381.         << ": $(EXOBJS)" << endl << "\t$(CC) -o $(Bin)/"
  382.         << exeName << " $(EXOBJS) $(incDirs) $(libDirs) $(LIBS)" << endl ;
  383.  
  384.     for ( ix = 0 ; objFiles.list[ix] != 0 ; ix++)
  385.     findRule(objFiles.list[ix]);
  386.  
  387.     int lim = rules.size();
  388.     for ( ix = 0 ; ix < lim ; ++ix)
  389.       {
  390.         mkf << endl << "$(oDir)/" << rules.list[ix] << endl;
  391.         // check for continuation lines
  392.        while (*(rules.list[ix]+strlen(rules.list[ix])-1) == '\\')
  393.           {
  394.             ++ix;
  395.             if (rules.list[ix])
  396.                 mkf << rules.list[ix] << endl;
  397.           }
  398.         mkf << "\t$(CC) $(C_FLAGS) $(incDirs) -c -o $@ $<" << endl;
  399.       }
  400.  
  401.     mkf.close();
  402.  
  403.     strcpy(buff,makeName); strcat(buff," - Makefile saved.");
  404.     cmdw->AddLine(buff);
  405.  
  406.   }
  407.  
  408. //======================>>> makefileMaker::saveProject <<<============================
  409.   void makefileMaker::saveProject (char *nameIn)
  410.   {
  411.  
  412.     char n[300];
  413.  
  414.     if (strlen(nameIn) > 296)
  415.     strcpy(n,"BADFILE.tmp");
  416.     else
  417.     strcpy(n,nameIn);
  418.  
  419.     int len = strlen(n);
  420.     int ix;
  421.  
  422.     for (ix = len - 1 ; ix >= 0 ; --ix)
  423.       {
  424.     if (n[ix] == '.' || n[ix] == '/' || n[ix] == '\\')
  425.         break;
  426.       }
  427.     if (n[ix] != '.')    // user didn't supply extension
  428.     strcat(n,".vpj");
  429.  
  430.     ofstream prjf(n);
  431.  
  432.     //header
  433.     char buff[40];
  434.     char date[20];
  435.     vGetLocalTime(buff);
  436.     vGetLocalDate(date);
  437.  
  438.     prjf << "//=======================================================================\n";
  439.     prjf << "//@V@:Note: Project File generated by VIDE: ";
  440.     prjf << "(" << buff << " " << date << ").\n";
  441.     prjf << "//CAUTION! Hand edit only if you know what you are doing!\n";
  442.     prjf << "//=======================================================================\n\n";
  443.  
  444.     // Project Options
  445.     prjf << SecProjOpts << endl;
  446.  
  447.     for (int nxtOpts = 0 ; projOpts.list[nxtOpts] != 0 ; ++nxtOpts)
  448.     prjf << projOpts.list[nxtOpts] << endl;
  449.  
  450.     prjf << SecProjOptsEnd << endl << endl;
  451.  
  452.     // Makefile name
  453.     prjf << SecMakefile << endl;
  454.     prjf << makeName << endl << endl;
  455.  
  456.     // Options
  457.     prjf << SecOptions << endl;
  458.  
  459.     for ( nxtOpts = 0 ; curOpts.list[nxtOpts] != 0 ; ++nxtOpts)
  460.     prjf << curOpts.list[nxtOpts] << endl;
  461.  
  462.     prjf << SecOptionsEnd << endl << endl;
  463.  
  464.     // HOMEV
  465.     prjf << SecHomeV << endl;
  466.     prjf << homeV << endl << endl;
  467.  
  468.     // 1) name of exe target file
  469.     prjf << SecTarget << endl;
  470.     prjf << exeName << endl << endl;
  471.  
  472.     // 2) object files
  473.     prjf << SecObjFiles << endl;
  474.     for ( ix = 0 ; objFiles.list[ix] != 0 ; ++ix)
  475.       {
  476.     prjf <<  objFiles.list[ix] << endl;
  477.       }
  478.     prjf << SecObjFilesEnd << endl << endl;
  479.  
  480.     // 3) compiler name
  481.     prjf << SecCompiler << endl;
  482.     prjf << cc << endl << endl;
  483.  
  484.     // 4) include dirs
  485.     prjf << SecIncDirs << endl;
  486.  
  487.     for (int nxtid = 0 ; incDirs.list[nxtid] != 0 ; ++nxtid)
  488.     prjf << incDirs.list[nxtid] << endl;
  489.  
  490.     prjf << SecIncDirsEnd << endl << endl;
  491.  
  492.     // 5) lib dirs
  493.     prjf << SecLibDirs << endl;
  494.     for (int ld = 0 ; libDirs.list[ld] != 0 ; ++ld)
  495.     prjf << libDirs.list[ld] << endl;
  496.     prjf << SecLibDirsEnd << endl << endl;
  497.  
  498.     // 6) defs
  499.     prjf << SecDefs << endl;
  500.     for ( ix = 0 ; defsPool.list[ix] != 0 ; ++ix)
  501.     prjf << defsPool.list[ix] << endl;
  502.     prjf << SecDefsPoolEnd << endl;
  503.  
  504.     for ( ix = 0 ; curDefs.list[ix] != 0 ; ++ix)
  505.     prjf << curDefs.list[ix] << endl;
  506.     prjf << SecDefsEnd << endl << endl;
  507.  
  508.     // 7) cflag
  509.     prjf << SecCFlags << endl;
  510.     prjf << cFlags << endl << endl;
  511.  
  512.     // 8) libflag 
  513.     prjf << SecLibFlags << endl;
  514.     prjf << Libs << endl << endl;
  515.  
  516.     // src directory
  517.     prjf << SecSrcDir << endl;
  518.     prjf << SrcDir << endl << endl;
  519.  
  520.     // 9) object directory
  521.     prjf << SecObjDir << endl;
  522.     prjf << ObjDir << endl << endl;
  523.  
  524.     //10) bin directory
  525.     prjf << SecBinDir << endl;
  526.     prjf << BinDir << endl << endl;
  527.     // User Targets
  528.     prjf << endl << "//% User targets section. Following lines will be" << endl;
  529.     prjf << "//% inserted into Makefile right before the generated cleanall target." << endl;
  530.     prjf << "//% The Project File editor does not edit these lines - edit the .vpj" << endl;
  531.     prjf << "//% directly. You should know what you are doing." << endl;
  532.  
  533.     prjf << SecUserTargets << endl;
  534.     for ( ld = 0 ; userTargets.list[ld] != 0 ; ++ld)
  535.     prjf << userTargets.list[ld] << endl;
  536.     prjf << SecUserTargetsEnd << endl << endl;
  537.  
  538.     prjf.close();
  539.  
  540.  
  541.   }
  542.  
  543. //===================>>> makefileMaker::getSectionEntry <<<===========================
  544.   BOOL makefileMaker::getSectionEntry(ifstream &prjf, const char* head, char* value)
  545.   {
  546.     // read section head into value
  547.     char skipStr[256];
  548.     if (!prjf)
  549.     return false;
  550.     for (prjf.getline(skipStr, 256, '\n') ;    // skip line
  551.      prjf && strcmp(skipStr,head) != 0 ;
  552.      prjf.getline(skipStr, 256, '\n'))
  553.     ;
  554.  
  555.     for (prjf.getline(skipStr, 256, '\n') ;    // skip blank lines
  556.      prjf && (*skipStr == 0 || *skipStr == ' ') ;
  557.      prjf.getline(skipStr, 256, '\n'))
  558.     ;
  559.  
  560.     strcpy(value,skipStr);            // copy to output
  561.  
  562.     if (!prjf)
  563.     return false;
  564.     else
  565.     return true;
  566.  
  567.   }
  568.  
  569. //===================>>> makefileMaker::getSectionList <<<============================
  570.   BOOL makefileMaker::getSectionList(ifstream &prjf, const char* head, const char* term, vSList& sl)
  571.   {
  572.     char skipStr[256];
  573.     if (!prjf)
  574.     return false;
  575.     if (head && *head)    // allow no head - assumes at right location
  576.       {
  577.     for (prjf.getline(skipStr, 256, '\n') ;    // skip line
  578.          prjf && strcmp(skipStr,head) != 0 ;
  579.          prjf.getline(skipStr, 256, '\n'))
  580.         ;
  581.       }
  582.  
  583.     // get list now
  584.     for (prjf.getline(skipStr, 256, '\n') ;    // skip blank lines
  585.      prjf && strcmp(skipStr, term) != 0 ;
  586.      prjf.getline(skipStr, 256, '\n'))
  587.       {
  588.     if (*skipStr != ' ')
  589.         sl.insert(-1,skipStr);        // add to end of list
  590.       }
  591.  
  592.     if (!prjf)
  593.     return false;
  594.     else
  595.     return true;
  596.  
  597.   }
  598.  
  599. //======================>>> makefileMaker::loadProject <<<============================
  600.   void makefileMaker::loadProject (char *n)
  601.   {
  602.     //loads infos contained in project file n into makefileMaker member vars
  603.  
  604.     ifstream prjf(n);
  605.     if (!prjf)
  606.     return;
  607.  
  608.     eraseAll();
  609.   
  610.  
  611.     // Project Options
  612.     if (!getSectionList(prjf, SecProjOpts, SecProjOptsEnd, projOpts))
  613.     return;
  614.  
  615.     // Makefile
  616.     if (!getSectionEntry(prjf, SecMakefile, makeName))
  617.     return;
  618.  
  619.     //0) options
  620.     if (!getSectionList(prjf, SecOptions, SecOptionsEnd, curOpts))
  621.     return;
  622.  
  623.     // HOMEV
  624.     if (!getSectionEntry(prjf, SecHomeV, homeV))
  625.     return;
  626.  
  627.     //1) exe name
  628.     if (!getSectionEntry(prjf, SecTarget, exeName))
  629.     return;
  630.  
  631.     //2) objs
  632.     if (!getSectionList(prjf, SecObjFiles, SecObjFilesEnd, objFiles))
  633.     return;
  634.  
  635.     //3) compiler name
  636.     if (!getSectionEntry(prjf, SecCompiler, cc))
  637.     return;
  638.  
  639.     //4) include dirs
  640.     if (!getSectionList(prjf, SecIncDirs, SecIncDirsEnd, incDirs))
  641.     return;
  642.  
  643.     //5) lib dirs
  644.     if (!getSectionList(prjf, SecLibDirs, SecLibDirsEnd, libDirs))
  645.     return;
  646.  
  647.     //6) defs
  648.     if (!getSectionList(prjf, SecDefs, SecDefsPoolEnd, defsPool))
  649.     return;
  650.     if (!getSectionList(prjf, "", SecDefsEnd, curDefs))
  651.     return;
  652.  
  653.     //7) cflag
  654.     if (!getSectionEntry(prjf, SecCFlags, cFlags))
  655.     return;
  656.  
  657.     //8) libflag 
  658.     if (!getSectionEntry(prjf, SecLibFlags, Libs))
  659.     return;
  660.  
  661.     //  SRC directory
  662.     if (!getSectionEntry(prjf, SecSrcDir, SrcDir))
  663.     return;
  664.  
  665.     // 9) object directory
  666.     if (!getSectionEntry(prjf, SecObjDir, ObjDir))
  667.     return;
  668.  
  669.     //10) bin directory
  670.     if (!getSectionEntry(prjf, SecBinDir, BinDir))
  671.     return;
  672.  
  673.     // User targets.
  674.     if (!getSectionList(prjf, SecUserTargets, SecUserTargetsEnd, userTargets))
  675.     return;
  676.  
  677.   }
  678.