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