• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Force i386-only instructions
2#
3CFLAGS		+= -march=i386
4
5# Code size reduction.
6#
7CFLAGS		+= -fomit-frame-pointer
8
9# Code size reduction.
10#
11ifeq ($(CCTYPE),gcc)
12CFLAGS		+= -fstrength-reduce
13endif
14
15# Code size reduction.  gcc3 needs a different syntax to gcc2 if you
16# want to avoid spurious warnings.
17#
18ifeq ($(CCTYPE),gcc)
19GCC_VERSION	:= $(subst ., ,$(shell $(CC) -dumpversion))
20GCC_MAJOR	:= $(firstword $(GCC_VERSION))
21ifeq ($(GCC_MAJOR),2)
22CFLAGS		+= -malign-jumps=1 -malign-loops=1 -malign-functions=1
23else
24CFLAGS		+= -falign-jumps=1 -falign-loops=1 -falign-functions=1
25endif # gcc2
26endif # gcc
27
28# Code size reduction.  This is almost always a win.  The kernel uses
29# it, too.
30#
31ifeq ($(CCTYPE),gcc)
32CFLAGS		+= -mpreferred-stack-boundary=2
33endif
34
35# Code size reduction.  Use regparm for all functions - C functions
36# called from assembly (or vice versa) need __asmcall now
37#
38CFLAGS		+= -mregparm=3
39
40# Code size reduction.  Use -mrtd (same __asmcall requirements as above)
41ifeq ($(CCTYPE),gcc)
42CFLAGS		+= -mrtd
43endif
44
45# Code size reduction.  This is the logical complement to -mregparm=3.
46# It doesn't currently buy us anything, but if anything ever tries to
47# return small structures, let's be prepared
48#
49CFLAGS		+= -freg-struct-return
50
51# Force 32-bit code even on an x86-64 machine
52#
53CFLAGS		+= -m32
54ASFLAGS		+= --32
55ifeq ($(HOST_OS),FreeBSD)
56LDFLAGS		+= -m elf_i386_fbsd
57else
58LDFLAGS		+= -m elf_i386
59endif
60
61# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
62#
63CFLAGS		+= -fshort-wchar
64
65# We need to undefine the default macro "i386" when compiling .S
66# files, otherwise ".arch i386" translates to ".arch 1"...
67#
68CFLAGS			+= -Ui386
69
70# Locations of utilities
71#
72ISOLINUX_BIN	= /usr/lib/syslinux/isolinux.bin
73
74# i386-specific directories containing source files
75#
76SRCDIRS		+= arch/i386/core arch/i386/transitions arch/i386/prefix
77SRCDIRS		+= arch/i386/firmware/pcbios
78SRCDIRS		+= arch/i386/image
79SRCDIRS		+= arch/i386/drivers
80SRCDIRS		+= arch/i386/drivers/net
81SRCDIRS		+= arch/i386/interface/pcbios
82SRCDIRS		+= arch/i386/interface/pxe
83SRCDIRS		+= arch/i386/interface/pxeparent
84SRCDIRS 	+= arch/i386/interface/syslinux
85SRCDIRS		+= arch/i386/hci/commands
86
87# The various xxx_loader.c files are #included into core/loader.c and
88# should not be compiled directly.
89#
90NON_AUTO_SRCS	+= arch/i386/core/aout_loader.c
91NON_AUTO_SRCS	+= arch/i386/core/freebsd_loader.c
92NON_AUTO_SRCS	+= arch/i386/core/wince_loader.c
93
94# Include common x86 Makefile
95#
96MAKEDEPS	+= arch/x86/Makefile
97include arch/x86/Makefile
98
99# Include platform-specific Makefile
100#
101MAKEDEPS	+= arch/i386/Makefile.$(PLATFORM)
102include arch/i386/Makefile.$(PLATFORM)
103
104# Some suffixes (e.g. %.fd0) are generated directly from other
105# finished files (e.g. %.dsk), rather than having their own prefix.
106
107# rule to write disk images to /dev/fd0
108NON_AUTO_MEDIA	+= fd0
109%fd0 : %dsk
110	$(QM)$(ECHO) "  [DD] $@"
111	$(Q)dd if=$< bs=512 conv=sync of=/dev/fd0
112	$(Q)sync
113
114# Add NON_AUTO_MEDIA to the media list, so that they show up in the
115# output of "make"
116#
117MEDIA		+= $(NON_AUTO_MEDIA)
118