4 # Copyright (c) 2005-2008 Analog Device Inc.
6 # (C) Copyright 2000-2006
7 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 # Licensed under the GPL-2 or later.
12 include $(TOPDIR)/config.mk
14 LIB = $(obj)lib$(CPU).o
19 SOBJS := interrupt.o cache.o
21 COBJS-$(CONFIG_ADI_GPIO1) += gpio.o
22 COBJS-y += interrupts.o
23 COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
28 SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
29 OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
30 EXTRA := $(addprefix $(obj),$(EXTRA))
31 CEXTRA := $(addprefix $(obj),$(CEXTRA))
32 SEXTRA := $(addprefix $(obj),$(SEXTRA))
34 all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
37 $(call cmd_link_o_target, $(OBJS))
39 $(OBJS): $(obj)bootrom-asm-offsets.h
40 $(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
41 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
43 $(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
44 $(CC) $(CFLAGS) -S $^ -o $@.tmp
46 $(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
47 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
49 # make sure our initcode (which goes into LDR) does not
50 # have relocs or external references
51 $(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
52 READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
53 check_initcode: $(obj)initcode.o
54 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
55 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
56 echo "$< contains external references!" 1>&2 ; \
61 $(obj)init.lds: init.lds.S
62 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
63 $(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
64 $(LD) $(LDFLAGS) -T $^ -o $@
66 #########################################################################
68 # defines $(obj).depend target
69 include $(SRCTREE)/rules.mk
71 sinclude $(obj).depend
73 #########################################################################