blob: 0a72ec5df3c0d6cb17edc8f43b75cd8e04dda761 [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
Sebastien Carlier6d8962e2010-11-05 15:48:07 +010014LIB = $(obj)lib$(CPU).o
Mike Frysinger9171fc82008-03-30 15:46:13 -040015
Mike Frysingerfb5166c2011-05-07 17:55:04 -040016EXTRA := init.elf
Mike Frysinger9171fc82008-03-30 15:46:13 -040017CEXTRA := initcode.o
18SEXTRA := start.o
Mike Frysinger2c1ea9e2008-08-07 17:52:59 -040019SOBJS := interrupt.o cache.o
Mike Frysinger490fe732009-07-09 20:56:56 -040020COBJS-y += cpu.o
Mike Frysinger4638b212010-06-02 04:17:26 -040021COBJS-y += gpio.o
Mike Frysinger490fe732009-07-09 20:56:56 -040022COBJS-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
Mike Frysinger36ea8e92008-10-11 21:51:20 -040030SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
31OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
Mike Frysinger9171fc82008-03-30 15:46:13 -040032EXTRA := $(addprefix $(obj),$(EXTRA))
33CEXTRA := $(addprefix $(obj),$(CEXTRA))
34SEXTRA := $(addprefix $(obj),$(SEXTRA))
35
36all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
37
38$(LIB): $(OBJS)
Sebastien Carlier6d8962e2010-11-05 15:48:07 +010039 $(call cmd_link_o_target, $(OBJS))
Mike Frysinger9171fc82008-03-30 15:46:13 -040040
41$(OBJS): $(obj)bootrom-asm-offsets.h
42$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
43 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
44 mv $@.tmp $@
45$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
46 $(CC) $(CFLAGS) -S $^ -o $@.tmp
47 mv $@.tmp $@
48$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
49 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
50
51# make sure our initcode (which goes into LDR) does not
52# have relocs or external references
Mike Frysinger6957a622008-10-24 18:18:16 -040053$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
Mike Frysinger9171fc82008-03-30 15:46:13 -040054READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
55check_initcode: $(obj)initcode.o
56ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
57 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
58 echo "$< contains external references!" 1>&2 ; \
59 exit 1 ; \
60 fi
61endif
62
Mike Frysingerfb5166c2011-05-07 17:55:04 -040063$(obj)init.lds: init.lds.S
64 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
65$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
66 $(LD) $(LDFLAGS) -T $^ -o $@
67
Mike Frysinger9171fc82008-03-30 15:46:13 -040068#########################################################################
69
70# defines $(obj).depend target
71include $(SRCTREE)/rules.mk
72
73sinclude $(obj).depend
74
75#########################################################################