2008-01-02 18:50:30 +01:00
|
|
|
# Location to place generated files
|
|
|
|
#
|
|
|
|
BIN := bin
|
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
# Initialise variables that get added to throughout the various Makefiles
|
|
|
|
#
|
2007-12-08 01:50:57 +01:00
|
|
|
MAKEDEPS := Makefile .toolcheck .echocheck
|
2005-04-08 17:01:17 +02:00
|
|
|
SRCDIRS :=
|
|
|
|
SRCS :=
|
|
|
|
NON_AUTO_SRCS :=
|
|
|
|
DRIVERS :=
|
|
|
|
ROMS :=
|
|
|
|
MEDIA :=
|
|
|
|
NON_AUTO_MEDIA :=
|
|
|
|
|
2008-01-02 18:50:30 +01:00
|
|
|
# Locations of utilities
|
2005-04-08 17:01:17 +02:00
|
|
|
#
|
2008-01-02 18:50:30 +01:00
|
|
|
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
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# If invoked with no build target, print out a helpfully suggestive
|
|
|
|
# message.
|
|
|
|
#
|
2007-08-10 05:17:35 +02:00
|
|
|
noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
|
2007-09-09 00:38:17 +02:00
|
|
|
@$(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) '==========================================================='
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2008-01-02 18:50:30 +01:00
|
|
|
# Grab the central Config file.
|
2005-04-08 17:01:17 +02:00
|
|
|
#
|
2008-01-02 18:50:30 +01:00
|
|
|
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
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# Common flags
|
|
|
|
#
|
2005-04-17 17:58:39 +02:00
|
|
|
CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
|
2005-04-08 17:01:17 +02:00
|
|
|
CFLAGS += -Os -ffreestanding
|
2007-07-24 15:01:14 +02:00
|
|
|
CFLAGS += -Wall -W
|
2006-03-23 14:09:29 +01:00
|
|
|
CFLAGS += -g
|
2005-04-08 17:01:17 +02:00
|
|
|
CFLAGS += $(EXTRA_CFLAGS)
|
|
|
|
ASFLAGS += $(EXTRA_ASFLAGS)
|
|
|
|
LDFLAGS += $(EXTRA_LDFLAGS)
|
|
|
|
|
2008-01-08 16:51:36 +01:00
|
|
|
# Embedded image, if present
|
|
|
|
#
|
|
|
|
EMBEDDED_IMAGE ?= /dev/null
|
|
|
|
|
2007-07-24 15:01:14 +02:00
|
|
|
ifneq ($(NO_WERROR),1)
|
|
|
|
CFLAGS += -Werror
|
|
|
|
endif
|
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
# CFLAGS for specific object types
|
|
|
|
#
|
|
|
|
CFLAGS_c +=
|
|
|
|
CFLAGS_S += -DASSEMBLY
|
|
|
|
|
2005-04-17 01:28:36 +02:00
|
|
|
# Base object name of the current target
|
|
|
|
#
|
|
|
|
OBJECT = $(firstword $(subst ., ,$(@F)))
|
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
# CFLAGS for specific object files. You can define
|
|
|
|
# e.g. CFLAGS_rtl8139, and have those flags automatically used when
|
|
|
|
# compiling bin/rtl8139.o.
|
|
|
|
#
|
2005-04-17 01:28:36 +02:00
|
|
|
OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
|
2005-04-08 17:01:17 +02:00
|
|
|
$(BIN)/%.flags :
|
2007-09-09 00:38:17 +02:00
|
|
|
@$(ECHO) $(OBJ_CFLAGS)
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# Rules for specific object types.
|
|
|
|
#
|
|
|
|
COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
|
2007-01-31 12:06:36 +01:00
|
|
|
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 $@
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
|
|
|
|
ASSEMBLE_S = $(AS) $(ASFLAGS)
|
2007-01-31 12:06:36 +01:00
|
|
|
RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
|
|
|
|
RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
|
2005-04-08 17:01:17 +02:00
|
|
|
|
2007-01-18 20:00:09 +01:00
|
|
|
DEBUG_TARGETS += dbg%.o c s
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# SRCDIRS lists all directories containing source files.
|
|
|
|
#
|
2007-07-30 03:37:42 +02:00
|
|
|
SRCDIRS += libgcc
|
2005-04-22 18:36:44 +02:00
|
|
|
SRCDIRS += core
|
2005-04-30 16:45:09 +02:00
|
|
|
SRCDIRS += proto
|
2007-01-10 03:52:58 +01:00
|
|
|
SRCDIRS += net net/tcp net/udp
|
2007-01-11 15:43:15 +01:00
|
|
|
SRCDIRS += image
|
2005-04-22 18:36:44 +02:00
|
|
|
SRCDIRS += drivers/bus
|
|
|
|
SRCDIRS += drivers/net
|
2007-11-18 17:12:54 +01:00
|
|
|
SRCDIRS += drivers/net/e1000
|
2006-05-13 13:35:29 +02:00
|
|
|
SRCDIRS += drivers/block
|
2006-05-17 19:31:18 +02:00
|
|
|
SRCDIRS += drivers/scsi
|
2006-05-31 16:31:48 +02:00
|
|
|
SRCDIRS += drivers/ata
|
2006-05-26 17:39:24 +02:00
|
|
|
SRCDIRS += drivers/nvs
|
2006-06-08 21:47:09 +02:00
|
|
|
SRCDIRS += drivers/bitbash
|
2007-09-18 07:06:55 +02:00
|
|
|
SRCDIRS += drivers/infiniband
|
2005-05-24 01:31:59 +02:00
|
|
|
SRCDIRS += interface/pxe
|
2006-06-01 13:05:36 +02:00
|
|
|
SRCDIRS += tests
|
2007-01-26 05:36:50 +01:00
|
|
|
SRCDIRS += crypto crypto/axtls crypto/matrixssl
|
2006-12-20 04:04:07 +01:00
|
|
|
SRCDIRS += hci hci/commands hci/tui
|
|
|
|
SRCDIRS += hci/mucurses hci/mucurses/widgets
|
2006-12-20 08:04:08 +01:00
|
|
|
SRCDIRS += usr
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# NON_AUTO_SRCS lists files that are excluded from the normal
|
|
|
|
# automatic build system.
|
|
|
|
#
|
|
|
|
NON_AUTO_SRCS += core/elf_loader.c
|
2005-04-17 01:28:36 +02:00
|
|
|
NON_AUTO_SRCS += drivers/net/prism2.c
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
#
|
2005-04-17 15:25:43 +02:00
|
|
|
FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
|
2007-07-06 00:36:45 +02:00
|
|
|
-i$(IDENT) -s 0 $@
|
2005-04-17 15:25:43 +02:00
|
|
|
|
|
|
|
# Some ROMs require specific flags to be passed to makerom.pl
|
|
|
|
#
|
|
|
|
MAKEROM_FLAGS_3c503 = -3
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# Drag in architecture-specific Makefile
|
|
|
|
#
|
|
|
|
MAKEDEPS += arch/$(ARCH)/Makefile
|
|
|
|
include arch/$(ARCH)/Makefile
|
|
|
|
|
|
|
|
# Drag in the automatic build system and other housekeeping functions
|
|
|
|
MAKEDEPS += Makefile.housekeeping
|
|
|
|
include Makefile.housekeeping
|