Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #
  2. # (C) Copyright 2000-2006
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # See file CREDITS for list of people who contributed to this
  6. # project.
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License as
  10. # published by the Free Software Foundation; either version 2 of
  11. # the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. # MA 02111-1307 USA
  22. #
  23. include $(TOPDIR)/config.mk
  24. ELF-$(ARCH) :=
  25. ELF-$(BOARD) :=
  26. ELF-$(CPU) :=
  27. ELF-y := hello_world
  28. ELF-$(CONFIG_SMC91111) += smc91111_eeprom
  29. ELF-$(CONFIG_SMC911X) += smc911x_eeprom
  30. ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2
  31. ELF-i386 += 82559_eeprom
  32. ELF-mpc5xxx += interrupt
  33. ELF-mpc8xx += test_burst timer
  34. ELF-mpc8260 += mem_to_mem_idma2intr
  35. ELF-ppc += sched
  36. ELF-oxc += eepro100_eeprom
  37. ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))
  38. SREC = $(addsuffix .srec,$(ELF))
  39. BIN = $(addsuffix .bin,$(ELF))
  40. COBJS := $(ELF:=.o)
  41. LIB = $(obj)libstubs.a
  42. LIBAOBJS-$(ARCH) :=
  43. LIBAOBJS-$(CPU) :=
  44. LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
  45. LIBAOBJS-mpc8xx += test_burst_lib.o
  46. LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
  47. LIBCOBJS = stubs.o
  48. LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
  49. SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
  50. OBJS := $(addprefix $(obj),$(COBJS))
  51. ELF := $(addprefix $(obj),$(ELF))
  52. BIN := $(addprefix $(obj),$(BIN))
  53. SREC := $(addprefix $(obj),$(SREC))
  54. gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
  55. CPPFLAGS += -I..
  56. all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
  57. #########################################################################
  58. $(LIB): $(obj).depend $(LIBOBJS)
  59. $(AR) $(ARFLAGS) $@ $(LIBOBJS)
  60. $(ELF):
  61. $(obj)%: $(obj)%.o $(LIB)
  62. $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
  63. -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
  64. -L$(gcclibdir) -lgcc
  65. $(SREC):
  66. $(obj)%.srec: $(obj)%
  67. $(OBJCOPY) -O srec $< $@ 2>/dev/null
  68. $(BIN):
  69. $(obj)%.bin: $(obj)%
  70. $(OBJCOPY) -O binary $< $@ 2>/dev/null
  71. #########################################################################
  72. # defines $(obj).depend target
  73. include $(SRCTREE)/rules.mk
  74. sinclude $(obj).depend
  75. #########################################################################