Re: [cc65] Building with custom CC and CFLAGS

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-09-11 22:15:10
On Fri, Sep 11, 2009 at 10:31:02AM +0200, Per Olofsson wrote:
> > Maybe I'm not understanding this completely, but as already described in
> > another mail, I'm not using the top level makefile when working on one of the
> > tools (actually, the top level makefile is mostly used by the nightly build
> > script). If the "normal" makefiles just contain "CFLAGS += -I$(COMMON)" how do
> > they get "-O4 -Wall -W -std=c89" when called directly (which is their main
> > use)?
>
> With the ?= operator:
>
> CFLAGS ?= -O2 -Wall -W -std=c89
> CFLAGS +=  -I$(COMMON)
>
> This would give CFLAGS a correct default if it isn't already set
> (either on the commandline, in an environment variable, or a parent
> makefile), and add -I$(COMMON).

I don't like the possibility to override things from the environment. But let
me see if I understand things correctly:

  1. Simple assignments can be overriden on the command line, so if I say

        CFLAGS=--foo --bar

     this won't be used, if make is called with "CFLAGS=--baz --foobar".

  2. Using the += operator, I can append to a variable. This won't be influenced
     by the command line or environment.
                                                 
If this is true, I can separate CFLAGS into common stuff, like "-g -O2" or
whatever, and special stuff like "-DCC65_INC -DSPAWN_UNIX", so the former can
be overriden and the latter will always be added.

The top level makefile would then pass CFLAGS via command line to the
sub-makes. Would this enable you to use another compiler/translation tool more
easily?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Sep 11 22:18:05 2009

This archive was generated by hypermail 2.1.8 : 2009-09-11 22:18:07 CEST