Makefile 2.2 KB

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