Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2007 |
| 3 | # Stefan Roese, DENX Software Engineering, sr@denx.de. |
| 4 | # |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/config.mk |
| 9 | include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk |
| 10 | |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 11 | nandobj := $(OBJTREE)/nand_spl/ |
| 12 | |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 13 | LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds |
Haiying Wang | 3935873 | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 14 | LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \ |
| 15 | $(LDFLAGS_FINAL) |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 16 | AFLAGS += -DCONFIG_NAND_SPL |
| 17 | CFLAGS += -DCONFIG_NAND_SPL |
| 18 | |
Stefan Roese | 41d11a8 | 2007-10-31 20:58:34 +0100 | [diff] [blame] | 19 | SOBJS = start.o resetvec.o cache.o |
Stefan Roese | 80d99a4 | 2007-06-19 16:42:31 +0200 | [diff] [blame] | 20 | COBJS = gpio.o nand_boot.o nand_ecc.o memory.o ndfc.o pll.o |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 21 | |
| 22 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 23 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 24 | __OBJS := $(SOBJS) $(COBJS) |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 25 | LNDIR := $(nandobj)board/$(BOARDDIR) |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 26 | |
Stefan Roese | 80d99a4 | 2007-06-19 16:42:31 +0200 | [diff] [blame] | 27 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin \ |
| 28 | $(nandobj)System.map |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 29 | |
| 30 | all: $(obj).depend $(ALL) |
| 31 | |
| 32 | $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
| 33 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ |
| 34 | |
| 35 | $(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
| 36 | $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ |
| 37 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 38 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds |
Scott Wood | 9d6b227 | 2010-12-10 15:13:39 -0600 | [diff] [blame] | 39 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 40 | -Map $(nandobj)u-boot-spl.map \ |
| 41 | -o $(nandobj)u-boot-spl |
| 42 | |
Stefan Roese | 80d99a4 | 2007-06-19 16:42:31 +0200 | [diff] [blame] | 43 | $(nandobj)System.map: $(nandobj)u-boot-spl |
| 44 | @$(NM) $< | \ |
| 45 | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ |
| 46 | sort > $(nandobj)System.map |
| 47 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 48 | $(nandobj)u-boot.lds: $(LDSCRIPT) |
| 49 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ |
| 50 | |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 51 | # create symbolic links for common files |
| 52 | |
| 53 | # from cpu directory |
Stefan Roese | 41d11a8 | 2007-10-31 20:58:34 +0100 | [diff] [blame] | 54 | $(obj)cache.S: |
| 55 | @rm -f $(obj)cache.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 56 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $(obj)cache.S |
Stefan Roese | 41d11a8 | 2007-10-31 20:58:34 +0100 | [diff] [blame] | 57 | |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 58 | $(obj)gpio.c: |
| 59 | @rm -f $(obj)gpio.c |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 60 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/gpio.c $(obj)gpio.c |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 61 | |
| 62 | $(obj)ndfc.c: |
| 63 | @rm -f $(obj)ndfc.c |
Stefan Roese | 913fd05 | 2009-07-16 15:12:48 +0200 | [diff] [blame] | 64 | ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 65 | |
| 66 | $(obj)resetvec.S: |
| 67 | @rm -f $(obj)resetvec.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 68 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 69 | |
| 70 | $(obj)start.S: |
| 71 | @rm -f $(obj)start.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 72 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 73 | |
| 74 | # from board directory |
| 75 | $(obj)memory.c: |
| 76 | @rm -f $(obj)memory.c |
| 77 | ln -s $(SRCTREE)/board/amcc/acadia/memory.c $(obj)memory.c |
| 78 | |
Stefan Roese | 80d99a4 | 2007-06-19 16:42:31 +0200 | [diff] [blame] | 79 | $(obj)pll.c: |
| 80 | @rm -f $(obj)pll.c |
| 81 | ln -s $(SRCTREE)/board/amcc/acadia/pll.c $(obj)pll.c |
| 82 | |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 83 | # from nand_spl directory |
| 84 | $(obj)nand_boot.c: |
| 85 | @rm -f $(obj)nand_boot.c |
| 86 | ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c |
| 87 | |
Marcel Ziswiler | aea6856 | 2007-12-30 03:30:46 +0100 | [diff] [blame] | 88 | # from drivers/mtd/nand directory |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 89 | $(obj)nand_ecc.c: |
| 90 | @rm -f $(obj)nand_ecc.c |
Jean-Christophe PLAGNIOL-VILLARD | 82ca974 | 2007-11-24 21:26:56 +0100 | [diff] [blame] | 91 | ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c |
Stefan Roese | 23d8d34 | 2007-06-06 11:42:13 +0200 | [diff] [blame] | 92 | |
| 93 | ######################################################################### |
| 94 | |
| 95 | $(obj)%.o: $(obj)%.S |
| 96 | $(CC) $(AFLAGS) -c -o $@ $< |
| 97 | |
| 98 | $(obj)%.o: $(obj)%.c |
| 99 | $(CC) $(CFLAGS) -c -o $@ $< |
| 100 | |
| 101 | # defines $(obj).depend target |
| 102 | include $(SRCTREE)/rules.mk |
| 103 | |
| 104 | sinclude $(obj).depend |
| 105 | |
| 106 | ######################################################################### |