blob: 1421cb2ca25e2867889d258be12fe778533f75fa [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
Sebastien Carliera8d426f2010-11-05 15:48:07 +010014LIB = $(obj)lib$(CPU).o
Mike Frysinger94bae5c2008-03-30 15:46:13 -040015
Mike Frysingerb618d4d2011-05-07 17:55:04 -040016EXTRA := init.elf
Mike Frysinger94bae5c2008-03-30 15:46:13 -040017CEXTRA := 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
Sonic Zhang3edc3f32013-05-02 13:46:21 +080021COBJS-$(CONFIG_ADI_GPIO1) += gpio.o
Mike Frysingerab673ea2009-07-09 20:56:56 -040022COBJS-y += interrupts.o
Mike Frysinger7504e972008-10-11 21:51:20 -040023COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
Mike Frysingerab673ea2009-07-09 20:56:56 -040024COBJS-y += os_log.o
25COBJS-y += reset.o
Mike Frysingerab673ea2009-07-09 20:56:56 -040026COBJS-y += traps.o
Mike Frysinger94bae5c2008-03-30 15:46:13 -040027
Mike Frysinger7504e972008-10-11 21:51:20 -040028SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
29OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
Mike Frysinger94bae5c2008-03-30 15:46:13 -040030EXTRA := $(addprefix $(obj),$(EXTRA))
31CEXTRA := $(addprefix $(obj),$(CEXTRA))
32SEXTRA := $(addprefix $(obj),$(SEXTRA))
33
34all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
35
36$(LIB): $(OBJS)
Sebastien Carliera8d426f2010-11-05 15:48:07 +010037 $(call cmd_link_o_target, $(OBJS))
Mike Frysinger94bae5c2008-03-30 15:46:13 -040038
39$(OBJS): $(obj)bootrom-asm-offsets.h
40$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
41 echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
42 mv $@.tmp $@
43$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
44 $(CC) $(CFLAGS) -S $^ -o $@.tmp
45 mv $@.tmp $@
46$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
47 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
48
49# make sure our initcode (which goes into LDR) does not
50# have relocs or external references
Mike Frysinger26bf0cbe2008-10-24 18:18:16 -040051$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
Mike Frysinger94bae5c2008-03-30 15:46:13 -040052READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
53check_initcode: $(obj)initcode.o
54ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
55 @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
56 echo "$< contains external references!" 1>&2 ; \
57 exit 1 ; \
58 fi
59endif
60
Mike Frysingerb618d4d2011-05-07 17:55:04 -040061$(obj)init.lds: init.lds.S
62 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
63$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
64 $(LD) $(LDFLAGS) -T $^ -o $@
65
Mike Frysinger94bae5c2008-03-30 15:46:13 -040066#########################################################################
67
68# defines $(obj).depend target
69include $(SRCTREE)/rules.mk
70
71sinclude $(obj).depend
72
73#########################################################################