Makefile 2.0 KB

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