summaryrefslogtreecommitdiffstats
path: root/src/Makefile
diff options
context:
space:
mode:
authorMichael Brown2008-10-08 00:18:15 +0200
committerMichael Brown2008-10-08 03:17:25 +0200
commita2588547f913d5928f61ac30fd531a407925b4b5 (patch)
tree5627c7133a446723d87a79f2565a3b15dacc9098 /src/Makefile
parent[makefile] Kill off arch/$(ARCH)/Config (diff)
downloadipxe-a2588547f913d5928f61ac30fd531a407925b4b5.tar.gz
ipxe-a2588547f913d5928f61ac30fd531a407925b4b5.tar.xz
ipxe-a2588547f913d5928f61ac30fd531a407925b4b5.zip
[makefile] Add support for multiple build platforms
Allow for the build CPU architecture and platform to be specified as part of the make command goals. For example: make bin/rtl8139.rom # Standard i386 PC-BIOS build make bin-efi/rtl8139.efi # i386 EFI build The generic syntax is "bin[-[arch-]platform]", with the default architecture being "i386" (regardless of the host architecture) and the default platform being "pcbios". Non-path targets such as "srcs" can be specified using e.g. make bin-efi srcs Note that this changeset is merely Makefile restructuring to allow the build architecture and platform to be determined by the make command goals, and to export these to compiled code via the ARCH and PLATFORM defines. It doesn't actually introduce any new build platforms.
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile173
1 files changed, 68 insertions, 105 deletions
diff --git a/src/Makefile b/src/Makefile
index 354ca00c..833d2631 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,19 +1,17 @@
-# Location to place generated files
+###############################################################################
#
-BIN := bin
-
-# Initialise variables that get added to throughout the various Makefiles
+# Initialise various variables
#
-MAKEDEPS := Makefile .toolcheck .echocheck
-SRCDIRS :=
-SRCS :=
-NON_AUTO_SRCS :=
-DRIVERS :=
-ROMS :=
-MEDIA :=
-NON_AUTO_MEDIA :=
-# Locations of utilities
+CLEANUP :=
+CFLAGS :=
+ASFLAGS :=
+LDFLAGS :=
+MAKEDEPS := Makefile
+
+###############################################################################
+#
+# Locations of tools
#
HOST_CC := gcc
RM := rm -f
@@ -42,89 +40,11 @@ NRV2B := ./util/nrv2b
ZBIN := ./util/zbin
DOXYGEN := doxygen
-# If invoked with no build target, print out a helpfully suggestive
-# message.
-#
-noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb $(BIN)/undionly.kpxe
- @$(ECHO) '==========================================================='
- @$(ECHO)
- @$(ECHO) 'To create a bootable floppy, type'
- @$(ECHO) ' cat $(BIN)/gpxe.dsk > /dev/fd0'
- @$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
- @$(ECHO) 'data already on the disk.'
- @$(ECHO)
- @$(ECHO) 'To create a bootable USB key, type'
- @$(ECHO) ' cat $(BIN)/gpxe.usb > /dev/sdX'
- @$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
- @$(ECHO) 'disk on your system. This will erase any data already on'
- @$(ECHO) 'the USB key.'
- @$(ECHO)
- @$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
- @$(ECHO) '$(BIN)/gpxe.iso to a blank CD-ROM.'
- @$(ECHO)
- @$(ECHO) 'These images contain drivers for all supported cards. You'
- @$(ECHO) 'can build more customised images, and ROM images, using'
- @$(ECHO) ' make bin/<rom-name>.<output-format>'
- @$(ECHO)
- @$(ECHO) '==========================================================='
-
-# 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,')
-
-# Common flags
-#
-CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
-CFLAGS += -Os -ffreestanding
-CFLAGS += -Wall -W
-CFLAGS += -g
-CFLAGS += $(EXTRA_CFLAGS)
-ASFLAGS += $(EXTRA_ASFLAGS)
-LDFLAGS += $(EXTRA_LDFLAGS)
-
-# Embedded image, if present
-#
-EMBEDDED_IMAGE = /dev/null
-
-ifneq ($(NO_WERROR),1)
-CFLAGS += -Werror
-endif
-
-# CFLAGS for specific object types
-#
-CFLAGS_c +=
-CFLAGS_S += -DASSEMBLY
-
-# Base object name of the current target
+###############################################################################
#
-OBJECT = $(firstword $(subst ., ,$(@F)))
-
-# CFLAGS for specific object files. You can define
-# e.g. CFLAGS_rtl8139, and have those flags automatically used when
-# compiling bin/rtl8139.o.
-#
-OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
-$(BIN)/%.flags :
- @$(ECHO) $(OBJ_CFLAGS)
-
-# Rules for specific object types.
-#
-COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
-RULE_c = $(Q)$(COMPILE_c) -c $< -o $@
-RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(OBJECT)=$* -c $< -o $@
-RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
-RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
-
-PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
-ASSEMBLE_S = $(AS) $(ASFLAGS)
-RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
-RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
-
-DEBUG_TARGETS += dbg%.o c s
-
# SRCDIRS lists all directories containing source files.
#
+SRCDIRS :=
SRCDIRS += libgcc
SRCDIRS += core
SRCDIRS += proto
@@ -148,25 +68,68 @@ SRCDIRS += usr
# NON_AUTO_SRCS lists files that are excluded from the normal
# automatic build system.
#
-NON_AUTO_SRCS += core/elf_loader.c
+NON_AUTO_SRCS :=
NON_AUTO_SRCS += drivers/net/prism2.c
-# Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
-# the automatic build system and varies by target; it includes the
-# "-p 0x1234,0x5678" string to set the PCI IDs.
+###############################################################################
+#
+# Default build target: build the most common targets and print out a
+# helpfully suggestive message
+#
+all : bin/blib.a bin/gpxe.dsk bin/gpxe.iso bin/gpxe.usb bin/undionly.kpxe
+ @$(ECHO) '==========================================================='
+ @$(ECHO)
+ @$(ECHO) 'To create a bootable floppy, type'
+ @$(ECHO) ' cat bin/gpxe.dsk > /dev/fd0'
+ @$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
+ @$(ECHO) 'data already on the disk.'
+ @$(ECHO)
+ @$(ECHO) 'To create a bootable USB key, type'
+ @$(ECHO) ' cat bin/gpxe.usb > /dev/sdX'
+ @$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
+ @$(ECHO) 'disk on your system. This will erase any data already on'
+ @$(ECHO) 'the USB key.'
+ @$(ECHO)
+ @$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
+ @$(ECHO) 'bin/gpxe.iso to a blank CD-ROM.'
+ @$(ECHO)
+ @$(ECHO) 'These images contain drivers for all supported cards. You'
+ @$(ECHO) 'can build more customised images, and ROM images, using'
+ @$(ECHO) ' make bin/<rom-name>.<output-format>'
+ @$(ECHO)
+ @$(ECHO) '==========================================================='
+
+###############################################################################
#
-FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
- -i$(IDENT) -s 0 $@
+# Build targets that do nothing but might be tried by users
+#
+configure :
+ @$(ECHO) "No configuration needed."
+
+install :
+ @$(ECHO) "No installation required."
-# Some ROMs require specific flags to be passed to makerom.pl
+###############################################################################
#
-MAKEROM_FLAGS_3c503 = -3
+# Version number calculations
+#
+VERSION_MAJOR = 0
+VERSION_MINOR = 9
+VERSION_PATCH = 5
+EXTRAVERSION = +
+MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
+VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
+CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
+ -DVERSION_MINOR=$(VERSION_MINOR) \
+ -DVERSION=\"$(VERSION)\"
+IDENT = '$(@F) $(VERSION) (GPL) etherboot.org'
+version :
+ @$(ECHO) $(VERSION)
-# Drag in architecture-specific Makefile
+###############################################################################
+#
+# Drag in the bulk of the build system
#
-MAKEDEPS += arch/$(ARCH)/Makefile
-include arch/$(ARCH)/Makefile
-# Drag in the automatic build system and other housekeeping functions
MAKEDEPS += Makefile.housekeeping
include Makefile.housekeeping