Changeset 54

Show
Ignore:
Timestamp:
06/12/06 01:09:53 (6 years ago)
Author:
tg
Message:

Correctly determine HOSTCC and HOSTCFLAGS (from host make)
and pass them as CC/CFLAGS to the toolchain as well.

Now this at least goes as far as I suspected the first
breakage would be (on MirBSD) - autotools.

Detecting works by invoking $(MAKE) with a BSD-specific
makefile and just using $(HOSTCFLAGS) if that fails.
This works better on OpenBSD too, FWIW.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/Makefile

    r48 r54  
    3333GMAKE_INV=      PATH=$(PWD)/lbin:$(PATH) ${GMAKE} -f $(PWD)/build.mk ${VARS_TO_PASS} 
    3434 
    35 VARS_TO_PASS=   HOSTCC='${CC}' MAKE='${GMAKE}' 
     35VARS_TO_PASS=   HOSTCC='${CC}' MAKE='${GMAKE}' \ 
     36                HOSTCFLAGS="$$(x=$$(echo \ 
     37                    'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \ 
     38                    ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \ 
     39                    2>/dev/null | sed 's/^P://'); echo $${x:-${CFLAGS}})" 
    3640 
    3741all: prereq 
  • trunk/freewrt/build.mk

    r48 r54  
    8080toolchain/%: 
    8181        @$(TRACE) $@ 
    82         $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@) 
     82        $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@) \ 
     83            CC='$(HOSTCC)' CFLAGS='$(HOSTCFLAGS)' 
    8384 
    8485############################################################# 
  • trunk/freewrt/package/config/Makefile

    r1 r54  
    66 
    77# Select the compiler needed to build binaries for your development system 
    8 HOSTCC    = gcc 
    9 HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer 
     8HOSTCC    ?= gcc 
     9HOSTCFLAGS?= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer 
    1010# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. 
    1111LC_ALL:= C 
     
    9595ncurses: 
    9696        @echo "main() {}" > lxtemp.c 
    97         @if $(HOSTCC) lxtemp.c $(LIBS) ; then \ 
     97        @if $(HOSTCC) $(HOSTCFLAGS) lxtemp.c $(LIBS) ; then \ 
    9898                rm -f lxtemp.c a.out; \ 
    9999        else \