blob: 8fed4b422b7d2bedc1a2b0c39a1e494ef67f788a [file] [log] [blame]
Mike Frysinger9171fc82008-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 Frysinger2c1ea9e2008-08-07 17:52:59 -040019SOBJS := interrupt.o cache.o
Mike Frysinger9171fc82008-03-30 15:46:13 -040020COBJS := cpu.o traps.o interrupts.o reset.o serial.o i2c.o watchdog.o
21
22ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
23COBJS += initcode.o
24endif
25
26SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
27OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
28EXTRA := $(addprefix $(obj),$(EXTRA))
29CEXTRA := $(addprefix $(obj),$(CEXTRA))
30SEXTRA := $(addprefix $(obj),$(SEXTRA))
31
32all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
33
34$(LIB): $(OBJS)
35 $(AR) $(ARFLAGS) $@ $(OBJS)
36
37$(OBJS): $(obj)bootrom-asm-offsets.h
38$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
39 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
40 mv $@.tmp $@
41$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
42 $(CC) $(CFLAGS) -S $^ -o $@.tmp
43 mv $@.tmp $@
44$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
45 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
46
47# make sure our initcode (which goes into LDR) does not
48# have relocs or external references
49READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
50check_initcode: $(obj)initcode.o
51ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
52 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
53 echo "$< contains external references!" 1>&2 ; \
54 exit 1 ; \
55 fi
56endif
57
58#########################################################################
59
60# defines $(obj).depend target
61include $(SRCTREE)/rules.mk
62
63sinclude $(obj).depend
64
65#########################################################################