Re: multiple target type makefile
- From: "cr88192" <cr88192@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 18:17:01 +1000
<eohrnberger@xxxxxxxxx> wrote in message
news:1151519814.206727.14620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm looking for a sample or template of a Makefile for Linux C++
project that has multiple target programs as well as multiple libraries
(both static and dynamic). If the command
make debug-static
is entered, a static debug build is created while if the command
make release-dynamic
is entered, a dynamic linking optimize release build is greated. If
these commands are entered at the top of the source tree, it should
recurse into each of the subdirectories in turn, and build the same
thing there (I think I've found this part of the solution).
I've googled both groups and the web but haven't found anything useful.
Has anyone ever written a Makefiles that have done this? If so could
you please share so that I can learn from your programming technique?
not exactly the same, but maybe close enough.
you type, eg:
make clean
and in the makefile somewhere you have something like:
clean:
make -C foo clean
make -C bar clean
and in the makefile in the foo subdir:
clean:
rm $(shell find -name \*.o)
now, assuming you want to do this for all of them, this may work.
something else I guess is to recurse into the makefile, eg, something like:
debug:
make CFLAGS="-g -pg" TYPE=debug target
release:
make CFLAGS="-O3" TYPE=release target
target:
make -C foo target
make -C bar target
(I think the vars are preserved, if not, passing them is easy enough).
Thanks in advance.
.
- References:
- multiple target type makefile
- From: eohrnberger
- multiple target type makefile
- Prev by Date: Re: Which language to learn?
- Next by Date: Re: RAD vs. performance
- Previous by thread: Re: multiple target type makefile
- Next by thread: Which language to learn?
- Index(es):
Relevant Pages
|