Browse Source

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.
tags/v0.9.3
Marty Connor 17 years ago
parent
commit
a9b8197f64
1 changed files with 52 additions and 54 deletions
  1. 52
    54
      src/Makefile

+ 52
- 54
src/Makefile View File

@@ -1,3 +1,7 @@
1
+# Location to place generated files
2
+#
3
+BIN		:= bin
4
+
1 5
 # Initialise variables that get added to throughout the various Makefiles
2 6
 #
3 7
 MAKEDEPS	:= Makefile .toolcheck .echocheck
@@ -9,34 +13,34 @@ ROMS		:=
9 13
 MEDIA		:=
10 14
 NON_AUTO_MEDIA	:=
11 15
 
12
-# Grab the central Config file.
13
-#
14
-MAKEDEPS	+= Config
15
-include Config
16
-
17
-# Location to place generated files
18
-#
19
-BIN		:= bin
20
-
21
-# If no architecture is specified in Config or on the command-line,
22
-# use that of the build machine.
23
-#
24
-ifndef ARCH
25
-ARCH		:= $(shell uname -m | sed -e s,i[3456789]86,i386,)
26
-endif
27
-
28
-# handle x86_64 like i386, but set -m32 option for 32bit code only
29
-ifeq ($(ARCH),x86_64)
30
-ARCH		:= i386
31
-CFLAGS		+= -m32
32
-ASFLAGS         += --32
33
-LDFLAGS         += -m elf_i386
34
-endif
35
-
36
-# Drag in architecture-specific Config
16
+# Locations of utilities
37 17
 #
38
-MAKEDEPS	+= arch/$(ARCH)/Config
39
-include arch/$(ARCH)/Config
18
+HOST_CC		:= gcc
19
+RM		:= rm -f
20
+TOUCH		:= touch
21
+MKDIR		:= mkdir
22
+CP		:= cp
23
+ECHO		:= echo
24
+PRINTF		:= printf
25
+PERL		:= /usr/bin/perl
26
+CC		:= $(CROSS_COMPILE)gcc
27
+CPP		:= $(CROSS_COMPILE)gcc -E -Wp,-Wall
28
+AS		:= $(CROSS_COMPILE)as
29
+LD		:= $(CROSS_COMPILE)ld
30
+SIZE		:= $(CROSS_COMPILE)size
31
+AR		:= $(CROSS_COMPILE)ar
32
+RANLIB		:= $(CROSS_COMPILE)ranlib
33
+OBJCOPY		:= $(CROSS_COMPILE)objcopy
34
+NM		:= $(CROSS_COMPILE)nm
35
+OBJDUMP		:= $(CROSS_COMPILE)objdump
36
+PARSEROM	:= $(PERL) ./util/parserom.pl
37
+MAKEROM		:= $(PERL) ./util/makerom.pl
38
+MKCONFIG	:= $(PERL) ./util/mkconfig.pl
39
+SYMCHECK	:= $(PERL) ./util/symcheck.pl
40
+SORTOBJDUMP	:= $(PERL) ./util/sortobjdump.pl
41
+NRV2B		:= ./util/nrv2b
42
+ZBIN		:= ./util/zbin
43
+DOXYGEN		:= doxygen
40 44
 
41 45
 # If invoked with no build target, print out a helpfully suggestive
42 46
 # message.
@@ -64,34 +68,28 @@ noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
64 68
 	@$(ECHO)
65 69
 	@$(ECHO) '==========================================================='
66 70
 
67
-# Locations of utilities
71
+# Grab the central Config file.
68 72
 #
69
-HOST_CC		?= gcc
70
-CPP		?= gcc -E -Wp,-Wall
71
-RM		?= rm -f
72
-TOUCH		?= touch
73
-MKDIR		?= mkdir
74
-CP		?= cp
75
-ECHO		?= echo
76
-PRINTF		?= printf
77
-PERL		?= /usr/bin/perl
78
-CC		?= $(CROSS_COMPILE)gcc
79
-AS		?= $(CROSS_COMPILE)as
80
-LD		?= $(CROSS_COMPILE)ld
81
-SIZE		?= $(CROSS_COMPILE)size
82
-AR		?= $(CROSS_COMPILE)ar
83
-RANLIB		?= $(CROSS_COMPILE)ranlib
84
-OBJCOPY		?= $(CROSS_COMPILE)objcopy
85
-NM		?= $(CROSS_COMPILE)nm
86
-OBJDUMP		?= $(CROSS_COMPILE)objdump
87
-PARSEROM	?= $(PERL) ./util/parserom.pl
88
-MAKEROM		?= $(PERL) ./util/makerom.pl
89
-MKCONFIG	?= $(PERL) ./util/mkconfig.pl
90
-SYMCHECK	?= $(PERL) ./util/symcheck.pl
91
-SORTOBJDUMP	?= $(PERL) ./util/sortobjdump.pl
92
-NRV2B		?= ./util/nrv2b
93
-ZBIN		?= ./util/zbin
94
-DOXYGEN		?= doxygen
73
+MAKEDEPS	+= Config
74
+include Config
75
+
76
+# If no architecture is specified in Config or on the command-line,
77
+# use that of the build machine.
78
+#
79
+ARCH		?= $(shell uname -m | sed -e s,i[3456789]86,i386,)
80
+
81
+# handle x86_64 like i386, but set -m32 option for 32bit code only
82
+ifeq ($(ARCH),x86_64)
83
+ARCH		:= i386
84
+CFLAGS		+= -m32
85
+ASFLAGS         += --32
86
+LDFLAGS         += -m elf_i386
87
+endif
88
+
89
+# Drag in architecture-specific Config
90
+#
91
+MAKEDEPS	+= arch/$(ARCH)/Config
92
+include arch/$(ARCH)/Config
95 93
 
96 94
 # Common flags
97 95
 #

Loading…
Cancel
Save