summaryrefslogtreecommitdiffstats
path: root/src/Makefile
diff options
context:
space:
mode:
authorMarty Connor2008-01-02 18:50:30 +0100
committerMarty Connor2008-01-02 20:07:52 +0100
commita9b8197f642393956d7de2124fb73722eb4d7dac (patch)
treed4a4188a443b01fb3ce28eae2c78d2ace2056f75 /src/Makefile
parentRetain some intermediate object files, suggested by Geert Stappers and Alexey... (diff)
downloadipxe-a9b8197f642393956d7de2124fb73722eb4d7dac.tar.gz
ipxe-a9b8197f642393956d7de2124fb73722eb4d7dac.tar.xz
ipxe-a9b8197f642393956d7de2124fb73722eb4d7dac.zip
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.
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile106
1 files changed, 52 insertions, 54 deletions
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
#