Unconditionally set utility program variables in Makefile to allow CROSS_COMPILE to work.

stappers and xl0 pointed out that gnu make sets some variables, so ?=
is ineffective in some cases where we use it.. Cross-compilation
requires that some variables can be overridden in the
src/$(ARCH)/Config file, so include that file _after_ utility program
variables are set.
pull/1/head
Marty Connor 2008-01-02 12:50:30 -05:00
parent af56768e98
commit a9b8197f64
1 changed files with 52 additions and 54 deletions

View File

@ -1,3 +1,7 @@
# Location to place generated files
#
BIN := bin
# Initialise variables that get added to throughout the various Makefiles # Initialise variables that get added to throughout the various Makefiles
# #
MAKEDEPS := Makefile .toolcheck .echocheck MAKEDEPS := Makefile .toolcheck .echocheck
@ -9,34 +13,34 @@ ROMS :=
MEDIA := MEDIA :=
NON_AUTO_MEDIA := NON_AUTO_MEDIA :=
# Grab the central Config file. # Locations of utilities
# #
MAKEDEPS += Config HOST_CC := gcc
include Config RM := rm -f
TOUCH := touch
# Location to place generated files MKDIR := mkdir
# CP := cp
BIN := bin ECHO := echo
PRINTF := printf
# If no architecture is specified in Config or on the command-line, PERL := /usr/bin/perl
# use that of the build machine. CC := $(CROSS_COMPILE)gcc
# CPP := $(CROSS_COMPILE)gcc -E -Wp,-Wall
ifndef ARCH AS := $(CROSS_COMPILE)as
ARCH := $(shell uname -m | sed -e s,i[3456789]86,i386,) LD := $(CROSS_COMPILE)ld
endif SIZE := $(CROSS_COMPILE)size
AR := $(CROSS_COMPILE)ar
# handle x86_64 like i386, but set -m32 option for 32bit code only RANLIB := $(CROSS_COMPILE)ranlib
ifeq ($(ARCH),x86_64) OBJCOPY := $(CROSS_COMPILE)objcopy
ARCH := i386 NM := $(CROSS_COMPILE)nm
CFLAGS += -m32 OBJDUMP := $(CROSS_COMPILE)objdump
ASFLAGS += --32 PARSEROM := $(PERL) ./util/parserom.pl
LDFLAGS += -m elf_i386 MAKEROM := $(PERL) ./util/makerom.pl
endif MKCONFIG := $(PERL) ./util/mkconfig.pl
SYMCHECK := $(PERL) ./util/symcheck.pl
# Drag in architecture-specific Config SORTOBJDUMP := $(PERL) ./util/sortobjdump.pl
# NRV2B := ./util/nrv2b
MAKEDEPS += arch/$(ARCH)/Config ZBIN := ./util/zbin
include arch/$(ARCH)/Config DOXYGEN := doxygen
# If invoked with no build target, print out a helpfully suggestive # If invoked with no build target, print out a helpfully suggestive
# message. # message.
@ -64,34 +68,28 @@ noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
@$(ECHO) @$(ECHO)
@$(ECHO) '===========================================================' @$(ECHO) '==========================================================='
# Locations of utilities # Grab the central Config file.
# #
HOST_CC ?= gcc MAKEDEPS += Config
CPP ?= gcc -E -Wp,-Wall include Config
RM ?= rm -f
TOUCH ?= touch # If no architecture is specified in Config or on the command-line,
MKDIR ?= mkdir # use that of the build machine.
CP ?= cp #
ECHO ?= echo ARCH ?= $(shell uname -m | sed -e s,i[3456789]86,i386,)
PRINTF ?= printf
PERL ?= /usr/bin/perl # handle x86_64 like i386, but set -m32 option for 32bit code only
CC ?= $(CROSS_COMPILE)gcc ifeq ($(ARCH),x86_64)
AS ?= $(CROSS_COMPILE)as ARCH := i386
LD ?= $(CROSS_COMPILE)ld CFLAGS += -m32
SIZE ?= $(CROSS_COMPILE)size ASFLAGS += --32
AR ?= $(CROSS_COMPILE)ar LDFLAGS += -m elf_i386
RANLIB ?= $(CROSS_COMPILE)ranlib endif
OBJCOPY ?= $(CROSS_COMPILE)objcopy
NM ?= $(CROSS_COMPILE)nm # Drag in architecture-specific Config
OBJDUMP ?= $(CROSS_COMPILE)objdump #
PARSEROM ?= $(PERL) ./util/parserom.pl MAKEDEPS += arch/$(ARCH)/Config
MAKEROM ?= $(PERL) ./util/makerom.pl include arch/$(ARCH)/Config
MKCONFIG ?= $(PERL) ./util/mkconfig.pl
SYMCHECK ?= $(PERL) ./util/symcheck.pl
SORTOBJDUMP ?= $(PERL) ./util/sortobjdump.pl
NRV2B ?= ./util/nrv2b
ZBIN ?= ./util/zbin
DOXYGEN ?= doxygen
# Common flags # Common flags
# #