]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/blackfin/cpu/Makefile
Blackfin: add init.elf helper code
[people/ms/u-boot.git] / arch / blackfin / cpu / Makefile
CommitLineData
9171fc81
MF
1#
2# U-boot - Makefile
3#
4# Copyright (c) 2005-2008 Analog Device Inc.
5#
6# (C) Copyright 2000-2006
7# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8#
9# Licensed under the GPL-2 or later.
10#
11
12include $(TOPDIR)/config.mk
13
6d8962e8 14LIB = $(obj)lib$(CPU).o
9171fc81 15
fb5166ce 16EXTRA := init.elf
9171fc81
MF
17CEXTRA := initcode.o
18SEXTRA := start.o
2c1ea9e3 19SOBJS := interrupt.o cache.o
a5384ae4 20COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o
490fe734 21COBJS-y += cpu.o
4638b21f 22COBJS-y += gpio.o
490fe734 23COBJS-y += interrupts.o
36ea8e9a 24COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
490fe734
MF
25COBJS-y += os_log.o
26COBJS-y += reset.o
27COBJS-y += serial.o
28COBJS-y += traps.o
313e8aac 29COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o
9171fc81 30
36ea8e9a
MF
31SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
32OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
9171fc81
MF
33EXTRA := $(addprefix $(obj),$(EXTRA))
34CEXTRA := $(addprefix $(obj),$(CEXTRA))
35SEXTRA := $(addprefix $(obj),$(SEXTRA))
36
37all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
38
39$(LIB): $(OBJS)
6d8962e8 40 $(call cmd_link_o_target, $(OBJS))
9171fc81
MF
41
42$(OBJS): $(obj)bootrom-asm-offsets.h
43$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
44 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
45 mv $@.tmp $@
46$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
47 $(CC) $(CFLAGS) -S $^ -o $@.tmp
48 mv $@.tmp $@
49$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
50 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
51
52# make sure our initcode (which goes into LDR) does not
53# have relocs or external references
6957a620 54$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
9171fc81
MF
55READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
56check_initcode: $(obj)initcode.o
57ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
58 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
59 echo "$< contains external references!" 1>&2 ; \
60 exit 1 ; \
61 fi
62endif
63
fb5166ce
MF
64$(obj)init.lds: init.lds.S
65 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
66$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
67 $(LD) $(LDFLAGS) -T $^ -o $@
68
9171fc81
MF
69#########################################################################
70
71# defines $(obj).depend target
72include $(SRCTREE)/rules.mk
73
74sinclude $(obj).depend
75
76#########################################################################