title: Autotools library and object file output control
body: <p>My goal is to have all object files built in a .objs directory instead of the root of the Makefile, and to have the binaries (and libraries) copied into the project's <em>bin/</em> directory. But I have been unable to find any resources to explain how to do this. How would I go about doing this?</p>
  
  <p>Here is my configure.ac and <em>src/Makefile.am</em> - I have similar Makefile.am files for two shared libraries that are referenced. They compile, and after copying them to the <em>bin/</em> directory work as they should. I'm just looking to automate this process.</p>
  
  <p><strong>configure.ac</strong></p>
  
  <pre><code>AC_PREREQ([2.63])
  AC_INIT([gtkworkbook], [0.12], [j_bellone@users.sourceforge.net])
  AC_CONFIG_SRCDIR([gtkworkbook/cell.c])
  AM_INIT_AUTOMAKE([gtkworkbook], [0.12])
  
  # Checks for programs.
  AC_PROG_CXX
  AC_PROG_CC
  AC_PROG_INSTALL
  AC_PROG_MAKE_SET
  AC_PROG_RANLIB
  AC_PROG_LIBTOOL
  AC_PROG_CC_C_O
  
  AC_CHECK_LIB([pthread], [pthread_mutex_init], [], [
              echo "pthread library is missing. pthread is required for this program"
              exit -1])
  
  # Checks for header files.
  AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
  
  # Checks for typedefs, structures, and compiler characteristics.
  AC_HEADER_STDBOOL
  AC_C_INLINE
  AC_TYPE_SIZE_T
  
  # Checks for library functions.
  AC_CHECK_FUNCS([gethostbyname memset socket])
  
  AC_OUTPUT([Makefile
         csv/Makefile
         gtkworkbook/Makefile
         src/Makefile])
  </code></pre>
  
  <p><strong>src/Makefile.am</strong></p>
  
  <pre><code>AUTOMAKE_OPTIONS= foreign
  
  C_FLAGS= -I/usr/local/include -I/usr/include -I/usr/local/include/gtkextra-2.0 -I$(top_srcdir)/include `pkg-config gtk+-2.0 glib-2.0 --cflags`
  L_FLAGS= -L/usr/local/lib -L/usr/lib -L$(top_srcdir)/lib `pkg-config gtk+-2.0 glib-2.0 --libs` -lgtkextra-x11-2.0
  
  bin_PROGRAMS= gtkworkbook
  gtkworkbook_SOURCES= application.c config.c main.c parse.c plugin.c
  gtkworkbook_CFLAGS= -Wall -lgthread-2.0 -std=c99 $(C_FLAGS)  
  gtkworkbook_LFLAGS= -ldl $(L_FLAGS)
  gtkworkbook_LDFLAGS= $(L_FLAGS)
  gtkworkbook_LDADD= ../gtkworkbook/libgtkworkbook.la ../csv/libcsv.la
  
  lib_LTLIBRARIES= realtime.la
  realtime_la_SOURCES= realtime/CsvParser.cpp realtime/Network.cpp realtime/Packet.cpp realtime/plugin_main.cpp \
      realtime/thread_main.cpp realtime/concurrent/Mutex.cpp realtime/concurrent/Semaphore.cpp \
      realtime/concurrent/Thread.cpp realtime/concurrent/ThreadGroup.cpp realtime/concurrent/ThreadPool.cpp \
      realtime/proactor/Dispatcher.cpp realtime/proactor/Event.cpp realtime/proactor/Proactor.cpp \
      realtime/proactor/InputDispatcher.cpp realtime/proactor/Worker.cpp realtime/network/Tcp.cpp
  realtime_la_CPPFLAGS= -Wall -Wno-write-strings $(C_FLAGS)
  realtime_la_LFLAGS= -lgtkworkbook -lcsv $(L_FLAGS)
  realtime_la_LDFLAGS= -module -export-dynamic 
  realtime_la_LIBADD= ../gtkworkbook/libgtkworkbook.la ../csv/libcsv.la
  </code></pre>
  
  <p>So, my question is how to specify the output directories for the compile results of each Makefile (I wish them to be copied to <em>bin/</em>, and for the object files to be in <em>.obj</em> of each project instead of in the root of the Makefile.</p>
  
  <p>Thanks for the help thus far.. this website has been a great resource, and I have learned a lot from the links provided already.</p>