2008-10-07 23:46:43 +02:00
|
|
|
# Force i386-only instructions
|
|
|
|
#
|
|
|
|
CFLAGS += -march=i386
|
|
|
|
|
|
|
|
# Code size reduction.
|
|
|
|
#
|
|
|
|
CFLAGS += -fstrength-reduce -fomit-frame-pointer
|
|
|
|
|
|
|
|
# Code size reduction. gcc3 needs a different syntax to gcc2 if you
|
|
|
|
# want to avoid spurious warnings.
|
|
|
|
#
|
|
|
|
GCC_VERSION := $(subst ., ,$(shell $(CC) -dumpversion))
|
|
|
|
GCC_MAJOR := $(firstword $(GCC_VERSION))
|
|
|
|
ifeq ($(GCC_MAJOR),2)
|
|
|
|
CFLAGS += -malign-jumps=1 -malign-loops=1 -malign-functions=1
|
|
|
|
else
|
|
|
|
CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Code size reduction. This is almost always a win. The kernel uses it, too.
|
|
|
|
#
|
|
|
|
CFLAGS += -mpreferred-stack-boundary=2
|
|
|
|
|
|
|
|
# Code size reduction. Use regparm for all functions - C functions
|
|
|
|
# called from assembly (or vice versa) need __cdecl now
|
|
|
|
#
|
|
|
|
CFLAGS += -mregparm=3
|
|
|
|
|
|
|
|
# Code size reduction. Use -mrtd (same __cdecl requirements as above)
|
|
|
|
CFLAGS += -mrtd
|
|
|
|
|
|
|
|
# Code size reduction. This is the logical complement to -mregparm=3.
|
|
|
|
# It doesn't currently buy us anything, but if anything ever tries to
|
|
|
|
# return small structures, let's be prepared
|
|
|
|
#
|
|
|
|
CFLAGS += -freg-struct-return
|
|
|
|
|
|
|
|
# Stop ld from complaining about our customised linker script
|
|
|
|
#
|
|
|
|
LDFLAGS += -N --no-check-sections
|
|
|
|
|
|
|
|
# Force 32-bit code even on an x86-64 machine
|
|
|
|
#
|
|
|
|
CFLAGS += -m32
|
|
|
|
ASFLAGS += --32
|
|
|
|
LDFLAGS += -m elf_i386
|
|
|
|
|
|
|
|
# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
|
|
|
|
#
|
|
|
|
CFLAGS += -fshort-wchar
|
|
|
|
|
|
|
|
# We need to undefine the default macro "i386" when compiling .S
|
|
|
|
# files, otherwise ".arch i386" translates to ".arch 1"...
|
|
|
|
#
|
|
|
|
CFLAGS += -Ui386
|
|
|
|
|
2007-01-14 12:52:22 +01:00
|
|
|
# Locations of utilities
|
|
|
|
#
|
|
|
|
ISOLINUX_BIN = /usr/lib/syslinux/isolinux.bin
|
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
# i386-specific directories containing source files
|
|
|
|
#
|
|
|
|
SRCDIRS += arch/i386/core arch/i386/transitions arch/i386/prefix
|
2005-05-18 13:11:57 +02:00
|
|
|
SRCDIRS += arch/i386/firmware/pcbios
|
2005-05-17 15:34:25 +02:00
|
|
|
SRCDIRS += arch/i386/image
|
2008-03-02 01:41:10 +01:00
|
|
|
SRCDIRS += arch/i386/drivers
|
2005-04-25 21:29:02 +02:00
|
|
|
SRCDIRS += arch/i386/drivers/net
|
2006-05-13 13:35:29 +02:00
|
|
|
SRCDIRS += arch/i386/interface/pcbios
|
2006-08-03 01:08:10 +02:00
|
|
|
SRCDIRS += arch/i386/interface/pxe
|
2008-08-29 00:52:19 +02:00
|
|
|
SRCDIRS += arch/i386/interface/syslinux
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# The various xxx_loader.c files are #included into core/loader.c and
|
|
|
|
# should not be compiled directly.
|
|
|
|
#
|
|
|
|
NON_AUTO_SRCS += arch/i386/core/aout_loader.c
|
|
|
|
NON_AUTO_SRCS += arch/i386/core/freebsd_loader.c
|
|
|
|
NON_AUTO_SRCS += arch/i386/core/wince_loader.c
|
|
|
|
|
2007-01-14 12:52:22 +01:00
|
|
|
# unnrv2b.S is used to generate a 16-bit as well as a 32-bit object.
|
2005-04-08 17:01:17 +02:00
|
|
|
#
|
|
|
|
OBJS_unnrv2b = unnrv2b unnrv2b16
|
|
|
|
CFLAGS_unnrv2b16 = -DCODE16
|
|
|
|
|
|
|
|
# The i386 linker script
|
|
|
|
#
|
|
|
|
LDSCRIPT = arch/i386/scripts/i386.lds
|
|
|
|
|
|
|
|
# Media types.
|
|
|
|
#
|
|
|
|
MEDIA += rom
|
|
|
|
MEDIA += pxe
|
2007-09-06 16:08:41 +02:00
|
|
|
MEDIA += kpxe
|
2005-04-08 17:01:17 +02:00
|
|
|
MEDIA += elf
|
|
|
|
MEDIA += elfd
|
|
|
|
MEDIA += lmelf
|
|
|
|
MEDIA += lmelfd
|
2007-07-06 14:04:06 +02:00
|
|
|
MEDIA += lkrn
|
2005-04-08 17:01:17 +02:00
|
|
|
MEDIA += bImage
|
|
|
|
MEDIA += dsk
|
2007-03-11 01:57:26 +01:00
|
|
|
MEDIA += nbi
|
2006-03-16 18:59:51 +01:00
|
|
|
MEDIA += hd
|
2005-04-08 17:01:17 +02:00
|
|
|
MEDIA += raw
|
|
|
|
MEDIA += com
|
|
|
|
MEDIA += exe
|
|
|
|
|
2007-07-05 15:15:43 +02:00
|
|
|
# Special target for building Master Boot Record binary
|
|
|
|
$(BIN)/mbr.bin : $(BIN)/mbr.o
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
2007-07-16 18:26:07 +02:00
|
|
|
# Some suffixes (e.g. %.fd0) are generated directly from other
|
|
|
|
# finished files (e.g. %.dsk), rather than having their own prefix.
|
2005-04-08 17:01:17 +02:00
|
|
|
|
|
|
|
# rule to write disk images to /dev/fd0
|
|
|
|
NON_AUTO_MEDIA += fd0
|
|
|
|
%fd0 : %dsk
|
2005-03-08 19:53:11 +01:00
|
|
|
dd if=$< bs=512 conv=sync of=/dev/fd0
|
|
|
|
sync
|
|
|
|
|
2007-07-06 00:37:17 +02:00
|
|
|
# rule to create padded disk images
|
|
|
|
NON_AUTO_MEDIA += pdsk
|
|
|
|
%pdsk : %dsk
|
|
|
|
cp $< $@
|
|
|
|
$(PERL) ./util/dskpad.pl $@
|
|
|
|
|
2005-03-08 19:53:11 +01:00
|
|
|
# rule to make a non-emulation ISO boot image
|
2005-04-08 17:01:17 +02:00
|
|
|
NON_AUTO_MEDIA += iso
|
2007-07-06 14:04:06 +02:00
|
|
|
%iso: %lkrn util/geniso
|
2005-04-08 17:01:17 +02:00
|
|
|
ISOLINUX_BIN=$(ISOLINUX_BIN) bash util/geniso $@ $<
|
2005-03-08 19:53:11 +01:00
|
|
|
|
|
|
|
# rule to make a floppy emulation ISO boot image
|
2005-04-08 17:01:17 +02:00
|
|
|
NON_AUTO_MEDIA += liso
|
2007-07-06 14:04:06 +02:00
|
|
|
%liso: %lkrn util/genliso
|
2005-04-08 17:01:17 +02:00
|
|
|
bash util/genliso $@ $<
|
|
|
|
|
2007-07-05 15:15:43 +02:00
|
|
|
# rule to make a USB disk image
|
|
|
|
$(BIN)/usbdisk.bin : $(BIN)/usbdisk.o
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
2007-07-06 00:37:17 +02:00
|
|
|
NON_AUTO_MEDIA += usb
|
2007-07-05 15:15:43 +02:00
|
|
|
%usb: $(BIN)/usbdisk.bin %hd
|
|
|
|
cat $^ > $@
|
|
|
|
|
2005-04-08 17:01:17 +02:00
|
|
|
# Add NON_AUTO_MEDIA to the media list, so that they show up in the
|
|
|
|
# output of "make"
|
|
|
|
#
|
|
|
|
MEDIA += $(NON_AUTO_MEDIA)
|