[intel] Forcibly skip PHY reset on some models
[ipxe.git] / src / arch / i386 / Makefile
1 # Force i386-only instructions
2 #
3 CFLAGS += -march=i386
4
5 # Code size reduction.
6 #
7 CFLAGS += -fomit-frame-pointer
8
9 # Code size reduction.
10 #
11 ifeq ($(CCTYPE),gcc)
12 CFLAGS += -fstrength-reduce
13 endif
14
15 # Code size reduction. gcc3 needs a different syntax to gcc2 if you
16 # want to avoid spurious warnings.
17 #
18 ifeq ($(CCTYPE),gcc)
19 GCC_VERSION := $(subst ., ,$(shell $(CC) -dumpversion))
20 GCC_MAJOR := $(firstword $(GCC_VERSION))
21 ifeq ($(GCC_MAJOR),2)
22 CFLAGS += -malign-jumps=1 -malign-loops=1 -malign-functions=1
23 else
24 CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1
25 endif # gcc2
26 endif # gcc
27
28 # Code size reduction. This is almost always a win. The kernel uses
29 # it, too.
30 #
31 ifeq ($(CCTYPE),gcc)
32 CFLAGS += -mpreferred-stack-boundary=2
33 endif
34
35 # Code size reduction. Use regparm for all functions - C functions
36 # called from assembly (or vice versa) need __asmcall now
37 #
38 CFLAGS += -mregparm=3
39
40 # Code size reduction. Use -mrtd (same __asmcall requirements as above)
41 ifeq ($(CCTYPE),gcc)
42 CFLAGS += -mrtd
43 endif
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 #
49 CFLAGS += -freg-struct-return
50
51 # Force 32-bit code even on an x86-64 machine
52 #
53 CFLAGS += -m32
54 ASFLAGS += --32
55 ifeq ($(HOST_OS),FreeBSD)
56 LDFLAGS += -m elf_i386_fbsd
57 else ifeq ($(HOST_OS),OpenBSD)
58 LDFLAGS += -m elf_i386_obsd
59 else
60 LDFLAGS += -m elf_i386
61 endif
62
63 # EFI requires -fshort-wchar, and nothing else currently uses wchar_t
64 #
65 CFLAGS += -fshort-wchar
66
67 # We need to undefine the default macro "i386" when compiling .S
68 # files, otherwise ".arch i386" translates to ".arch 1"...
69 #
70 CFLAGS += -Ui386
71
72 # Some widespread patched versions of gcc include -fPIE -Wl,-pie by
73 # default. Note that gcc will exit *successfully* if it fails to
74 # recognise an option that starts with "no", so we have to test for
75 # output on stderr instead of checking the exit status.
76 #
77 ifeq ($(CCTYPE),gcc)
78 PIE_TEST = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
79 PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie')
80 WORKAROUND_CFLAGS += $(PIE_FLAGS)
81 endif
82
83 # Define version string for lkrnprefix.S
84 #
85 CFLAGS_lkrnprefix += -DVERSION="\"$(VERSION)\""
86
87 # Locations of isolinux files
88 #
89 SYSLINUX_DIR_LIST := \
90 /usr/lib/syslinux \
91 /usr/lib/syslinux/bios \
92 /usr/lib/syslinux/modules/bios \
93 /usr/share/syslinux \
94 /usr/share/syslinux/bios \
95 /usr/share/syslinux/modules/bios \
96 /usr/local/share/syslinux \
97 /usr/local/share/syslinux/bios \
98 /usr/local/share/syslinux/modules/bios \
99 /usr/lib/ISOLINUX
100 ISOLINUX_BIN_LIST := \
101 $(ISOLINUX_BIN) \
102 $(patsubst %,%/isolinux.bin,$(SYSLINUX_DIR_LIST))
103 LDLINUX_C32_LIST := \
104 $(LDLINUX_C32) \
105 $(patsubst %,%/ldlinux.c32,$(SYSLINUX_DIR_LIST))
106 ISOLINUX_BIN = $(firstword $(wildcard $(ISOLINUX_BIN_LIST)))
107 LDLINUX_C32 = $(firstword $(wildcard $(LDLINUX_C32_LIST)))
108
109 # i386-specific directories containing source files
110 #
111 SRCDIRS += arch/i386/core arch/i386/transitions arch/i386/prefix
112 SRCDIRS += arch/i386/firmware/pcbios
113 SRCDIRS += arch/i386/image
114 SRCDIRS += arch/i386/interface/pcbios
115 SRCDIRS += arch/i386/interface/pxe
116 SRCDIRS += arch/i386/interface/pxeparent
117 SRCDIRS += arch/i386/interface/syslinux
118 SRCDIRS += arch/i386/interface/vmware
119 SRCDIRS += arch/i386/hci/commands
120
121 # Include common x86 Makefile
122 #
123 MAKEDEPS += arch/x86/Makefile
124 include arch/x86/Makefile
125
126 # Include platform-specific Makefile
127 #
128 MAKEDEPS += arch/i386/Makefile.$(PLATFORM)
129 include arch/i386/Makefile.$(PLATFORM)