[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to properly define a make file that builds two distinct objects
From: |
Allen S. Rout |
Subject: |
Re: how to properly define a make file that builds two distinct objects |
Date: |
Mon, 19 May 2008 10:19:20 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
"Robert P. J. Day" <address@hidden> writes:
> typically, a directory in a recursive make tree is responsible for
> building a single object of some kind -- say, an executable, or a
> shared library, or a loadable module, or what have you. if that's
> the case, my approach is to define a number of includable makefiles,
> one for each kind of object to be built.
This may be a much softer convention than you think.
> TARGETLIB = fubar.so
> SRCS = src1.c src2.c snafu.c
>
> include sharedlib.mk
If I get you, your problem is that you're using named variables to
express your dependencies. In fact, Make has a syntax for such
things. ;) How about:
fubar.so: src1.o src2.o snafu.o
? Then your rules only need to take care of building .so from .o, and
.o from .c, much of which might be already done for you. Then
> what if the "building" of that directory should result in a
> multitude of final objects -- say, an executable, a shared library
> *and* two loadable modules?
foo.so: src1.o src2.o snafu.o
bar.so: src1.o src2.o fusna.o
baz.so: src1.o src2.o ufsna.o
[...]
- Allen S. Rout