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 ...
- 11-26-2009 #1Linux 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:
Both main.cpp and hello.cpp include hello.h, and all main.cpp does is call function sayHello() from hello.cpp and then returns.Code:gnu-build-test src main.cpp hello.h hello.cpp
- 12-05-2009 #2Just 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.
- 12-05-2009 #3Linux User
- Join Date
- Jan 2006
- Posts
- 414
Here's a nice little make tutorial to get you started:
Make - a tutorial
- 12-06-2009 #4Just 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)
The 0.0.0 is version information.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)
For Makefile.am (in the base of your build directory)
And for Makefile.am in the src directory:Code:SUBDIRS = src
Pretty much you need a Makefile.am in the build subdirectory.Code:bin_PROGRAMS = yourprogramname yourprogramname_SOURCES = main.cpp hello.h hello.cpp
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.


Reply With Quote