help-make
[Top][All Lists]
Advanced

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

RE: need help with the Makefile


From: Darin Johnson
Subject: RE: need help with the Makefile
Date: Fri, 9 Sep 2005 00:39:39 -0400 (EDT)

Two suggestions and ideas that may help.

If you can get a variable that's specific to a particular compiler or
OS release, you can always include another file that's particular to
that enviroment.  For instance I have something like:
    COMPILER ?= gcc
    - include $(COMPILER).mk
This means I can just normally use the default which lets "gcc.mk"
define all the CFLAGS that are needed for GNU CC.  But if I want to
compile with a different compiler I can type "make
COMPILER=someothercc" and it will include "someothercc.mk" with a
different set of flags.  This lets me put all the compiler specific
settings in separate files.

The same idea could apply for different operating system types, and
you could automate this by testing environment variables ($(OS) or
$(OSTYPE) or whatever).

Target specific variables are available in later versions of GNU make.
If you have something like:
   release:  CFLAGS+=-O4
then you can alter CFLAGS just for a specific target.  So "make" would use the
default settings, but "make release" would have extra optimization flags.





reply via email to

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