Menu

Need to compile using Makefiles

shank
2007-12-05
2012-09-26
  • shank

    shank - 2007-12-05

    Hi,

    I am new to Dev-C++. I have a Linux compiled project with many directories and source files in it. Each directory is governed by a MAKEFILE and I need to know whether I can create a project using the main MAKEFILE which in turn calls individual MAKEFILE under each directory for compilation.

    Whether Dev-C++ can load all those include paths and library paths on its own based on the makefile contents.

    Pls clarify.

    Thanks,
    sha

     
    • Anonymous

      Anonymous - 2007-12-05

      You have three options:

      1) Use a custom makefile
      2) Use Dev-C++'s built in project management and makefile generation.
      3) Use makefile customisation

      Option 1 allows you to use you your existing makefile. However it will have to work with the MinGW tools, which is not a comprehensive GNU toolset or Linux emulation, so your makefile may require some re-work to remove Linux dependencies. Using this makes Dev-C++ little more than a text editor since the changes you make to the project settings or the project content have no affect on the build. Of course you still have the debugger integration, but since that is barely functional in Dev-C++..., well as I said it is essentially a text editor.

      Option 2 is simplest, but is best used when all sources are compiled identically into a single executable, static library or DLL. It means abandoning the existing makefile and figuring out how to build it from Dev's auto generated makefile, which takes a rather simplistic view of projects but is usable in most cases. The sources need not be all in the same folder.

      Option 3 Takes option 2 but allows you to add build rules and dependencies through include files, and the provision to two rule stubs "all-before" and "all-after". You can also customise the compiler command line for individual sources.

      If you can use option 1, you can also just use the existing makefile form the command line as you might in Linux. You will need to modify the PATH environment variable to point to the toolchain (c:\dev-cpp\bin in a default installation), and if your Linux build relies on other environment variables for include and library paths for example, you will have to set those too.

      In some cases you may need to execute your makefile from within the MinGW MSYS environment. This is not included with Dev-C++. See www.mingw.org. As a last resort you might use Cygwin which is a more complete Linux emulation layer for Windows, and as well as supporting the Linux build environment it supports Linux specific code compilation as well (i.e. Linux OS calls, and Linux process model as well). If your code makes heavy use of pipes, fork, and other such things, Cygwin may be the answer. Otherwise you will have to port the code as well as the build. However if you can avoid reliance of Cygwin, you should - it makes deployment of your application far harder, and Cygwin apps are notorious for screwing each other up with different versions and parallel installations of the necessary support layer.

      Clifford

       
      • shank

        shank - 2007-12-06

        Hi,

        Thank you very much for the detailed answer. I shall try these things and let me see if I can succeed.

        Thanks,
        Shankar

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.