1# 2# (C) Copyright 2004-2006 3# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4# 5# See file CREDITS for list of people who contributed to this 6# project. 7# 8# This program is free software; you can redistribute it and/or 9# modify it under the terms of the GNU General Public License as 10# published by the Free Software Foundation; either version 2 of 11# the License, or (at your option) any later version. 12# 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18# You should have received a copy of the GNU General Public License 19# along with this program; if not, write to the Free Software 20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21# MA 02111-1307 USA 22# 23 24include $(TOPDIR)/config.mk 25 26LIB = $(obj)libcommon.o 27 28# core 29ifndef CONFIG_SPL_BUILD 30COBJS-y += main.o 31COBJS-y += command.o 32COBJS-y += exports.o 33COBJS-y += hash.o 34COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o 35COBJS-y += s_record.o 36COBJS-y += xyzModem.o 37COBJS-y += cmd_disk.o 38 39# boards 40COBJS-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o 41COBJS-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o 42 43# core command 44COBJS-y += cmd_boot.o 45COBJS-$(CONFIG_CMD_BOOTM) += cmd_bootm.o 46COBJS-y += cmd_help.o 47COBJS-y += cmd_nvedit.o 48COBJS-y += cmd_version.o 49 50# environment 51COBJS-y += env_attr.o 52COBJS-y += env_callback.o 53COBJS-y += env_common.o 54COBJS-y += env_flags.o 55COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o 56COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o 57XCOBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o 58COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o 59XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o 60COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o 61COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 62COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o 63COBJS-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o 64COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o 65COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o 66COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o 67COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o 68COBJS-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o 69COBJS-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o 70COBJS-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o 71 72# command 73COBJS-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o 74COBJS-$(CONFIG_SOURCE) += cmd_source.o 75COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o 76COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o 77COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o 78COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o 79COBJS-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o 80COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o 81COBJS-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o 82COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o 83COBJS-$(CONFIG_CMD_CBFS) += cmd_cbfs.o 84COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o 85COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o 86COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o 87COBJS-$(CONFIG_CMD_DATE) += cmd_date.o 88COBJS-$(CONFIG_CMD_SOUND) += cmd_sound.o 89ifdef CONFIG_4xx 90COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o 91endif 92ifdef CONFIG_POST 93COBJS-$(CONFIG_CMD_DIAG) += cmd_diag.o 94endif 95COBJS-$(CONFIG_CMD_DISPLAY) += cmd_display.o 96COBJS-$(CONFIG_CMD_DTT) += cmd_dtt.o 97COBJS-$(CONFIG_CMD_ECHO) += cmd_echo.o 98COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o 99COBJS-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o 100COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o 101COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o 102COBJS-$(CONFIG_CMD_EXT4) += cmd_ext4.o 103COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o 104COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o 105COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o 106COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o 107COBJS-$(CONFIG_CMD_FDOS) += cmd_fdos.o 108COBJS-$(CONFIG_CMD_FITUPD) += cmd_fitupd.o 109COBJS-$(CONFIG_CMD_FLASH) += cmd_flash.o 110ifdef CONFIG_FPGA 111COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o 112endif 113COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o 114COBJS-$(CONFIG_CMD_FUSE) += cmd_fuse.o 115COBJS-$(CONFIG_CMD_GETTIME) += cmd_gettime.o 116COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o 117COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o 118COBJS-$(CONFIG_CMD_HASH) += cmd_hash.o 119COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o 120COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o 121COBJS-$(CONFIG_CMD_INI) += cmd_ini.o 122COBJS-$(CONFIG_CMD_IRQ) += cmd_irq.o 123COBJS-$(CONFIG_CMD_ITEST) += cmd_itest.o 124COBJS-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o 125COBJS-$(CONFIG_CMD_CRAMFS) += cmd_cramfs.o 126COBJS-$(CONFIG_CMD_LDRINFO) += cmd_ldrinfo.o 127COBJS-$(CONFIG_CMD_LED) += cmd_led.o 128COBJS-$(CONFIG_CMD_LICENSE) += cmd_license.o 129COBJS-y += cmd_load.o 130COBJS-$(CONFIG_LOGBUFFER) += cmd_log.o 131COBJS-$(CONFIG_ID_EEPROM) += cmd_mac.o 132COBJS-$(CONFIG_CMD_MD5SUM) += cmd_md5sum.o 133COBJS-$(CONFIG_CMD_MEMORY) += cmd_mem.o 134COBJS-$(CONFIG_CMD_IO) += cmd_io.o 135COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o 136COBJS-$(CONFIG_MII) += miiphyutil.o 137COBJS-$(CONFIG_CMD_MII) += miiphyutil.o 138COBJS-$(CONFIG_PHYLIB) += miiphyutil.o 139COBJS-$(CONFIG_CMD_MII) += cmd_mii.o 140ifdef CONFIG_PHYLIB 141COBJS-$(CONFIG_CMD_MII) += cmd_mdio.o 142endif 143COBJS-$(CONFIG_CMD_MISC) += cmd_misc.o 144COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o 145COBJS-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o 146COBJS-$(CONFIG_MP) += cmd_mp.o 147COBJS-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o 148COBJS-$(CONFIG_CMD_NAND) += cmd_nand.o 149COBJS-$(CONFIG_CMD_NET) += cmd_net.o 150COBJS-$(CONFIG_CMD_ONENAND) += cmd_onenand.o 151COBJS-$(CONFIG_CMD_OTP) += cmd_otp.o 152COBJS-$(CONFIG_CMD_PART) += cmd_part.o 153ifdef CONFIG_PCI 154COBJS-$(CONFIG_CMD_PCI) += cmd_pci.o 155endif 156COBJS-y += cmd_pcmcia.o 157COBJS-$(CONFIG_CMD_PORTIO) += cmd_portio.o 158COBJS-$(CONFIG_CMD_PXE) += cmd_pxe.o 159COBJS-$(CONFIG_CMD_READ) += cmd_read.o 160COBJS-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o 161COBJS-$(CONFIG_CMD_REISER) += cmd_reiser.o 162COBJS-$(CONFIG_SANDBOX) += cmd_sandbox.o 163COBJS-$(CONFIG_CMD_SATA) += cmd_sata.o 164COBJS-$(CONFIG_CMD_SF) += cmd_sf.o 165COBJS-$(CONFIG_CMD_SCSI) += cmd_scsi.o 166COBJS-$(CONFIG_CMD_SHA1SUM) += cmd_sha1sum.o 167COBJS-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o 168COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o 169COBJS-$(CONFIG_CMD_SPIBOOTLDR) += cmd_spibootldr.o 170COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o 171COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o 172COBJS-$(CONFIG_CMD_TIME) += cmd_time.o 173COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o 174COBJS-$(CONFIG_CMD_TPM) += cmd_tpm.o 175COBJS-$(CONFIG_CMD_TSI148) += cmd_tsi148.o 176COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o 177COBJS-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o 178COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o 179COBJS-$(CONFIG_CMD_UNZIP) += cmd_unzip.o 180ifdef CONFIG_CMD_USB 181COBJS-y += cmd_usb.o 182COBJS-y += usb.o usb_hub.o 183COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o 184endif 185COBJS-$(CONFIG_CMD_USB_MASS_STORAGE) += cmd_usb_mass_storage.o 186COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o 187COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o 188COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o 189COBJS-$(CONFIG_CMD_ZIP) += cmd_zip.o 190COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o 191 192# others 193ifdef CONFIG_DDR_SPD 194SPD := y 195endif 196ifdef CONFIG_SPD_EEPROM 197SPD := y 198endif 199COBJS-$(SPD) += ddr_spd.o 200COBJS-$(CONFIG_HWCONFIG) += hwconfig.o 201COBJS-$(CONFIG_BOOTSTAGE) += bootstage.o 202COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o 203COBJS-y += flash.o 204COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o 205COBJS-$(CONFIG_I2C_EDID) += edid.o 206COBJS-$(CONFIG_KALLSYMS) += kallsyms.o 207COBJS-$(CONFIG_LCD) += lcd.o 208COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o 209COBJS-$(CONFIG_MENU) += menu.o 210COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o 211COBJS-$(CONFIG_UPDATE_TFTP) += update.o 212COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o 213COBJS-$(CONFIG_CMD_DFU) += cmd_dfu.o 214COBJS-$(CONFIG_CMD_GPT) += cmd_gpt.o 215endif 216 217ifdef CONFIG_SPL_BUILD 218COBJS-y += cmd_nvedit.o 219COBJS-y += env_common.o 220COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 221COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o 222COBJS-$(CONFIG_SPL_NET_SUPPORT) += cmd_nvedit.o 223COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_attr.o 224COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_callback.o 225COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_common.o 226COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_flags.o 227COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_nowhere.o 228COBJS-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o 229endif 230COBJS-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o 231COBJS-y += console.o 232COBJS-y += dlmalloc.o 233COBJS-y += image.o 234COBJS-y += memsize.o 235COBJS-y += stdio.o 236 237 238COBJS := $(sort $(COBJS-y)) 239XCOBJS := $(sort $(XCOBJS-y)) 240SRCS := $(COBJS:.o=.c) $(XCOBJS:.o=.c) 241OBJS := $(addprefix $(obj),$(COBJS)) 242XOBJS := $(addprefix $(obj),$(XCOBJS)) 243 244CPPFLAGS += -I.. 245 246all: $(LIB) $(XOBJS) 247 248$(LIB): $(obj).depend $(OBJS) 249 $(call cmd_link_o_target, $(OBJS)) 250 251$(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc 252 $(CC) $(AFLAGS) -Wa,--no-warn \ 253 -DENV_CRC=$(shell $(obj)../tools/envcrc) \ 254 -c -o $@ $(src)env_embedded.c 255 256$(obj)../tools/envcrc: 257 $(MAKE) -C ../tools 258 259# SEE README.arm-unaligned-accesses 260$(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) 261$(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) 262 263######################################################################### 264 265# defines $(obj).depend target 266include $(SRCTREE)/rules.mk 267 268sinclude $(obj).depend 269 270######################################################################### 271