aboutsummaryrefslogtreecommitdiffstats
path: root/gpxe/src/arch/i386/Makefile
blob: dd8da8025d81e97f91c7f4e1a55305c3bb6b73b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Force i386-only instructions
#
CFLAGS		+= -march=i386

# Code size reduction.
#
CFLAGS		+= -fomit-frame-pointer

# Code size reduction.
#
ifeq ($(CCTYPE),gcc)
CFLAGS		+= -fstrength-reduce
endif

# Code size reduction.  gcc3 needs a different syntax to gcc2 if you
# want to avoid spurious warnings.
#
ifeq ($(CCTYPE),gcc)
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 # gcc2
endif # gcc

# Code size reduction.  This is almost always a win.  The kernel uses
# it, too.
#
ifeq ($(CCTYPE),gcc)
CFLAGS		+= -mpreferred-stack-boundary=2
endif

# Code size reduction.  Use regparm for all functions - C functions
# called from assembly (or vice versa) need __asmcall now
#
CFLAGS		+= -mregparm=3

# Code size reduction.  Use -mrtd (same __asmcall requirements as above)
ifeq ($(CCTYPE),gcc)
CFLAGS		+= -mrtd
endif

# 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

# Force 32-bit code even on an x86-64 machine
#
CFLAGS		+= -m32
ASFLAGS		+= --32
ifeq ($(HOST_OS),FreeBSD)
LDFLAGS		+= -m elf_i386_fbsd
else
LDFLAGS		+= -m elf_i386
endif

# 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

# Locations of utilities
#
ISOLINUX_BIN	= /usr/lib/syslinux/isolinux.bin

# i386-specific directories containing source files
#
SRCDIRS		+= arch/i386/core arch/i386/transitions arch/i386/prefix
SRCDIRS		+= arch/i386/firmware/pcbios
SRCDIRS		+= arch/i386/image
SRCDIRS		+= arch/i386/drivers
SRCDIRS		+= arch/i386/drivers/net
SRCDIRS		+= arch/i386/interface/pcbios
SRCDIRS		+= arch/i386/interface/pxe
SRCDIRS		+= arch/i386/interface/pxeparent
SRCDIRS 	+= arch/i386/interface/syslinux
SRCDIRS		+= arch/i386/hci/commands

# 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

# Include common x86 Makefile
#
MAKEDEPS	+= arch/x86/Makefile
include arch/x86/Makefile

# Include platform-specific Makefile
#
MAKEDEPS	+= arch/i386/Makefile.$(PLATFORM)
include arch/i386/Makefile.$(PLATFORM)

# Some suffixes (e.g. %.fd0) are generated directly from other
# finished files (e.g. %.dsk), rather than having their own prefix.

# rule to write disk images to /dev/fd0
NON_AUTO_MEDIA	+= fd0
%fd0 : %dsk
	$(QM)$(ECHO) "  [DD] $@"
	$(Q)dd if=$< bs=512 conv=sync of=/dev/fd0
	$(Q)sync

# Add NON_AUTO_MEDIA to the media list, so that they show up in the
# output of "make"
#
MEDIA		+= $(NON_AUTO_MEDIA)