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).a
19 SOBJS := interrupt.o cache.o
20 COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o
22 COBJS-y += interrupts.o
23 COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
28 COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o
30 ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
34 SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
35 OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
36 EXTRA := $(addprefix $(obj),$(EXTRA))
37 CEXTRA := $(addprefix $(obj),$(CEXTRA))
38 SEXTRA := $(addprefix $(obj),$(SEXTRA))
40 all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
43 $(AR) $(ARFLAGS) $@ $(OBJS)
45 $(OBJS): $(obj)bootrom-asm-offsets.h
46 $(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
47 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
49 $(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
50 $(CC) $(CFLAGS) -S $^ -o $@.tmp
52 $(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
53 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
55 # make sure our initcode (which goes into LDR) does not
56 # have relocs or external references
57 $(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
58 READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
59 check_initcode: $(obj)initcode.o
60 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
61 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
62 echo "$< contains external references!" 1>&2 ; \
67 #########################################################################
69 # defines $(obj).depend target
70 include $(SRCTREE)/rules.mk
72 sinclude $(obj).depend
74 #########################################################################