Add e1000 directory to build, since the driver compiles cleanly.
[gpxe.git] / src / Makefile
blobed39ab71a81310cbe5c807aa8a5350dc632fa815
1 # Initialise variables that get added to throughout the various Makefiles
3 MAKEDEPS := Makefile .toolcheck
4 SRCDIRS :=
5 SRCS :=
6 NON_AUTO_SRCS :=
7 DRIVERS :=
8 ROMS :=
9 MEDIA :=
10 NON_AUTO_MEDIA :=
12 # Grab the central Config file.
14 MAKEDEPS += Config
15 include Config
17 # Location to place generated files
19 BIN := bin
21 # If no architecture is specified in Config or on the command-line,
22 # use that of the build machine.
24 ifndef ARCH
25 ARCH := $(shell uname -m | sed -e s,i[3456789]86,i386,)
26 endif
28 # handle x86_64 like i386, but set -m32 option for 32bit code only
29 ifeq ($(ARCH),x86_64)
30 ARCH := i386
31 CFLAGS += -m32
32 ASFLAGS += --32
33 LDFLAGS += -m elf_i386
34 endif
36 # Drag in architecture-specific Config
38 MAKEDEPS += arch/$(ARCH)/Config
39 include arch/$(ARCH)/Config
41 # If invoked with no build target, print out a helpfully suggestive
42 # message.
44 noargs : blib $(BIN)/NIC $(BIN)/gpxe.dsk $(BIN)/gpxe.iso $(BIN)/gpxe.usb
45 @$(ECHO) '==========================================================='
46 @$(ECHO)
47 @$(ECHO) 'To create a bootable floppy, type'
48 @$(ECHO) ' cat $(BIN)/gpxe.dsk > /dev/fd0'
49 @$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
50 @$(ECHO) 'data already on the disk.'
51 @$(ECHO)
52 @$(ECHO) 'To create a bootable USB key, type'
53 @$(ECHO) ' cat $(BIN)/gpxe.usb > /dev/sdX'
54 @$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
55 @$(ECHO) 'disk on your system. This will erase any data already on'
56 @$(ECHO) 'the USB key.'
57 @$(ECHO)
58 @$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
59 @$(ECHO) '$(BIN)/gpxe.iso to a blank CD-ROM.'
60 @$(ECHO)
61 @$(ECHO) 'These images contain drivers for all supported cards. You'
62 @$(ECHO) 'can build more customised images, and ROM images, using'
63 @$(ECHO) ' make bin/<rom-name>.<output-format>'
64 @$(ECHO)
65 @$(ECHO) '==========================================================='
67 # Locations of utilities
69 ECHO ?= /bin/echo -e
70 HOST_CC ?= gcc
71 CPP ?= gcc -E -Wp,-Wall
72 RM ?= rm -f
73 TOUCH ?= touch
74 MKDIR ?= mkdir
75 CP ?= cp
76 PERL ?= /usr/bin/perl
77 CC ?= $(CROSS_COMPILE)gcc
78 AS ?= $(CROSS_COMPILE)as
79 LD ?= $(CROSS_COMPILE)ld
80 SIZE ?= $(CROSS_COMPILE)size
81 AR ?= $(CROSS_COMPILE)ar
82 RANLIB ?= $(CROSS_COMPILE)ranlib
83 OBJCOPY ?= $(CROSS_COMPILE)objcopy
84 NM ?= $(CROSS_COMPILE)nm
85 OBJDUMP ?= $(CROSS_COMPILE)objdump
86 PARSEROM ?= $(PERL) ./util/parserom.pl
87 MAKEROM ?= $(PERL) ./util/makerom.pl
88 MKCONFIG ?= $(PERL) ./util/mkconfig.pl
89 SYMCHECK ?= $(PERL) ./util/symcheck.pl
90 SORTOBJDUMP ?= $(PERL) ./util/sortobjdump.pl
91 NRV2B ?= ./util/nrv2b
92 ZBIN ?= ./util/zbin
93 DOXYGEN ?= doxygen
95 # Common flags
97 CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
98 CFLAGS += -Os -ffreestanding
99 CFLAGS += -Wall -W
100 CFLAGS += -g
101 CFLAGS += $(EXTRA_CFLAGS)
102 ASFLAGS += $(EXTRA_ASFLAGS)
103 LDFLAGS += $(EXTRA_LDFLAGS)
105 ifneq ($(NO_WERROR),1)
106 CFLAGS += -Werror
107 endif
109 # CFLAGS for specific object types
111 CFLAGS_c +=
112 CFLAGS_S += -DASSEMBLY
114 # Base object name of the current target
116 OBJECT = $(firstword $(subst ., ,$(@F)))
118 # CFLAGS for specific object files. You can define
119 # e.g. CFLAGS_rtl8139, and have those flags automatically used when
120 # compiling bin/rtl8139.o.
122 OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
123 $(BIN)/%.flags :
124 @$(ECHO) $(OBJ_CFLAGS)
126 # Rules for specific object types.
128 COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
129 RULE_c = $(Q)$(COMPILE_c) -c $< -o $@
130 RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(OBJECT)=$* -c $< -o $@
131 RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
132 RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
134 PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
135 ASSEMBLE_S = $(AS) $(ASFLAGS)
136 RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
137 RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
139 DEBUG_TARGETS += dbg%.o c s
141 # SRCDIRS lists all directories containing source files.
143 SRCDIRS += libgcc
144 SRCDIRS += core
145 SRCDIRS += proto
146 SRCDIRS += net net/tcp net/udp
147 SRCDIRS += image
148 SRCDIRS += drivers/bus
149 SRCDIRS += drivers/net
150 SRCDIRS += drivers/net/1000
151 SRCDIRS += drivers/block
152 SRCDIRS += drivers/scsi
153 SRCDIRS += drivers/ata
154 SRCDIRS += drivers/nvs
155 SRCDIRS += drivers/bitbash
156 SRCDIRS += drivers/infiniband
157 SRCDIRS += drivers/e1000
158 SRCDIRS += interface/pxe
159 SRCDIRS += tests
160 SRCDIRS += crypto crypto/axtls crypto/matrixssl
161 SRCDIRS += hci hci/commands hci/tui
162 SRCDIRS += hci/mucurses hci/mucurses/widgets
163 SRCDIRS += usr
165 # NON_AUTO_SRCS lists files that are excluded from the normal
166 # automatic build system.
168 NON_AUTO_SRCS += core/elf_loader.c
169 NON_AUTO_SRCS += drivers/net/prism2.c
171 # Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
172 # the automatic build system and varies by target; it includes the
173 # "-p 0x1234,0x5678" string to set the PCI IDs.
175 FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
176 -i$(IDENT) -s 0 $@
178 # Some ROMs require specific flags to be passed to makerom.pl
180 MAKEROM_FLAGS_3c503 = -3
182 # Drag in architecture-specific Makefile
184 MAKEDEPS += arch/$(ARCH)/Makefile
185 include arch/$(ARCH)/Makefile
187 # Drag in the automatic build system and other housekeeping functions
188 MAKEDEPS += Makefile.housekeeping
189 include Makefile.housekeeping