2005-04-08 15:01:17 +00:00
|
|
|
# Initialise variables that get added to throughout the various Makefiles
|
|
|
|
#
|
|
|
|
MAKEDEPS := Makefile .toolcheck
|
|
|
|
SRCDIRS :=
|
|
|
|
SRCS :=
|
|
|
|
NON_AUTO_SRCS :=
|
|
|
|
DRIVERS :=
|
|
|
|
ROMS :=
|
|
|
|
MEDIA :=
|
|
|
|
NON_AUTO_MEDIA :=
|
|
|
|
|
|
|
|
# Grab the central Config file.
|
|
|
|
#
|
|
|
|
MAKEDEPS += Config
|
|
|
|
include Config
|
|
|
|
|
|
|
|
# If no architecture is specified in Config or on the command-line,
|
|
|
|
# use that of the build machine.
|
|
|
|
#
|
2005-03-08 18:53:11 +00:00
|
|
|
ifndef ARCH
|
2005-04-08 15:01:17 +00:00
|
|
|
ARCH := $(shell uname -m | sed -e s,i[3456789]86,i386,)
|
2005-03-08 18:53:11 +00:00
|
|
|
endif
|
|
|
|
|
2005-04-08 15:01:17 +00:00
|
|
|
# Drag in architecture-specific Config
|
|
|
|
#
|
|
|
|
MAKEDEPS += arch/$(ARCH)/Config
|
2005-03-08 18:53:11 +00:00
|
|
|
include arch/$(ARCH)/Config
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
# If invoked with no build target, print out a helpfully suggestive
|
|
|
|
# message.
|
|
|
|
#
|
2005-06-14 20:16:03 +00:00
|
|
|
noargs :
|
2005-04-08 15:01:17 +00:00
|
|
|
@echo '===================================================='
|
|
|
|
@echo 'No target specified. To specify a target, do: '
|
|
|
|
@echo
|
|
|
|
@echo ' $(MAKE) bin/<rom-name>.<output-format> '
|
|
|
|
@echo
|
|
|
|
@echo 'where <output-format> is one of [z]{$(MEDIA) }'
|
|
|
|
@echo
|
|
|
|
@echo 'or: '
|
|
|
|
@echo
|
|
|
|
@echo ' $(MAKE) all<output-format>s'
|
|
|
|
@echo
|
|
|
|
@echo 'to generate all possible images of format <output-format>'
|
|
|
|
@echo
|
|
|
|
@echo 'For example, '
|
|
|
|
@echo
|
|
|
|
@echo ' make allzroms '
|
|
|
|
@echo
|
|
|
|
@echo 'will generate all possible .zrom (rom burnable) images, and'
|
|
|
|
@echo
|
|
|
|
@echo ' make allzdsks'
|
|
|
|
@echo
|
|
|
|
@echo 'will generate all possible .zdsk (bootable floppy) images, or'
|
|
|
|
@echo
|
|
|
|
@echo '===================================================='
|
|
|
|
@exit 1
|
|
|
|
|
|
|
|
# Locations of utilities
|
|
|
|
#
|
|
|
|
HOST_CC ?= gcc
|
|
|
|
CPP ?= gcc -E -Wp,-Wall
|
|
|
|
RM ?= rm -f
|
|
|
|
TOUCH ?= touch
|
|
|
|
MKDIR ?= mkdir
|
|
|
|
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
|
2005-04-25 19:25:45 +00:00
|
|
|
NM ?= $(CROSS_COMPILE)nm
|
2005-04-27 10:55:12 +00:00
|
|
|
OBJDUMP ?= $(CROSS_COMPILE)objdump
|
2005-04-08 15:01:17 +00:00
|
|
|
PARSEROM ?= $(PERL) ./util/parserom.pl
|
|
|
|
MAKEROM ?= $(PERL) ./util/makerom.pl
|
2005-04-17 15:58:39 +00:00
|
|
|
MKCONFIG ?= $(PERL) ./util/mkconfig.pl
|
2005-04-25 19:25:45 +00:00
|
|
|
SYMCHECK ?= $(PERL) ./util/symcheck.pl
|
2005-04-27 10:55:12 +00:00
|
|
|
SORTOBJDUMP ?= $(PERL) ./util/sortobjdump.pl
|
2005-04-08 15:01:17 +00:00
|
|
|
NRV2B ?= ./util/nrv2b
|
2005-05-18 11:12:17 +00:00
|
|
|
DOXYGEN ?= doxygen
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
# Location to place generated files
|
|
|
|
#
|
|
|
|
BIN ?= bin
|
|
|
|
|
|
|
|
# Common flags
|
|
|
|
#
|
2005-04-17 15:58:39 +00:00
|
|
|
CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
|
2005-04-08 15:01:17 +00:00
|
|
|
CFLAGS += -Os -ffreestanding
|
2006-05-18 21:23:38 +00:00
|
|
|
CFLAGS += -Wall -W
|
2006-03-23 13:09:29 +00:00
|
|
|
CFLAGS += -g
|
2005-04-08 15:01:17 +00:00
|
|
|
CFLAGS += $(EXTRA_CFLAGS)
|
|
|
|
ASFLAGS += $(EXTRA_ASFLAGS)
|
|
|
|
LDFLAGS += $(EXTRA_LDFLAGS)
|
|
|
|
|
|
|
|
# CFLAGS for specific object types
|
|
|
|
#
|
|
|
|
CFLAGS_c +=
|
|
|
|
CFLAGS_S += -DASSEMBLY
|
|
|
|
|
2005-04-16 23:28:36 +00:00
|
|
|
# Base object name of the current target
|
|
|
|
#
|
|
|
|
OBJECT = $(firstword $(subst ., ,$(@F)))
|
|
|
|
|
2005-04-08 15:01:17 +00: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-16 23:28:36 +00:00
|
|
|
OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
|
2005-04-08 15:01:17 +00:00
|
|
|
$(BIN)/%.flags :
|
|
|
|
@echo $(OBJ_CFLAGS)
|
|
|
|
|
|
|
|
# Rules for specific object types.
|
|
|
|
#
|
|
|
|
COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
|
|
|
|
RULE_c = $(COMPILE_c) -c $< -o $@
|
2005-04-16 23:33:52 +00:00
|
|
|
RULE_c_to_dbg.o = $(COMPILE_c) -Ddebug_$(OBJECT) -c $< -o $@
|
2005-04-25 19:25:45 +00:00
|
|
|
RULE_c_to_dbg2.o = $(COMPILE_c) -Ddebug_$(OBJECT)=2 -c $< -o $@
|
2005-04-08 15:01:17 +00:00
|
|
|
RULE_c_to_c = $(COMPILE_c) -E -c $< > $@
|
2006-04-24 15:20:01 +00:00
|
|
|
RULE_c_to_s = $(COMPILE_c) -S -g0 -c $< -o $@
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
|
|
|
|
ASSEMBLE_S = $(AS) $(ASFLAGS)
|
|
|
|
RULE_S = $(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
|
|
|
|
RULE_S_to_s = $(PREPROCESS_S) $< > $@
|
|
|
|
|
2005-04-25 19:25:45 +00:00
|
|
|
DEBUG_TARGETS += dbg2.o dbg.o c s
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
# SRCDIRS lists all directories containing source files.
|
|
|
|
#
|
2005-04-22 16:36:44 +00:00
|
|
|
SRCDIRS += core
|
2005-04-30 14:45:09 +00:00
|
|
|
SRCDIRS += proto
|
2006-07-19 17:00:40 +00:00
|
|
|
SRCDIRS += net net/uip net/tcp net/udp
|
2005-05-18 11:12:17 +00:00
|
|
|
#SRCDIRS += image
|
2005-04-22 16:36:44 +00:00
|
|
|
SRCDIRS += drivers/bus
|
|
|
|
SRCDIRS += drivers/net
|
2006-05-13 11:35:29 +00:00
|
|
|
SRCDIRS += drivers/block
|
2006-05-17 17:31:18 +00:00
|
|
|
SRCDIRS += drivers/scsi
|
2006-05-31 14:31:48 +00:00
|
|
|
SRCDIRS += drivers/ata
|
2006-05-26 15:39:24 +00:00
|
|
|
SRCDIRS += drivers/nvs
|
2006-06-08 19:47:09 +00:00
|
|
|
SRCDIRS += drivers/bitbash
|
2005-05-23 23:31:59 +00:00
|
|
|
SRCDIRS += interface/pxe
|
2006-06-01 11:05:36 +00:00
|
|
|
SRCDIRS += tests
|
2006-06-22 17:15:45 +00:00
|
|
|
SRCDIRS += crypto
|
2006-12-20 03:04:07 +00:00
|
|
|
SRCDIRS += hci hci/commands hci/tui
|
|
|
|
SRCDIRS += hci/mucurses hci/mucurses/widgets
|
2006-12-20 07:04:08 +00:00
|
|
|
SRCDIRS += usr
|
2005-04-08 15:01:17 +00:00
|
|
|
|
|
|
|
# NON_AUTO_SRCS lists files that are excluded from the normal
|
|
|
|
# automatic build system.
|
|
|
|
#
|
|
|
|
NON_AUTO_SRCS += core/elf_loader.c
|
2005-04-16 23:28:36 +00:00
|
|
|
NON_AUTO_SRCS += drivers/net/prism2.c
|
2005-04-08 15:01:17 +00: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 13:25:43 +00:00
|
|
|
FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
|
|
|
|
-i$(IDENT) $@
|
|
|
|
|
|
|
|
# Some ROMs require specific flags to be passed to makerom.pl
|
|
|
|
#
|
|
|
|
MAKEROM_FLAGS_3c503 = -3
|
2005-04-08 15:01:17 +00: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
|