Find the answer to your Linux question:
Results 1 to 4 of 4
I wanted to learn about the GNU build tools but couldn't seem to find a decent and simple tutorial that explains it. The only ones I found deal with a ...
  1. #1
    MTK
    MTK is offline
    Linux Newbie
    Join Date
    Aug 2009
    Posts
    132

    GNU Build Tools

    I wanted to learn about the GNU build tools but couldn't seem to find a decent and simple tutorial that explains it. The only ones I found deal with a single source file, anyway, and didn't explain how to have a separate src directory. I was hoping that someone might help explain this to me or find a better tutorial?

    Anyway, here is my directory tree for now:

    Code:
    gnu-build-test
        src
            main.cpp
            hello.h
            hello.cpp
    Both main.cpp and hello.cpp include hello.h, and all main.cpp does is call function sayHello() from hello.cpp and then returns.

  2. #2
    Just Joined!
    Join Date
    Sep 2009
    Posts
    58
    Did you google GNU Build tools (sic)? I also think with tutorials only you are putting yourself under bad constraints. See if you can read up and get a broad understanding of that subject. Try to adopt an holistic approach to Linux. It will serve you better in future. It will also ensure that you keep on reaping the benefits of Linux.

  3. #3
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    Here's a nice little make tutorial to get you started:
    Make - a tutorial

  4. #4
    Just Joined!
    Join Date
    Dec 2009
    Posts
    2
    If you know how to use Makefile.am and configure.in then all that you have to do is put a Makefile.am in the directory that you want to build inside and add a SUBDIRS statement into your Makefile.am in your base directory. For example, in your case you might have:
    configure.in (in the base of your build directory)
    Code:
    AC_INIT(src/main.cpp)
    AM_INIT_AUTOMAKE(yourprogramname, 0.0.0)
    AC_PROG_CXX
    AC_PROG_CC
    AC_PROG_INSTALL
    AC_OUTPUT(Makefile src/Makefile)
    The 0.0.0 is version information.

    For Makefile.am (in the base of your build directory)
    Code:
    SUBDIRS = src
    And for Makefile.am in the src directory:
    Code:
    bin_PROGRAMS = yourprogramname
    yourprogramname_SOURCES = main.cpp hello.h hello.cpp
    Pretty much you need a Makefile.am in the build subdirectory.
    Hope that helps.

    Also, don't expect to find a simple tutorial on the GNU build tools. Since I am not allowed to post URLs, to find my favorite automake tutorial, type in "automake tutorial" on google, and it should be the first link in some subdomain of washington.edu.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...