6 include ${TOP}/main
/cfe_version.mk
9 # Default values for certain parameters
34 # Paths to other parts of the firmware. Everything's relative to ${TOP}
35 # so that you can actually do a build anywhere you want.
38 ARCH_TOP
= ${TOP}/arch
/${ARCH}
39 ARCH_CMN
= ${TOP}/arch
/common
40 ARCH_SRC
= ${ARCH_TOP}/common
/src
41 ARCH_INC
= ${ARCH_TOP}/common
/include
42 CPU_SRC
= ${ARCH_TOP}/cpu
/${CPU}/src
43 CPU_INC
= ${ARCH_TOP}/cpu
/${CPU}/include
46 # It's actually optional to have a 'board'
47 # directory. If you don't specify BOARD,
48 # don't include the files.
51 ifneq ("$(strip ${BOARD})","")
52 BOARD_SRC
= ${ARCH_TOP}/board
/${BOARD}/src
53 BOARD_CMN
= ${ARCH_CMN}/board
/${BOARD}/src
54 BOARD_INC
= ${ARCH_TOP}/board
/${BOARD}/include
58 # Preprocessor defines for CFE's version number
61 VDEF
= -DCFE_VER_MAJ
=${CFE_VER_MAJ} -DCFE_VER_MIN
=${CFE_VER_MIN} -DCFE_VER_ECO
=${CFE_VER_ECO}
64 # Construct the list of paths that will eventually become the include
68 SRCDIRS
= ${ARCH_SRC} ${CPU_SRC} ${BOARD_SRC} ${BOARD_CMN} ${TOP}/main
${TOP}/vendor
${TOP}/include ${TOP}/net
${TOP}/dev
${TOP}/pci
${TOP}/ui
${TOP}/lib
${TOP}/common
${TOP}/verif
70 CFE_INC
= ${TOP}/include ${TOP}/pci
${TOP}/net
72 ifeq ($(strip ${CFG_VGACONSOLE}),1)
73 SRCDIRS
+= ${TOP}/x86emu
${TOP}/pccons
74 CFE_INC
+= ${TOP}/x86emu
${TOP}/pccons
77 ifeq ($(strip ${CFG_VAPI}),1)
78 SRCDIRS
+= ${TOP}/verif
79 CFE_INC
+= ${TOP}/verif
82 ifeq ($(strip ${CFG_ZLIB}),1)
83 SRCDIRS
+= ${TOP}/zlib
84 CFE_INC
+= ${TOP}/zlib
87 ifeq ($(strip ${CFG_SIM}),1)
91 ifeq ($(strip ${CFG_SIM_CONSOLE}),1)
92 CFLAGS
+= -DCFG_SIM_CONSOLE
=1
95 ifneq (${CFG_HEAP_SIZE},)
96 CFLAGS
+= -DCFG_HEAP_SIZE
=${CFG_HEAP_SIZE}
99 ifeq ($(strip ${CFG_LZMA}),1)
100 SRCDIRS
+= ${SRCBASE}/tools
/misc
/lzma_src
/C
101 CFE_INC
+= ${SRCBASE}/tools
/misc
/lzma_src
/C
104 ifeq ($(strip ${CFG_LDR_SREC}),1)
105 CFLAGS
+= -DCFG_LDR_SREC
=1
108 ifeq ($(strip ${CFG_LDR_ELF}),1)
109 CFLAGS
+= -DCFG_LDR_ELF
=1
112 INCDIRS
= $(patsubst %,-I
%,$(subst :, ,$(ARCH_INC
) $(CPU_INC
) $(BOARD_INC
) $(CFE_INC
)))
117 # Bi-endian support: If we're building the little-endian
118 # version, use a different linker script so we can locate the
119 # ROM at a higher address. You'd think we could do this with
120 # normal linker command line switches, but there appears to be no
121 # command-line way to override the 'AT' qualifier in the linker script.
125 ifeq ($(strip ${CFG_BIENDIAN}),1)
126 ifeq ($(strip ${CFG_LITTLE}),1)
127 CFG_TEXT_START
= 0x9fd00000
128 CFG_ROM_START
= 0xbfd00000
135 # Configure tools and basic tools flags. This include sets up
136 # macros for calling the C compiler, basic flags,
137 # and linker scripts.
140 include ${ARCH_SRC}/tools.mk
143 # Add some common flags that are used on any architecture.
146 CFLAGS
+= -I.
$(INCDIRS
)
147 CFLAGS
+= -D_CFE_
${VDEF} -DCFG_BOARDNAME
=\"${CFG_BOARDNAME}\"
150 # Gross - allow more options to be supplied from command line
154 OPTFLAGS
= $(patsubst %,-D
%,$(subst :, ,$(CFG_OPTIONS
)))
155 CFLAGS
+= ${OPTFLAGS}
160 # This is the makefile's main target. Note that we actually
161 # do most of the work in 'ALL' not 'all', since we include
162 # other makefiles after this point.
165 all : build_date.c makereg pcidevs_data2.h ALL
168 # Macros that expand to the list of arch-independent files
171 DEVOBJS
= dev_flash.o dev_newflash.o dev_null.o dev_promice.o \
172 dev_ide_common.o dev_ns16550.o dev_ds17887clock.o
173 LIBOBJS
= lib_malloc.o lib_printf.o lib_queue.o lib_string.o lib_string2.o \
174 lib_arena.o lib_misc.o lib_setjmp.o lib_qsort.o lib_hssubr.o lib_physio.o \
176 NETOBJS
= net_ether.o net_arp.o net_ip.o net_udp.o net_api.o net_dns.o \
177 net_dhcp.o net_tftp.o net_icmp.o net_tcp.o net_tcpbuf.o dev_tcpconsole.o net_http.o
178 CFEOBJS
= env_subr.o cfe_attach.o cfe_iocb_dispatch.o cfe_devfuncs.o \
179 nvram_subr.o cfe_console.o cfe_main.o cfe_mem.o cfe_timer.o \
180 cfe_background.o cfe_error.o build_date.o \
181 cfe_rawfs.o cfe_zlibfs.o cfe_xreq.o cfe_fatfs.o cfe_httpfs.o cfe_filesys.o cfe_boot.o \
182 cfe_autoboot.o cfe_ldr_elf.o cfe_ldr_raw.o cfe_ldr_srec.o cfe_loader.o url.o \
183 cfe_savedata.o cfe_memfs.o
184 UIOBJS
= ui_command.o ui_cmddisp.o ui_envcmds.o ui_devcmds.o \
185 ui_netcmds.o ui_tcpcmds.o ui_memcmds.o ui_loadcmds.o ui_pcicmds.o \
186 ui_examcmds.o ui_flash.o ui_misccmds.o \
187 ui_test_disk.o ui_test_ether.o ui_test_flash.o ui_test_uart.o
190 # Add more object files if we're supporting PCI
193 ifeq ($(strip ${CFG_PCI}),1)
194 PCIOBJS
= pciconf.o pci_subr.o pci_devs.o
196 DEVOBJS
+= dev_sp1011.o dev_ht7520.o
197 DEVOBJS
+= dev_ide_pci.o dev_ns16550_pci.o
198 DEVOBJS
+= dev_tulip.o dev_dp83815.o
199 CFLAGS
+= -DCFG_PCI
=1
200 ifeq ($(strip ${CFG_LDT_REV_017}),1)
201 CFLAGS
+= -DCFG_LDT_REV_017
=1
203 ifeq ($(strip ${CFG_DOWNLOAD}),1)
204 DEVOBJS
+= dev_bcm1250.o download.data
205 CFLAGS
+= -DCFG_DOWNLOAD
=1
209 ifeq ($(strip ${CFG_LZMA}),1)
210 ALLOBJS
+= cfe_lzmafs.o LzmaDec.o
211 CFLAGS
+= -DCFG_LZMA
=1
215 # If doing bi-endian, add the compiler switch to change
216 # the way the vectors are generated. These switches are
217 # only added to the big-endian portion of the ROM,
218 # which is located at the real boot vector.
221 ifeq ($(strip ${CFG_BIENDIAN}),1)
222 ifeq ($(strip ${CFG_LITTLE}),0)
223 CFLAGS
+= -DCFG_BIENDIAN
=1
228 # Use the (slightly more) portable C flash engine
231 ifeq ($(strip ${CFG_CFLASH}),1)
232 CFLAGS
+= -DCFG_CFLASH
=1
233 ALLOBJS
+= dev_flashop_engine.o
237 # Include the makefiles for the architecture-common, cpu-specific,
238 # and board-specific directories. Each of these will supply
239 # some files to "ALLOBJS". The BOARD directory is optional
240 # as some ports are so simple they don't need boad-specific stuff.
243 include ${ARCH_SRC}/Makefile
244 include ${CPU_SRC}/Makefile
246 ifneq ("$(strip ${BOARD})","")
247 include ${BOARD_SRC}/Makefile
251 # Add the common object files here.
254 ALLOBJS
+= $(LIBOBJS
) $(DEVOBJS
) $(CFEOBJS
) $(VENOBJS
) $(UIOBJS
) $(NETOBJS
) $(PCIOBJS
)
257 # VAPI continues to be a special case.
260 ifeq ($(strip ${CFG_VAPI}),1)
261 include ${TOP}/verif
/Makefile
268 ifeq ($(strip ${CFG_USB}),1)
269 SRCDIRS
+= ${TOP}/usb
270 CFE_INC
+= ${TOP}/usb
271 include ${TOP}/usb
/Makefile
275 # If we're doing the VGA console thing, pull in the x86 emulator
276 # and the pcconsole subsystem
279 ifeq ($(strip ${CFG_VGACONSOLE}),1)
280 include ${TOP}/x86emu
/Makefile
281 include ${TOP}/pccons
/Makefile
285 # If we're including ZLIB, then add its makefile.
288 ifeq ($(strip ${CFG_ZLIB}),1)
289 include ${TOP}/zlib
/Makefile
290 CFLAGS
+= -DCFG_ZLIB
=1 -DMY_ZCALLOC
-DNO_MEMCPY
294 # Vendor extensions come next - they live in their own directory.
297 include ${TOP}/vendor
/Makefile
301 .PHONY
: build_date.c
304 # Build the local tools that we use to construct other source files
307 mkpcidb
: ${TOP}/hosttools
/mkpcidb.c
308 gcc
-o mkpcidb
${TOP}/hosttools
/mkpcidb.c
310 memconfig
: ${TOP}/hosttools
/memconfig.c
311 gcc
-o memconfig
-D_MCSTANDALONE_
-D_MCSTANDALONE_NOISY_
-I
${TOP}/arch
/mips
/cpu
/sb1250
/include ${TOP}/hosttools
/memconfig.c
${TOP}/arch
/${ARCH}/cpu
/${CPU}/src
/sb1250_draminit.c
313 pcidevs_data2.h
: mkpcidb
${TOP}/pci
/pcidevs_data.h
314 .
/mkpcidb
> pcidevs_data2.h
316 mkflashimage
: ${TOP}/hosttools
/mkflashimage.c
317 gcc
-o mkflashimage
-I
${TOP}/include ${TOP}/hosttools
/mkflashimage.c
319 pci_subr.o
: ${TOP}/pci
/pci_subr.c pcidevs_data2.h
322 echo
"const char *builddate = \"`date`\";" > build_date.c
323 echo
"const char *builduser = \"`whoami`@`hostname`\";" >> build_date.c
326 # Make a define for the board name
329 CFLAGS
+= -D_
$(patsubst "%",%,${CFG_BOARDNAME})_
334 $(GCC
) $(CFLAGS
) -o
$@
$<
337 $(GCC
) $(ASFLAGS
) $(CFLAGS
) -o
$@
$<
340 # This rule constructs "libcfe.a" which contains most of the object
344 $(LIBCFE
) : $(ALLOBJS
)
346 $(GAR
) cr
$(LIBCFE
) $(ALLOBJS
)