blob: 50c1eeab9dc10ce5587a3359220cec5404388601 [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 Frysingera5384ae2010-04-29 01:34:57 -040020COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o
Mike Frysinger490fe732009-07-09 20:56:56 -040021COBJS-y += cpu.o
22COBJS-y += interrupts.o
Mike Frysinger36ea8e92008-10-11 21:51:20 -040023COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
Mike Frysinger490fe732009-07-09 20:56:56 -040024COBJS-y += os_log.o
25COBJS-y += reset.o
26COBJS-y += serial.o
27COBJS-y += traps.o
Mike Frysinger313e8aa2009-11-12 18:42:07 -050028COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o
Mike Frysinger9171fc82008-03-30 15:46:13 -040029
30ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
Mike Frysinger36ea8e92008-10-11 21:51:20 -040031COBJS-y += initcode.o
Mike Frysinger9171fc82008-03-30 15:46:13 -040032endif
33
Mike Frysinger36ea8e92008-10-11 21:51:20 -040034SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
35OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
Mike Frysinger9171fc82008-03-30 15:46:13 -040036EXTRA := $(addprefix $(obj),$(EXTRA))
37CEXTRA := $(addprefix $(obj),$(CEXTRA))
38SEXTRA := $(addprefix $(obj),$(SEXTRA))
39
40all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
41
42$(LIB): $(OBJS)
43 $(AR) $(ARFLAGS) $@ $(OBJS)
44
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
48 mv $@.tmp $@
49$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
50 $(CC) $(CFLAGS) -S $^ -o $@.tmp
51 mv $@.tmp $@
52$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
53 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
54
55# make sure our initcode (which goes into LDR) does not
56# have relocs or external references
Mike Frysinger6957a622008-10-24 18:18:16 -040057$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
Mike Frysinger9171fc82008-03-30 15:46:13 -040058READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
59check_initcode: $(obj)initcode.o
60ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
61 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
62 echo "$< contains external references!" 1>&2 ; \
63 exit 1 ; \
64 fi
65endif
66
67#########################################################################
68
69# defines $(obj).depend target
70include $(SRCTREE)/rules.mk
71
72sinclude $(obj).depend
73
74#########################################################################