You are not logged in.

#1 2013-12-28 16:08:53

Joel
Member
From: Tijuana, BC, México
Registered: 2011-12-21
Posts: 121

Help with AUTOMAKE_OPTIONS = subdir-objects

I'm trying to put all objects and binaries in the same directory, I have the following project tree:

./configure
./Makefile.am
+ src/
-- main.cpp
+ build/
-- Makefile.am

This is my configure.ac:

AC_INIT([gtkalarm], [1.0], [aullidolunar@gmail.com])
AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_INTLTOOL
AC_CONFIG_MACRO_DIR([m4])
AX_CXX_COMPILE_STDCXX_0X
AX_CXX_COMPILE_STDCXX_11

# Checking debug or release enable
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug mode for the maintainer.]), [enable_debug=yes], [enable_debug=no])
state_debug=false
AS_IF([test "x$enable_debug" = "xyes"],
[
	AC_MSG_NOTICE([********* Debug is enabled *****])
	CXXFLAGS="$CXXFLAGS -g3 -O0"
	AC_DEFINE(DEBUG,1,[Debugging])
	state_debug=true
],
[
	AC_MSG_NOTICE([********* Release is enabled *****])
	CXXFLAGS="$CXXFLAGS -s"
]
)
AC_SUBST(CXXFLAGS)
AM_CONDITIONAL([ENABLE_DEBUG], [$state_debug])

# Checking for gettext: requiered
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18.3])
GETTEXT_PACKAGE=$PACKAGE
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [package name for gettext])

AC_OUTPUT(
po/Makefile.in
Makefile
build/Makefile
)

my build/Makefile.am

AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}

if ENABLE_DEBUG
UI_PATH = "$(abs_top_builddir)/data/@PACKAGE@.ui"
ICON_PATH = "$(abs_top_builddir)/data/@PACKAGE@.png"
OGG_PATH = "$(abs_top_builddir)/data/@PACKAGE@.ogg"
locale_dir = "$(abs_top_builddir)/locale"
else
UI_PATH = "@datadir@/@PACKAGE@/@PACKAGE@.ui"
ICON_PATH = "@datadir@/pixmaps/@PACKAGE@.png"
OGG_PATH = "@datadir@/@PACKAGE@/@PACKAGE@.ogg"
locale_dir = "$(datadir)/locale"
endif

bin_PROGRAMS = gtkalarm
gtkalarm_SOURCES = ../src/main.cpp

AM_CXXFLAGS = -DUI_PATH='$(UI_PATH)' -DICON_PATH='$(ICON_PATH)' -DOGG_PATH='$(OGG_PATH)' -DLOCALEDIR=\"$(locale_dir)\"
LDADD = $(LTLIBINTL)

When I hit "make", the binary is placed on "build" as expected, but the object files are in the "src" directory, any ideas how to put object files on "build" directory too?


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.
* AUR contributor.

Offline

#2 2013-12-29 05:29:38

nsb
Member
From: Switzerland
Registered: 2008-03-26
Posts: 57

Re: Help with AUTOMAKE_OPTIONS = subdir-objects

What do you want to actually achieve? Simply seperating the source files from the binaries and object files? If so, I usually just make a seperate build directory, in which I make the binaries. Something like

mkdir build && cd build
../configure
make

Then your source directories are "mirrored" in the build directory and the object files are dumped therein.

Offline

Board footer

Powered by FluxBB