BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src-rt / cfe / cfe / main / cfe.mk
blob6acfee652c3ae058d3c3a82b41eee184c841b4f1
3 # CFE's version number
6 include ${TOP}/main/cfe_version.mk
9 # Default values for certain parameters
12 CFG_MLONG64 ?= 0
13 CFG_LITTLE ?= 0
14 CFG_RELOC ?= 0
15 CFG_UNCACHED ?= 0
16 CFG_NEWRELOC ?= 0
17 CFG_BOOTRAM ?= 0
18 CFG_VGACONSOLE ?= 0
19 CFG_PCI ?= 1
20 CFG_LDT_REV_017 ?= 0
21 CFG_ZLIB ?= 0
22 CFG_LZMA ?= 0
23 CFG_BIENDIAN ?= 0
24 CFG_DOWNLOAD ?= 0
25 CFG_RAMAPP ?= 0
26 CFG_USB ?= 0
27 CFG_XIP ?= 0
28 CFG_SIM ?= 0
29 CFG_SIM_CONSOLE ?= 0
32 # Paths to other parts of the firmware. Everything's relative to ${TOP}
33 # so that you can actually do a build anywhere you want.
36 ARCH_TOP = ${TOP}/arch/${ARCH}
37 ARCH_SRC = ${ARCH_TOP}/common/src
38 ARCH_INC = ${ARCH_TOP}/common/include
39 CPU_SRC = ${ARCH_TOP}/cpu/${CPU}/src
40 CPU_INC = ${ARCH_TOP}/cpu/${CPU}/include
43 # It's actually optional to have a 'board'
44 # directory. If you don't specify BOARD,
45 # don't include the files.
48 ifneq ("$(strip ${BOARD})","")
49 BOARD_SRC = ${ARCH_TOP}/board/${BOARD}/src
50 BOARD_INC = ${ARCH_TOP}/board/${BOARD}/include
51 endif
54 # Preprocessor defines for CFE's version number
57 VDEF = -DCFE_VER_MAJ=${CFE_VER_MAJ} -DCFE_VER_MIN=${CFE_VER_MIN} -DCFE_VER_ECO=${CFE_VER_ECO}
60 # Construct the list of paths that will eventually become the include
61 # paths and VPATH
64 SRCDIRS = ${ARCH_SRC} ${CPU_SRC} ${BOARD_SRC} ${TOP}/main ${TOP}/vendor ${TOP}/include ${TOP}/net ${TOP}/dev ${TOP}/pci ${TOP}/ui ${TOP}/lib ${TOP}/common ${TOP}/verif
66 CFE_INC = ${TOP}/include ${TOP}/pci ${TOP}/net
68 ifeq ($(strip ${CFG_VGACONSOLE}),1)
69 SRCDIRS += ${TOP}/x86emu ${TOP}/pccons
70 CFE_INC += ${TOP}/x86emu ${TOP}/pccons
71 endif
73 ifeq ($(strip ${CFG_VAPI}),1)
74 SRCDIRS += ${TOP}/verif
75 CFE_INC += ${TOP}/verif
76 endif
78 ifeq ($(strip ${CFG_ZLIB}),1)
79 SRCDIRS += ${TOP}/zlib
80 CFE_INC += ${TOP}/zlib
81 endif
83 ifeq ($(strip ${CFG_SIM}),1)
84 CFLAGS += -DCFG_SIM=1
85 endif
87 ifeq ($(strip ${CFG_SIM_CONSOLE}),1)
88 CFLAGS += -DCFG_SIM_CONSOLE=1
89 endif
91 ifneq (${CFG_HEAP_SIZE},)
92 CFLAGS += -DCFG_HEAP_SIZE=${CFG_HEAP_SIZE}
93 endif
95 ifeq ($(strip ${CFG_LZMA}),1)
96 SRCDIRS += ${SRCBASE}/tools/misc/lzma_src/C
97 CFE_INC += ${SRCBASE}/tools/misc/lzma_src/C
98 endif
100 INCDIRS = $(patsubst %,-I%,$(subst :, ,$(ARCH_INC) $(CPU_INC) $(BOARD_INC) $(CFE_INC)))
102 VPATH = $(SRCDIRS)
105 # Bi-endian support: If we're building the little-endian
106 # version, use a different linker script so we can locate the
107 # ROM at a higher address. You'd think we could do this with
108 # normal linker command line switches, but there appears to be no
109 # command-line way to override the 'AT' qualifier in the linker script.
112 CFG_TEXTAT1MB=0
113 ifeq ($(strip ${CFG_BIENDIAN}),1)
114 ifeq ($(strip ${CFG_LITTLE}),1)
115 CFG_TEXT_START = 0x9fd00000
116 CFG_ROM_START = 0xbfd00000
117 CFG_TEXTAT1MB=1
118 endif
119 endif
123 # Configure tools and basic tools flags. This include sets up
124 # macros for calling the C compiler, basic flags,
125 # and linker scripts.
128 include ${ARCH_SRC}/tools.mk
131 # Add some common flags that are used on any architecture.
134 CFLAGS += -I. $(INCDIRS)
135 CFLAGS += -D_CFE_ ${VDEF} -DCFG_BOARDNAME=\"${CFG_BOARDNAME}\"
138 # Gross - allow more options to be supplied from command line
141 ifdef CFG_OPTIONS
142 OPTFLAGS = $(patsubst %,-D%,$(subst :, ,$(CFG_OPTIONS)))
143 CFLAGS += ${OPTFLAGS}
144 endif
148 # This is the makefile's main target. Note that we actually
149 # do most of the work in 'ALL' not 'all', since we include
150 # other makefiles after this point.
153 all : build_date.c makereg pcidevs_data2.h ALL
156 # Macros that expand to the list of arch-independent files
159 DEVOBJS = dev_flash.o dev_newflash.o dev_null.o dev_promice.o \
160 dev_ide_common.o dev_ns16550.o dev_ds17887clock.o
161 LIBOBJS = lib_malloc.o lib_printf.o lib_queue.o lib_string.o lib_string2.o \
162 lib_arena.o lib_misc.o lib_setjmp.o lib_qsort.o lib_hssubr.o lib_physio.o \
163 lib_scanf.o
164 NETOBJS = net_ether.o net_arp.o net_ip.o net_udp.o net_api.o net_dns.o \
165 net_dhcp.o net_tftp.o net_icmp.o net_tcp.o net_tcpbuf.o dev_tcpconsole.o net_http.o
166 CFEOBJS = env_subr.o cfe_attach.o cfe_iocb_dispatch.o cfe_devfuncs.o \
167 nvram_subr.o cfe_console.o cfe_main.o cfe_mem.o cfe_timer.o \
168 cfe_background.o cfe_error.o build_date.o \
169 cfe_rawfs.o cfe_zlibfs.o cfe_xreq.o cfe_fatfs.o cfe_httpfs.o cfe_filesys.o cfe_boot.o \
170 cfe_autoboot.o cfe_ldr_elf.o cfe_ldr_raw.o cfe_ldr_srec.o cfe_loader.o url.o \
171 cfe_savedata.o cfe_memfs.o
172 UIOBJS = ui_command.o ui_cmddisp.o ui_envcmds.o ui_devcmds.o \
173 ui_netcmds.o ui_tcpcmds.o ui_memcmds.o ui_loadcmds.o ui_pcicmds.o \
174 ui_examcmds.o ui_flash.o ui_misccmds.o \
175 ui_test_disk.o ui_test_ether.o ui_test_flash.o ui_test_uart.o
178 # Add more object files if we're supporting PCI
181 ifeq ($(strip ${CFG_PCI}),1)
182 PCIOBJS = pciconf.o pci_subr.o pci_devs.o
183 PCIOBJS += ldtinit.o
184 DEVOBJS += dev_sp1011.o dev_ht7520.o
185 DEVOBJS += dev_ide_pci.o dev_ns16550_pci.o
186 DEVOBJS += dev_tulip.o dev_dp83815.o
187 CFLAGS += -DCFG_PCI=1
188 ifeq ($(strip ${CFG_LDT_REV_017}),1)
189 CFLAGS += -DCFG_LDT_REV_017=1
190 endif
191 ifeq ($(strip ${CFG_DOWNLOAD}),1)
192 DEVOBJS += dev_bcm1250.o download.data
193 CFLAGS += -DCFG_DOWNLOAD=1
194 endif
195 endif
197 ifeq ($(strip ${CFG_LZMA}),1)
198 ALLOBJS += cfe_lzmafs.o LzmaDec.o
199 CFLAGS += -DCFG_LZMA=1
200 endif
203 # If doing bi-endian, add the compiler switch to change
204 # the way the vectors are generated. These switches are
205 # only added to the big-endian portion of the ROM,
206 # which is located at the real boot vector.
209 ifeq ($(strip ${CFG_BIENDIAN}),1)
210 ifeq ($(strip ${CFG_LITTLE}),0)
211 CFLAGS += -DCFG_BIENDIAN=1
212 endif
213 endif
216 # Use the (slightly more) portable C flash engine
219 ifeq ($(strip ${CFG_CFLASH}),1)
220 CFLAGS += -DCFG_CFLASH=1
221 ALLOBJS += dev_flashop_engine.o
222 endif
225 # Include the makefiles for the architecture-common, cpu-specific,
226 # and board-specific directories. Each of these will supply
227 # some files to "ALLOBJS". The BOARD directory is optional
228 # as some ports are so simple they don't need boad-specific stuff.
231 include ${ARCH_SRC}/Makefile
232 include ${CPU_SRC}/Makefile
234 ifneq ("$(strip ${BOARD})","")
235 include ${BOARD_SRC}/Makefile
236 endif
239 # Add the common object files here.
242 ALLOBJS += $(LIBOBJS) $(DEVOBJS) $(CFEOBJS) $(VENOBJS) $(UIOBJS) $(NETOBJS) $(PCIOBJS)
245 # VAPI continues to be a special case.
248 ifeq ($(strip ${CFG_VAPI}),1)
249 include ${TOP}/verif/Makefile
250 endif
253 # USB support
256 ifeq ($(strip ${CFG_USB}),1)
257 SRCDIRS += ${TOP}/usb
258 CFE_INC += ${TOP}/usb
259 include ${TOP}/usb/Makefile
260 endif
263 # If we're doing the VGA console thing, pull in the x86 emulator
264 # and the pcconsole subsystem
267 ifeq ($(strip ${CFG_VGACONSOLE}),1)
268 include ${TOP}/x86emu/Makefile
269 include ${TOP}/pccons/Makefile
270 endif
273 # If we're including ZLIB, then add its makefile.
276 ifeq ($(strip ${CFG_ZLIB}),1)
277 include ${TOP}/zlib/Makefile
278 CFLAGS += -DCFG_ZLIB=1 -DMY_ZCALLOC -DNO_MEMCPY
279 endif
282 # Vendor extensions come next - they live in their own directory.
285 include ${TOP}/vendor/Makefile
287 .PHONY : all
288 .PHONY : ALL
289 .PHONY : build_date.c
292 # Build the local tools that we use to construct other source files
295 mkpcidb : ${TOP}/hosttools/mkpcidb.c
296 gcc -o mkpcidb ${TOP}/hosttools/mkpcidb.c
298 memconfig : ${TOP}/hosttools/memconfig.c
299 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
301 pcidevs_data2.h : mkpcidb ${TOP}/pci/pcidevs_data.h
302 ./mkpcidb > pcidevs_data2.h
304 mkflashimage : ${TOP}/hosttools/mkflashimage.c
305 gcc -o mkflashimage -I${TOP}/include ${TOP}/hosttools/mkflashimage.c
307 pci_subr.o : ${TOP}/pci/pci_subr.c pcidevs_data2.h
309 build_date.c :
310 echo "const char *builddate = \"`date`\";" > build_date.c
311 echo "const char *builduser = \"`whoami`@`hostname`\";" >> build_date.c
314 # Make a define for the board name
317 CFLAGS += -D_$(patsubst "%",%,${CFG_BOARDNAME})_
319 LIBCFE = libcfe.a
321 %.o : %.c
322 $(GCC) $(CFLAGS) -o $@ $<
324 %.o : %.S
325 $(GCC) $(CFLAGS) -o $@ $<
328 # This rule constructs "libcfe.a" which contains most of the object
329 # files.
332 $(LIBCFE) : $(ALLOBJS)
333 rm -f $(LIBCFE)
334 $(GAR) cr $(LIBCFE) $(ALLOBJS)
335 $(RANLIB) $(LIBCFE)