Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 1 | # |
| 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 | |
| 12 | include $(TOPDIR)/config.mk |
| 13 | |
Sebastien Carlier | a8d426f | 2010-11-05 15:48:07 +0100 | [diff] [blame] | 14 | LIB = $(obj)lib$(CPU).o |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 15 | |
Mike Frysinger | b618d4d | 2011-05-07 17:55:04 -0400 | [diff] [blame^] | 16 | EXTRA := init.elf |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 17 | CEXTRA := initcode.o |
| 18 | SEXTRA := start.o |
Mike Frysinger | f9c015b | 2008-08-07 17:52:59 -0400 | [diff] [blame] | 19 | SOBJS := interrupt.o cache.o |
Mike Frysinger | bc3c042 | 2010-04-29 01:34:57 -0400 | [diff] [blame] | 20 | COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o |
Mike Frysinger | ab673ea | 2009-07-09 20:56:56 -0400 | [diff] [blame] | 21 | COBJS-y += cpu.o |
Mike Frysinger | 83ebf37 | 2010-06-02 04:17:26 -0400 | [diff] [blame] | 22 | COBJS-y += gpio.o |
Mike Frysinger | ab673ea | 2009-07-09 20:56:56 -0400 | [diff] [blame] | 23 | COBJS-y += interrupts.o |
Mike Frysinger | 7504e97 | 2008-10-11 21:51:20 -0400 | [diff] [blame] | 24 | COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o |
Mike Frysinger | ab673ea | 2009-07-09 20:56:56 -0400 | [diff] [blame] | 25 | COBJS-y += os_log.o |
| 26 | COBJS-y += reset.o |
| 27 | COBJS-y += serial.o |
| 28 | COBJS-y += traps.o |
Mike Frysinger | 5443bc4 | 2009-11-12 18:42:07 -0500 | [diff] [blame] | 29 | COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 30 | |
Mike Frysinger | 7504e97 | 2008-10-11 21:51:20 -0400 | [diff] [blame] | 31 | SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c) |
| 32 | OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS)) |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 33 | EXTRA := $(addprefix $(obj),$(EXTRA)) |
| 34 | CEXTRA := $(addprefix $(obj),$(CEXTRA)) |
| 35 | SEXTRA := $(addprefix $(obj),$(SEXTRA)) |
| 36 | |
| 37 | all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode |
| 38 | |
| 39 | $(LIB): $(OBJS) |
Sebastien Carlier | a8d426f | 2010-11-05 15:48:07 +0100 | [diff] [blame] | 40 | $(call cmd_link_o_target, $(OBJS)) |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 41 | |
| 42 | $(OBJS): $(obj)bootrom-asm-offsets.h |
| 43 | $(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk |
| 44 | echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp |
| 45 | mv $@.tmp $@ |
| 46 | $(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c |
| 47 | $(CC) $(CFLAGS) -S $^ -o $@.tmp |
| 48 | mv $@.tmp $@ |
| 49 | $(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s |
| 50 | sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@ |
| 51 | |
| 52 | # make sure our initcode (which goes into LDR) does not |
| 53 | # have relocs or external references |
Mike Frysinger | 26bf0cbe | 2008-10-24 18:18:16 -0400 | [diff] [blame] | 54 | $(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 55 | READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $< |
| 56 | check_initcode: $(obj)initcode.o |
| 57 | ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS) |
| 58 | @if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \ |
| 59 | echo "$< contains external references!" 1>&2 ; \ |
| 60 | exit 1 ; \ |
| 61 | fi |
| 62 | endif |
| 63 | |
Mike Frysinger | b618d4d | 2011-05-07 17:55:04 -0400 | [diff] [blame^] | 64 | $(obj)init.lds: init.lds.S |
| 65 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@ |
| 66 | $(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o |
| 67 | $(LD) $(LDFLAGS) -T $^ -o $@ |
| 68 | |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 69 | ######################################################################### |
| 70 | |
| 71 | # defines $(obj).depend target |
| 72 | include $(SRCTREE)/rules.mk |
| 73 | |
| 74 | sinclude $(obj).depend |
| 75 | |
| 76 | ######################################################################### |