Hi All. I have been using linux for about 2 1/2 years now, and wanted to start C programming. I made the .c and .h files, and I want to know how to make a configure and Makefile.in. I know that kdevelop does this, but I just want to know how the old-fashoned way. Thanks! -Steven
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2005-07-23 at 17:21 -0400, Steven Pasternak wrote:
Hi All. I have been using linux for about 2 1/2 years now, and wanted to start C programming. I made the .c and .h files, and I want to know how to make a configure and Makefile.in. I know that kdevelop does this, but I just want to know how the old-fashoned way. Thanks!
For simple programs I don't think you need that... :-? - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC4sW4tTMYHG2NR9URArj/AJ4y4zS7F+lI1FMisF/sUvYXMoMkPACeO5A1 4QxISLOZkSyhGamHS7d0dY8= =r2ci -----END PGP SIGNATURE-----
Carlos E. R. wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
The Saturday 2005-07-23 at 17:21 -0400, Steven Pasternak wrote:
Hi All. I have been using linux for about 2 1/2 years now, and wanted to start C programming. I made the .c and .h files, and I want to know how to make a configure and Makefile.in. I know that kdevelop does this, but I just want to know how the old-fashoned way. Thanks!
For simple programs I don't think you need that... :-?
- -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76
iD8DBQFC4sW4tTMYHG2NR9URArj/AJ4y4zS7F+lI1FMisF/sUvYXMoMkPACeO5A1 4QxISLOZkSyhGamHS7d0dY8= =r2ci -----END PGP SIGNATURE-----
I am trying to build a library, and a program that links to it (and I just want to know how to work automake & friends :-) ). -Steven
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2005-07-23 at 19:10 -0400, Steven Pasternak wrote:
I am trying to build a library, and a program that links to it (and I just want to know how to work automake & friends :-) ).
Well, I have to confess that I don't know how they work O:-) The thing is, that to learn how to program in C, I would concentrate in learning C, and forget the rest for the moment. As I understand it, configure and such are only needed when you distribute the program for building in different systems. But I would also like to read an introduction on how to use those tools. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC4vx+tTMYHG2NR9URAo4wAJ96Y+148M4q7a91mOZBkg/uCgwDKwCeMJ2T 1bHVMDe1iubhxi2PECTHqOY= =u9ft -----END PGP SIGNATURE-----
Steven Pasternak wrote:
Carlos E. R. wrote:
The Saturday 2005-07-23 at 17:21 -0400, Steven Pasternak wrote:
Hi All. I have been using linux for about 2 1/2 years now, and wanted to start C programming. I made the .c and .h files, and I want to know how to make a configure and Makefile.in. I know that kdevelop does this, but I just want to know how the old-fashoned way. Thanks!
For simple programs I don't think you need that... :-?
-- Cheers, Carlos Robinson
I am trying to build a library, and a program that links to it (and I just want to know how to work automake & friends :-) ). -Steven
This really belongs in suse-programming-e... There's a nice book called GNU Autoconf, Automake and Libtool that goes through most of the details. Typically you need a minimal configure.ac file containing something like: # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT(cycles, 0.1, J.D.Lamb@x.y.z) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE dnl Checks for programs. AC_PROG_CXX AC_PROG_CPP AC_PROG_INSTALL AC_COMPILE_WARNINGS dnl Check for libtool AC_ENABLE_SHARED AC_PROG_LIBTOOL dnl Checks for libraries. AC_CHECK_LIBM dnl Checks for header files. AC_HEADER_STDC AC_CXX_NAMESPACES AC_CXX_HAVE_NUMERIC_LIMITS dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T dnl Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_MALLOC AC_CHECK_FUNCS([pow sqrt]) AC_CONFIG_FILES([Makefile main/Makefile test/Makefile ]) AC_OUTPUT echo \ "------------------------------------------------------------------------ Configuration: Source code location: ${srcdir} Compiler: ${CXX} Compiler flags: ${CXXFLAGS} Host System Type: ${host} Install path: ${prefix} See config.h for further configuration information. ------------------------------------------------------------------------ Building: To compile library: make To install library: make install To create test programs: make check (Creates in cycles/test.) To clean up: make clean ------------------------------------------------------------------------" Then in each directory (root, cycles, test), you put a Makefile.am file. Typically: ## Process this file with automake to produce Makefile.in SUBDIRS = main test or: ## Process this file with automake to produce Makefile.in ldflags = -version-info 1:0:1 sources = Graph.cc Random.cc EdgeRecorder.cc Circuits.cc P_centre.cc headers = Graph.h Random.h RuntimeException.h EdgeList.h \ IncidentEdgePropertyMap.h EarlyExitException.h EdgeRecorder.h \ Circuits.h P_centre.h Sort.h lib_LTLIBRARIES = libcycles.la if WITH_DEBUG AM_CXXFLAGS = -DDEBUG endif libcycles_la_LDFLAGS = $(ldflags) libcycles_la_SOURCES = $(sources) pkginclude_HEADERS = $(headers) clean-local: clean-src rm -f *~ clean-src: cd $(srcdir); rm -f *~ Then use $ aclocal -I m4 $ autoheader $ libtoolize --force $ automake --gnu --add-missing $ autoconf to create a configure script and everything should work the way you want it to. -- JDL
participants (3)
-
Carlos E. R.
-
John D Lamb
-
Steven Pasternak