Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 248225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:19:31+00:00 2026-05-11T21:19:31+00:00

My goal is to have all object files built in a .objs directory instead

  • 0

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 bin/ directory. But I have been unable to find any resources to explain how to do this. How would I go about doing this?

Here is my configure.ac and src/Makefile.am – I have similar Makefile.am files for two shared libraries that are referenced. They compile, and after copying them to the bin/ directory work as they should. I’m just looking to automate this process.

configure.ac

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])

src/Makefile.am

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

So, my question is how to specify the output directories for the compile results of each Makefile (I wish them to be copied to bin/, and for the object files to be in .obj of each project instead of in the root of the Makefile.

Thanks for the help thus far.. this website has been a great resource, and I have learned a lot from the links provided already.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:19:31+00:00Added an answer on May 11, 2026 at 9:19 pm

    The GNU Build System does not use obj/ directories, so the autotools are not designed to support that.

    However I can think of two ways to work around this.

    As an installer, you can build any package out of its source directory by typing

    mkdir builddir
    cd builddir
    ../path-to-sourcedir/configure
    make
    

    Then any output file will be created in the builddir/ directory. This compilation scheme makes it possible to compile source code out stored in a readonly directory (this made more sense back in the years where the FSF was distributing CDs with uncompressed source code), or to compile the same source with differents settings (or even for different architectures).

    As a packager, the only way you could force your package to build everything in obj/ is to put your Makefile.am in obj/, and declare all your build rules there. This would mean a obj/Makefile.am looking like:

    bin_PROGRAMS = foo bar
    foo_SOURCES = ../src/foo/main.c ../src/foo/help.c ../src/foo/list.c
    bar_SOURCES = ../src/bar/bar.c 
    

    etc. I remember that 10 years ago, POSE, the Palm OS Emulator, was using a setup like the above. I don’t recommend it as it’s not really maintainable. It’s really better to stick with the philosophy of the tools, and use a build systems that work like the other GNU packages.

    For an introduction to the GNU Build System, I recommend reading the introduction of the Automake manual:
    http://www.gnu.org/software/automake/manual/automake.html#GNU-Build-System

    Especially the Use-Cases section.
    If you don’t care about these use cases, I think your best course is NOT to use Automake, and build your own Makefiles. Otherwise you will keep trying to force Automake doing something it is not designed for, and you’ll quickly hate it.

    EDIT 2013-08-26: Note that an Automake project using a subdirectory named using obj/ is not portable to BSD make.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 241k
  • Answers 241k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Let's assume the request sends the current value of order… May 13, 2026 at 7:24 am
  • Editorial Team
    Editorial Team added an answer \d{1} means: ONLY one digit. Maybe you want to do… May 13, 2026 at 7:24 am
  • Editorial Team
    Editorial Team added an answer Your code should be: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PodmiotyZwolnioneCtrl.ascx.cs" Inherits="FormularzPodatkowy.PodmiotyZwolnioneCtrl"… May 13, 2026 at 7:24 am

Related Questions

I'm trying to build an object that looks something like this: public class MyObject
I am stumped right now. In my last post about this question the answer
Im using Visual Studio 2008, on an ASP.NET C# website. Overall what I want
This problem is probably very simple to solve but it is not clear to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.