blob: 5eef6a3063aa99d271be1a34414c90d13a4b26db [file] [log] [blame]
Mike Frysinger94bae5c2008-03-30 15:46:13 -04001#
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
14LIB = $(obj)lib$(CPU).a
15
16EXTRA :=
17CEXTRA := initcode.o
18SEXTRA := start.o
Mike Frysingerf9c015b2008-08-07 17:52:59 -040019SOBJS := interrupt.o cache.o
Mike Frysingerab673ea2009-07-09 20:56:56 -040020COBJS-y += cpu.o
21COBJS-y += interrupts.o
Mike Frysinger7504e972008-10-11 21:51:20 -040022COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
Mike Frysingerab673ea2009-07-09 20:56:56 -040023COBJS-y += os_log.o
24COBJS-y += reset.o
25COBJS-y += serial.o
26COBJS-y += traps.o
27COBJS-y += watchdog.o
Mike Frysinger94bae5c2008-03-30 15:46:13 -040028
29ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
Mike Frysinger7504e972008-10-11 21:51:20 -040030COBJS-y += initcode.o
Mike Frysinger94bae5c2008-03-30 15:46:13 -040031endif
32
Mike Frysinger7504e972008-10-11 21:51:20 -040033SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
34OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
Mike Frysinger94bae5c2008-03-30 15:46:13 -040035EXTRA := $(addprefix $(obj),$(EXTRA))
36CEXTRA := $(addprefix $(obj),$(CEXTRA))
37SEXTRA := $(addprefix $(obj),$(SEXTRA))
38
39all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
40
41$(LIB): $(OBJS)
42 $(AR) $(ARFLAGS) $@ $(OBJS)
43
44$(OBJS): $(obj)bootrom-asm-offsets.h
45$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
46 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
47 mv $@.tmp $@
48$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
49 $(CC) $(CFLAGS) -S $^ -o $@.tmp
50 mv $@.tmp $@
51$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
52 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
53
54# make sure our initcode (which goes into LDR) does not
55# have relocs or external references
Mike Frysinger26bf0cbe2008-10-24 18:18:16 -040056$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
Mike Frysinger94bae5c2008-03-30 15:46:13 -040057READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
58check_initcode: $(obj)initcode.o
59ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
60 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
61 echo "$< contains external references!" 1>&2 ; \
62 exit 1 ; \
63 fi
64endif
65
66#########################################################################
67
68# defines $(obj).depend target
69include $(SRCTREE)/rules.mk
70
71sinclude $(obj).depend
72
73#########################################################################