[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conditional sources with libtool error?
From: |
Tim Van Holder |
Subject: |
Re: conditional sources with libtool error? |
Date: |
02 Oct 2001 16:54:43 +0200 |
On Tue, 2001-10-02 at 15:17, Matthias Braun wrote:
> Hello,
>
> I'm quite new to automake so I don't know if the following is a bug or an
> error from me:
>
> I use the following Makefile.am:
> ---
> EXTRA_libsal_la_SOURCES=wtask.cxx
> if USE_WINTASK
> TASKSOURCES=wtask.cxx
> endif
>
> EXTRA_libsal_la_SOURCES+=ptask.cxx
> if USE_PTHREAD
> TASKSOURCES=ptask.cxx
> endif
>
> libsal_la_SOURCES = ... $(TASKSOURCES)
> ---
>
> but automake 1.5 complains about it with an:
> warning: automake does not support conditional definition of TASKSOURCES in
> libsal_la_SOURCES
Since you already have them in EXTRA_x_SOURCES, you don't need them in
x_SOURCES.
Try
libsal_la_SOURCES = ...
EXTRA_libsal_la_SOURCES = wtask.cxx ptask.cxx
if USE_WINTASK
TASKOBJ = wtask.$(OBJEXT)
endif
if USE_PTHREAD
TASKOBJ = pthread.$(OBJEXT)
endif
libsal_la_LDADD = $(TASKOBJ)
I think that should work - the EXTRA_x_SOURCES causes compilation rules
to be generated for both optional files, and the LDADD pulls in the
requested object.
Note that as an alternative to the automake conditional, you could also
subst TASKOBJ in configure.ac:
[configure.ac]
TASKOBJ=
if foo-win; then
TASKOBJ=wtask.$OBJEXT # or TASKOBJ='wtask.$(OBJEXT)'; your choice
elif foo-posix
TASKOBJ=pthread.$OBJEXT
fi
AC_SUBST(TASK_OBJ)
[Makefile.am]
libsal_la_SOURCES = ...
EXTRA_libsal_la_SOURCES = wtask.cxx ptask.cxx
libsal_la_LDADD = @TASKOBJ@