automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to compile same source multiple times?


From: Tom Tromey
Subject: Re: how to compile same source multiple times?
Date: 24 Feb 2002 11:52:50 -0700

>>>>> "David" == David Mosberger-Tang <address@hidden> writes:

David> For example, I have a file called foo.c and I'd like to compile
David> it once with the normal options and once with -DBAR defined.
David> The resulting two objects would have to go into the same
David> library (foo.c will define different global symbols depending
David> on whether or not BAR is defined).

Interesting.  There's no automatic way to do this.

You can do it by hand though, sort of by following the etags example
in the manual.

    libfoo_a_SOURCES = foo.c
    libfoo_a_LIBADD = foo2.o

    foo2.o: foo.c
            $(COMPILE) -o foo2.o -DFOO $(srcdir)/foo.c

With this approach you lose dependency tracking for foo2.o.

If you want dependency tracking you could do something ugly like add a
convenience library containing only foo2.

If we ever add support for compiling .c->.o only (people sometimes ask
for this when they're building modules of some sort) then this feature
might be easy to handle.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]