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