From a9b8197f642393956d7de2124fb73722eb4d7dac Mon Sep 17 00:00:00 2001 From: Marty Connor Date: Wed, 2 Jan 2008 12:50:30 -0500 Subject: 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. --- src/Makefile | 106 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 54 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 181537ea..f74bd8bf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,7 @@ +# Location to place generated files +# +BIN := bin + # Initialise variables that get added to throughout the various Makefiles # MAKEDEPS := Makefile .toolcheck .echocheck @@ -9,34 +13,34 @@ ROMS := MEDIA := NON_AUTO_MEDIA := -# Grab the central Config file. -# -MAKEDEPS += Config -include Config - -# Location to place generated files -# -BIN := bin - -# If no architecture is specified in Config or on the command-line, -# use that of the build machine. -# -ifndef ARCH -ARCH := $(shell uname -m | sed -e s,i[3456789]86,i386,) -endif - -# handle x86_64 like i386, but set -m32 option for 32bit code only -ifeq ($(ARCH),x86_64) -ARCH := i386 -CFLAGS += -m32 -ASFLAGS += --32 -LDFLAGS += -m elf_i386 -endif - -# Drag in architecture-specific Config +# Locations of utilities # -MAKEDEPS += arch/$(ARCH)/Config -include arch/$(ARCH)/Config +HOST_CC := gcc +RM := rm -f +TOUCH := touch +MKDIR := mkdir +CP := cp +ECHO := echo +PRINTF := printf +PERL := /usr/bin/perl +CC := $(CROSS_COMPILE)gcc +CPP := $(CROSS_COMPILE)gcc -E -Wp,-Wall +AS := $(CROSS_COMPILE)as +LD := $(CROSS_COMPILE)ld +SIZE := $(CROSS_COMPILE)size +AR := $(CROSS_COMPILE)ar +RANLIB := $(CROSS_COMPILE)ranlib +OBJCOPY := $(CROSS_COMPILE)objcopy +NM := $(CROSS_COMPILE)nm +OBJDUMP := $(CROSS_COMPILE)objdump +PARSEROM := $(PERL) ./util/parserom.pl +MAKEROM := $(PERL) ./util/makerom.pl +MKCONFIG := $(PERL) ./util/mkconfig.pl +SYMCHECK := $(PERL) ./util/symcheck.pl +SORTOBJDUMP := $(PERL) ./util/sortobjdump.pl +NRV2B := ./util/nrv2b +ZBIN := ./util/zbin +DOXYGEN := doxygen # If invoked with no build target, print out a helpfully suggestive # message. @@ -64,34 +68,28 @@ noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb @$(ECHO) @$(ECHO) '===========================================================' -# Locations of utilities +# Grab the central Config file. # -HOST_CC ?= gcc -CPP ?= gcc -E -Wp,-Wall -RM ?= rm -f -TOUCH ?= touch -MKDIR ?= mkdir -CP ?= cp -ECHO ?= echo -PRINTF ?= printf -PERL ?= /usr/bin/perl -CC ?= $(CROSS_COMPILE)gcc -AS ?= $(CROSS_COMPILE)as -LD ?= $(CROSS_COMPILE)ld -SIZE ?= $(CROSS_COMPILE)size -AR ?= $(CROSS_COMPILE)ar -RANLIB ?= $(CROSS_COMPILE)ranlib -OBJCOPY ?= $(CROSS_COMPILE)objcopy -NM ?= $(CROSS_COMPILE)nm -OBJDUMP ?= $(CROSS_COMPILE)objdump -PARSEROM ?= $(PERL) ./util/parserom.pl -MAKEROM ?= $(PERL) ./util/makerom.pl -MKCONFIG ?= $(PERL) ./util/mkconfig.pl -SYMCHECK ?= $(PERL) ./util/symcheck.pl -SORTOBJDUMP ?= $(PERL) ./util/sortobjdump.pl -NRV2B ?= ./util/nrv2b -ZBIN ?= ./util/zbin -DOXYGEN ?= doxygen +MAKEDEPS += Config +include Config + +# If no architecture is specified in Config or on the command-line, +# use that of the build machine. +# +ARCH ?= $(shell uname -m | sed -e s,i[3456789]86,i386,) + +# handle x86_64 like i386, but set -m32 option for 32bit code only +ifeq ($(ARCH),x86_64) +ARCH := i386 +CFLAGS += -m32 +ASFLAGS += --32 +LDFLAGS += -m elf_i386 +endif + +# Drag in architecture-specific Config +# +MAKEDEPS += arch/$(ARCH)/Config +include arch/$(ARCH)/Config # Common flags # -- cgit v1.2.3-55-g7522