You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 7.6KB

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