Re: [cc65] Building with custom CC and CFLAGS

From: Greg King <greg.king41verizon.net>
Date: 2009-10-01 19:49:40
From: "Per Olofsson"; on Thurs., Oct. 01, 2009; 02:24 AM -0400
>
> > Try it again.  I "tore down" a fence that used to block
> > those assignments.
>
> I did, and sent you a patch that fixes it in a nicer way,
> since it also solves problem 2:
>
> >
> > make bins docs CC=clang CFLAGS=-O4
> > make libs
> >
> > Hmm, I just had a thought: maybe, I can ask Gnu make about the origin
of
> > CC. When it does not come from the command line,
> > the make-file can run the "libs" rule. I'll check the docs...
>
> With my changes, you can build with a single make command;
> and, specify CC and CFLAGS inside the makefile.  Much cleaner:
>
> --- cc65-2.13/make/gcc.mak 2009-10-01 08:23:45.000000000 +0200
> +++ cc65/make/gcc.mak 2009-09-29 15:08:48.000000000 +0200
> @@ -14,6 +14,10 @@
>  #MAKEOVERRIDES=
>  # (That trick has been disabled.)
>
> +# To compile with custom make options, set them here, for example:
> +MAKEOPTS = CC=clang CFLAGS=-O4 -j 2
> +#MAKEOPTS =
> +
>  # The install prefix and directories
>  prefix = /usr/local
>  exec_prefix = $(prefix)
> @@ -58,7 +62,7 @@
>  all: bins libs docs $(SYS:%=samples tests)
>
>  bins:
> - @$(MAKE) -C src -f make/gcc.mak CA65_INC=\\\"${CA65_INC}/\\\" \
> + @$(MAKE) $(MAKEOPTS) -C src -f make/gcc.mak CA65_INC=\\\"${CA65_INC}/>
\\\" \
>     CC65_INC=\\\"${CC65_INC}/\\\" LD65_CFG=\\\"${LD65_CFG}/\\\" \
>     LD65_LIB=\\\"${LD65_LIB}/\\\" LD65_OBJ=\\\"${LD65_OBJ}/\\\"
>

OK, it is useful if one does special options often [avoids a lot of typing
;-) ].  I will use a somewhat more specific name, BINSOPTS.

>
> MAKEOPTS = -j 2

"cc65/src/make/gcc.mak" doesn't support parallel makes; it uses a shell
for-loop to walk through the list of sub-makes, one by one.  It would need
to be changed in this way:

*** cc65/src/make/gcc.mak\tTue Sep 29 09:53:42 2009
--- cc65/src/make/gcc.mak\tThu Oct  1 06:25:58 2009
***************
*** 14,20 ****
  \tld65\t\t\
  \tod65

! .PHONY: all dist clean zap
! all dist clean zap:
! \tfor i in $(SUBDIRS); do $(MAKE) -C $$i -f make/gcc.mak $@ || exit $$?;
done

--- 14,22 ----
  \tld65\t\t\
  \tod65

! .PHONY: all dist clean zap $(SUBDIRS)
! all dist clean zap:\t$(SUBDIRS)
!
! $(SUBDIRS):
! \t$(MAKE) -C $@ -f make/gcc.mak $(MAKECMDGOALS)

(Change "\t" to you-know-what.)

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Oct 1 20:21:07 2009

This archive was generated by hypermail 2.1.8 : 2009-10-01 20:21:09 CEST