[ena] Assign memory BAR if left empty by BIOS
[ipxe.git] / src / Makefile
1 ###############################################################################
2 #
3 # Initialise various variables
4 #
5
6 CLEANUP :=
7 CFLAGS :=
8 ASFLAGS :=
9 LDFLAGS :=
10 HOST_CFLAGS :=
11 MAKEDEPS := Makefile
12 CROSS_COMPILE ?= $(CROSS)
13 SYMBOL_PREFIX :=
14
15 ###############################################################################
16 #
17 # Locations of tools
18 #
19 HOST_CC := gcc
20 RM := rm -f
21 TOUCH := touch
22 MKDIR := mkdir
23 CP := cp
24 ECHO := echo
25 PRINTF := printf
26 PERL := perl
27 PYTHON := python
28 TRUE := true
29 CC := $(CROSS_COMPILE)gcc
30 CPP := $(CC) -E
31 AS := $(CROSS_COMPILE)as
32 LD := $(CROSS_COMPILE)ld
33 SIZE := $(CROSS_COMPILE)size
34 AR := $(CROSS_COMPILE)ar
35 RANLIB := $(CROSS_COMPILE)ranlib
36 OBJCOPY := $(CROSS_COMPILE)objcopy
37 NM := $(CROSS_COMPILE)nm
38 OBJDUMP := $(CROSS_COMPILE)objdump
39 OPENSSL := openssl
40 CSPLIT := csplit
41 PARSEROM := ./util/parserom.pl
42 FIXROM := ./util/fixrom.pl
43 SYMCHECK := ./util/symcheck.pl
44 SORTOBJDUMP := ./util/sortobjdump.pl
45 PADIMG := ./util/padimg.pl
46 LICENCE := ./util/licence.pl
47 NRV2B := ./util/nrv2b
48 ZBIN := ./util/zbin
49 ELF2EFI32 := ./util/elf2efi32
50 ELF2EFI64 := ./util/elf2efi64
51 EFIROM := ./util/efirom
52 EFIFATBIN := ./util/efifatbin
53 EINFO := ./util/einfo
54 GENKEYMAP := ./util/genkeymap.py
55 DOXYGEN := doxygen
56 LCAB := lcab
57 QEMUIMG := qemu-img
58
59 ###############################################################################
60 #
61 # SRCDIRS lists all directories containing source files.
62 #
63 SRCDIRS :=
64 SRCDIRS += libgcc
65 SRCDIRS += core
66 SRCDIRS += net net/tcp net/udp net/infiniband
67 SRCDIRS += image
68 SRCDIRS += drivers/bus
69 SRCDIRS += drivers/net
70 SRCDIRS += drivers/net/e1000
71 SRCDIRS += drivers/net/e1000e
72 SRCDIRS += drivers/net/igb
73 SRCDIRS += drivers/net/igbvf
74 SRCDIRS += drivers/net/phantom
75 SRCDIRS += drivers/net/vxge
76 SRCDIRS += drivers/net/efi
77 SRCDIRS += drivers/net/tg3
78 SRCDIRS += drivers/net/bnxt
79 SRCDIRS += drivers/net/sfc
80 SRCDIRS += drivers/block
81 SRCDIRS += drivers/nvs
82 SRCDIRS += drivers/bitbash
83 SRCDIRS += drivers/infiniband
84 SRCDIRS += drivers/infiniband/mlx_utils_flexboot/src
85 SRCDIRS += drivers/infiniband/mlx_utils/src/public
86 SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_reg_access
87 SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_nvconfig
88 SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_vmac
89 SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_blink_leds
90 SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_link_speed
91 SRCDIRS += drivers/infiniband/mlx_utils/mlx_lib/mlx_mtu
92 SRCDIRS += drivers/infiniband/mlx_nodnic/src
93 SRCDIRS += drivers/usb
94 SRCDIRS += interface/pxe interface/efi interface/smbios
95 SRCDIRS += interface/bofm
96 SRCDIRS += interface/xen
97 SRCDIRS += interface/hyperv
98 SRCDIRS += tests
99 SRCDIRS += crypto crypto/mishmash
100 SRCDIRS += hci hci/commands hci/tui
101 SRCDIRS += hci/mucurses hci/mucurses/widgets
102 SRCDIRS += hci/keymap
103 SRCDIRS += usr
104 SRCDIRS += config
105
106 # These directories contain code that is not eligible for UEFI Secure
107 # Boot signing.
108 #
109 SRCDIRS_INSEC += net/oncrpc
110 SRCDIRS_INSEC += net/80211
111 SRCDIRS_INSEC += drivers/net/rtl818x
112 SRCDIRS_INSEC += drivers/net/ath
113 SRCDIRS_INSEC += drivers/net/ath/ath5k
114 SRCDIRS_INSEC += drivers/net/ath/ath9k
115
116 # NON_AUTO_SRCS lists files that are excluded from the normal
117 # automatic build system.
118 #
119 NON_AUTO_SRCS :=
120 NON_AUTO_SRCS += core/version.c
121 NON_AUTO_SRCS += drivers/net/prism2.c
122
123 # INCDIRS lists the include path
124 #
125 INCDIRS :=
126 INCDIRS += include .
127
128 ###############################################################################
129 #
130 # Default build target: build the most common targets and print out a
131 # helpfully suggestive message
132 #
133 ALL := bin/blib.a bin/ipxe.dsk bin/ipxe.lkrn bin/ipxe.iso \
134 bin/ipxe.usb bin/ipxe.pxe bin/undionly.kpxe bin/rtl8139.rom \
135 bin/8086100e.mrom bin/80861209.rom bin/10500940.rom \
136 bin/10222000.rom bin/10ec8139.rom bin/1af41000.rom \
137 bin/8086100f.mrom bin/808610d3.mrom bin/15ad07b0.rom
138
139 all : $(ALL)
140 @$(ECHO) '==========================================================='
141 @$(ECHO)
142 @$(ECHO) 'To create a bootable floppy, type'
143 @$(ECHO) ' cat bin/ipxe.dsk > /dev/fd0'
144 @$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
145 @$(ECHO) 'data already on the disk.'
146 @$(ECHO)
147 @$(ECHO) 'To create a bootable USB key, type'
148 @$(ECHO) ' cat bin/ipxe.usb > /dev/sdX'
149 @$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
150 @$(ECHO) 'disk on your system. This will erase any data already on'
151 @$(ECHO) 'the USB key.'
152 @$(ECHO)
153 @$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
154 @$(ECHO) 'bin/ipxe.iso to a blank CD-ROM.'
155 @$(ECHO)
156 @$(ECHO) 'These images contain drivers for all supported cards. You'
157 @$(ECHO) 'can build more customised images, and ROM images, using'
158 @$(ECHO) ' make bin/<rom-name>.<output-format>'
159 @$(ECHO)
160 @$(ECHO) '==========================================================='
161
162 ###############################################################################
163 #
164 # Comprehensive build target: build a selection of cross-platform
165 # targets to expose potential build errors that show up only on
166 # certain platforms
167 #
168 everything :
169 $(Q)$(MAKE) --no-print-directory $(ALL) \
170 bin/3c509.rom bin/intel.rom bin/intel.mrom \
171 bin-x86_64-pcbios/8086100e.mrom bin-x86_64-pcbios/intel.rom \
172 bin-x86_64-pcbios/ipxe.usb bin-x86_64-pcbios/ipxe.pxe \
173 bin-x86_64-pcbios/undionly.kpxe \
174 bin-i386-efi/ipxe.efi bin-i386-efi/ipxe.efidrv \
175 bin-i386-efi/ipxe.efirom \
176 bin-x86_64-efi/ipxe.efi bin-x86_64-efi/ipxe.efidrv \
177 bin-x86_64-efi/ipxe.efirom \
178 bin-i386-linux/tap.linux bin-x86_64-linux/tap.linux \
179 bin-i386-linux/tests.linux bin-x86_64-linux/tests.linux
180
181 ###############################################################################
182 #
183 # VMware build target: all ROMs used with VMware
184 #
185 vmware : bin/8086100f.mrom bin/808610d3.mrom bin/10222000.rom bin/15ad07b0.rom
186 @$(ECHO) '==========================================================='
187 @$(ECHO)
188 @$(ECHO) 'Available ROMs:'
189 @$(ECHO) ' bin/8086100f.mrom -- intel/e1000'
190 @$(ECHO) ' bin/808610d3.mrom -- intel/e1000e'
191 @$(ECHO) ' bin/10222000.rom -- vlance/pcnet32'
192 @$(ECHO) ' bin/15ad07b0.rom -- vmxnet3'
193 @$(ECHO)
194 @$(ECHO) 'For more information, see https://ipxe.org/howto/vmware'
195 @$(ECHO)
196 @$(ECHO) '==========================================================='
197
198 ###############################################################################
199 #
200 # Build targets that do nothing but might be tried by users
201 #
202 configure :
203 @$(ECHO) "No configuration needed."
204
205 install :
206 @$(ECHO) "No installation required."
207
208 ###############################################################################
209 #
210 # Version number calculations
211 #
212 ifneq ($(wildcard ../.git),)
213 VERSIONS := $(shell git describe --tags --always --long --abbrev=1 --match "v*")
214 VERSION_TUPLE := $(subst ., ,$(subst -, ,$(patsubst v%,%,$(VERSIONS))))
215 VERSION_MAJOR := $(word 1,$(VERSION_TUPLE))
216 VERSION_MINOR := $(word 2,$(VERSION_TUPLE))
217 VERSION_PATCH := $(word 3,$(VERSION_TUPLE))
218 ifeq ($(word 4,$(VERSION_TUPLE)),0)
219 EXTRAVERSION :=
220 else
221 EXTRAVERSION := +
222 endif
223 GITVERSION = $(word 5,$(VERSION_TUPLE))
224 else
225 VERSION_MAJOR = 1
226 VERSION_MINOR = 0
227 VERSION_PATCH = 0
228 EXTRAVERSION = +
229 endif
230 MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
231 VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
232 ifneq ($(GITVERSION),)
233 VERSION += ($(GITVERSION))
234 endif
235 version :
236 @$(ECHO) "$(VERSION)"
237
238 ###############################################################################
239 #
240 # Predefined build shortcuts (for e.g. bin/ipxe.iso)
241
242 # All drivers (excluding USB)
243 #
244 DRIVERS_ipxe = $(DRIVERS_net) $(DRIVERS_infiniband) \
245 $(DRIVERS_xen) $(DRIVERS_hyperv)
246
247 # Raspberry Pi
248 #
249 DRIVERS_rpi = smsc95xx lan78xx
250
251 ###############################################################################
252 #
253 # Drag in the bulk of the build system
254 #
255
256 MAKEDEPS += Makefile.housekeeping
257 include Makefile.housekeeping