Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 = hello_world
  25. SREC = hello_world.srec
  26. BIN = hello_world.bin
  27. ELF += atmel_df_pow2
  28. SREC += atmel_df_pow2.srec
  29. BIN += atmel_df_pow2.bin
  30. ifeq ($(CPU),mpc8xx)
  31. ELF += test_burst
  32. SREC += test_burst.srec
  33. BIN += test_burst.bin
  34. endif
  35. ifeq ($(ARCH),i386)
  36. ELF += 82559_eeprom
  37. SREC += 82559_eeprom.srec
  38. BIN += 82559_eeprom.bin
  39. endif
  40. ifeq ($(ARCH),ppc)
  41. ELF += sched
  42. SREC += sched.srec
  43. BIN += sched.bin
  44. endif
  45. ifeq ($(ARCH),blackfin)
  46. BFIN_BIN = smc91111_eeprom smc911x_eeprom
  47. ELF += $(BFIN_BIN)
  48. SREC += $(addsuffix .srec,$(BFIN_BIN))
  49. BIN += $(addsuffix .bin,$(BFIN_BIN))
  50. endif
  51. # The following example is pretty 8xx specific...
  52. ifeq ($(CPU),mpc8xx)
  53. ELF += timer
  54. SREC += timer.srec
  55. BIN += timer.bin
  56. endif
  57. # The following example is 8260 specific...
  58. ifeq ($(CPU),mpc8260)
  59. ELF += mem_to_mem_idma2intr
  60. SREC += mem_to_mem_idma2intr.srec
  61. BIN += mem_to_mem_idma2intr.bin
  62. endif
  63. # Demo for 52xx IRQs
  64. ifeq ($(CPU),mpc5xxx)
  65. ELF += interrupt
  66. SREC += interrupt.srec
  67. BIN += interrupt.bin
  68. endif
  69. # Utility for resetting i82559 EEPROM
  70. ifeq ($(BOARD),oxc)
  71. ELF += eepro100_eeprom
  72. SREC += eepro100_eeprom.srec
  73. BIN += eepro100_eeprom.bin
  74. endif
  75. COBJS := $(SREC:.srec=.o)
  76. LIB = $(obj)libstubs.a
  77. LIBAOBJS=
  78. ifeq ($(ARCH),ppc)
  79. LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
  80. endif
  81. ifeq ($(CPU),mpc8xx)
  82. LIBAOBJS+= test_burst_lib.o
  83. endif
  84. LIBCOBJS= stubs.o
  85. LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
  86. SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S))
  87. OBJS := $(addprefix $(obj),$(COBJS))
  88. ELF := $(addprefix $(obj),$(ELF))
  89. BIN := $(addprefix $(obj),$(BIN))
  90. SREC := $(addprefix $(obj),$(SREC))
  91. gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
  92. CPPFLAGS += -I..
  93. all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
  94. #########################################################################
  95. $(LIB): $(obj).depend $(LIBOBJS)
  96. $(AR) $(ARFLAGS) $@ $(LIBOBJS)
  97. $(ELF):
  98. $(obj)%: $(obj)%.o $(LIB)
  99. $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
  100. -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
  101. -L$(gcclibdir) -lgcc
  102. $(SREC):
  103. $(obj)%.srec: $(obj)%
  104. $(OBJCOPY) -O srec $< $@ 2>/dev/null
  105. $(BIN):
  106. $(obj)%.bin: $(obj)%
  107. $(OBJCOPY) -O binary $< $@ 2>/dev/null
  108. #########################################################################
  109. # defines $(obj).depend target
  110. include $(SRCTREE)/rules.mk
  111. sinclude $(obj).depend
  112. #########################################################################