On Mon, 13 May 2013 13:40:37 -0400 Nick Bowler <nbow...@elliptictech.com> wrote:
> On 2013-05-13 14:49 +0200, Cojocaru Alexandru wrote: > > Hi, > > I would like to compile both a program and a library from the same > > source file. This is what I have inside src/Makefile.am: > > > > lib_LTLIBRARIES = libex.la > > libex_la_SOURCES = src/ex.c > > include_HEADERS = src/ex.h > > > > AM_CPPFLAGS += -DSTANDALONE > > > > bin_PROGRAMS = ex > > ex_SOURCES = src/ex.c src/ex.h > > > > I would like to build first the library and then after defining STANDALONE > > the program. > > > > Is this possible? I even tried ex_SHORTNAME hoping that it would rename > > the object, but it didn't work. > > Automake supports separate CPPFLAGS for each program or library, see > ยง8.4 "Program and Library Variables" of the Automake manual[1]. > > Essentially, instead of setting -DSTANDALONE in AM_CPPFLAGS, you would > set it in the CPPFLAGS for ex, for example: > > ex_CPPFLAGS = -DSTANDALONE > It works, thanks! Best regards, Cojocaru Alexandru