Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

make file

0 views
Skip to first unread message

Allan Ashton

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
Does anybody know how to parameterise the make file in C. I want to
compile all programs in a library with or without debug depending on a
switch, parameter or environment variable.

Many Thanks.

Allan Ashton

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
P.S. I am using Unix.

Michael Powe

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Allan" == Allan Ashton <allana...@mywitsend99.freeserve.co.uk> writes:

Allan> Does anybody know how to parameterise the make file in C. I
Allan> want to compile all programs in a library with or without
Allan> debug depending on a switch, parameter or environment
Allan> variable.

- From the GNU Make manual:

Example of a Conditional========================

The following example of a conditional tells `make' to use one set
of libraries if the `CC' variable is `gcc', and a different set of
libraries otherwise. It works by controlling which of two command
lines will be used as the command for a rule. The result is that
`CC=gcc' as an argument to `make' changes not only which compiler is
used but also which libraries are linked.

libs_for_gcc = -lgnu
normal_libs =

foo: $(objects)
ifeq ($(CC),gcc)
$(CC) -o foo $(objects) $(libs_for_gcc)
else
$(CC) -o foo $(objects) $(normal_libs)
endif

Another option is to use a phony target, e.g. `debug.'

debug:
gcc $(DEBUG_OPTIONS) -o test $(OBJ)

mp

- --
powered by GNU/linux since Sept 1997
mic...@trollope.org http://www.trollope.org
Michael Powe Portland, Oregon USA
"Would John the Baptist have lost his head if his name was Steve?"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v0.9.0 (GNU/Linux)
Comment: Encrypted with Mailcrypt 3.5.1 and GNU Privacy Guard

iD8DBQE3IBGp755rgEMD+T8RAo0wAJ0Wijyn27VBdRqn/HmHCYMoqtE8SwCdEWPm
YpI1HSVi1aLWUePUvveE1bI=
=d2uK
-----END PGP SIGNATURE-----

0 new messages